Runtime
wasmCloud's runtime (wash-runtime) is a simple, flexible runtime environment for WebAssembly workloads.
This section is under active development—please check back soon for a more complete reference.
wash-runtime is a Rust crate that includes Wasmtime as the underlying runtime engine, as well as the wasmCloud host, which serves as a runtime environment for WebAssembly components. A plugin system allows for extension of the host with new and custom capabilities.
The runtime provides easy-to-use abstractions over the low-level Wasmtime API, as well as wasmCloud-specific APIs for managing workloads, handling NATS subscriptions, managing and utilizing host plugins, and more.
Architecture
The runtime provides three primary abstractions:
- Engine: Wasmtime configuration and component compilation
- Host: Runtime environment with plugin management
- Workload: High-level API for managing component lifecycles

WASI Interface Support
The crate includes two sets of built-in plugins (toggleable at runtime via feature flags), one working in-memory for development with wash dev, and the other backed by NATS for production deployment. Both sets of plugins contain the following interfaces:
wasi:httpwasi:keyvaluewasi:blobstorewasi:configwasi:loggingwasmcloud:messaging
Hosts can be extended with additional host plugins at build-time.
Usage
use std::sync::Arc;
use std::collections::HashMap;
use wash_runtime::{
engine::Engine,
host::{HostBuilder, HostApi},
plugin::{
wasi_config::WasiConfig,
wasi_http::HttpServer,
},
types::{WorkloadStartRequest, Workload},
};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Create a Wasmtime engine
let engine = Engine::builder().build()?;
// Configure plugins
let http_plugin = HttpServer::new("127.0.0.1:8080".parse()?);
let wasi_config_plugin = WasiConfig::default();
// Build and start the host
let host = HostBuilder::new()
.with_engine(engine)
.with_plugin(Arc::new(http_plugin))?
.with_plugin(Arc::new(wasi_config_plugin))?
.build()?;
let host = host.start().await?;
// Start a workload
let req = WorkloadStartRequest {
workload: Workload {
namespace: "test".to_string(),
name: "test-workload".to_string(),
annotations: HashMap::new(),
service: None,
components: vec![],
host_interfaces: vec![],
volumes: vec![],
},
};
host.workload_start(req).await?;
Ok(())
}cargo Features
The crate supports the following cargo features:
wasi-http(default): HTTP client and server support viawasmtime-wasi-httpwasi-config(default): Runtime configuration interfacewasi-logging(default): Logging interfacewasi-blobstore(default): Blob storage interfacewasi-keyvalue(default): Key-value storage interfaceoci: OCI registry integration for pulling components