WASI (WebAssembly System Interface) is the portable boundary between a Wasm program and its host environment. A Wasm runtime implements its APIs so a guest can use selected system capabilities—such as standard output, environment variables, files, sockets, or HTTP—without assuming a particular operating system. The host, rather than the guest binary, supplies those capabilities. section 1.0 section 4.1
This makes a Wasm runtime plus WASI analogous to the layer a Docker engine provides between an application and the host OS. Unlike a traditional container, a Wasm distribution packages application logic rather than a full userspace environment; portability depends on runtimes implementing the standardized interface. section 7.1 section 1.2.5
Figure 4.5 Comparison of WASI 0.1 (a more POSIX-like interface) to WASI 0.2 that defines higher-level interfaces
Compare the POSIX-like foundation of WASI 0.1 with the higher-level, component-oriented interfaces introduced by WASI 0.2. section 4.2
WASI 0.1, also called Preview 1, began as a highly portable POSIX-like subset for Wasm modules. WASI 0.2, or Preview 2, adopts the component model and WIT-defined worlds, enabling broader interfaces. It defines the wasi:cli/command world for command-line programs and wasi:http/proxy for HTTP request and response handling. section 4.2 section 4.7
Give a component controlled file access
A SmartCMS story component reads stories.txt, chooses a line, and returns it to a composed key-value component. The host creates a WASI context, preopens the current directory with read-only permissions, and links WASI into Wasmtime. The guest can read only the capability the host grants, rather than receiving unrestricted OS access. section 4.6 section 4.7
A practical WASI workflow is:
- Create and build a command component with cargo component; current tooling may compile through wasm32-wasip1 and adapt the result to WASI 0.2. section 4.2.1
- Inspect the produced component’s WIT imports and exports with wasm-tools component wit when verifying its interface. section 4.2.1 section 4.7
- Run a command component with Wasmtime, or embed it in a host that configures its WASI context and linker. section 4.2.1 section 4.1
- Compose compatible components with wac plug to connect imports and exports, while granting only the WASI capabilities each composed application needs. section 4.7
WASI is expanding from system-style calls into a collection of standard interfaces for application work, including HTTP, SQL, machine learning, key-value storage, messaging, and more. Many proposed interfaces remain under development rather than fully standardized. WASI 0.3 is planned to add native asynchronous futures and streams; it is intended to lay groundwork for WASI 1.0’s long-term stability guarantees. section 5.1 section 9.3 section 9.5


