dev-tools 6 min read

Wasmrun - A Rust-Based WebAssembly Runtime

Wasmrun is a Rust-based WebAssembly runtime that compiles and serves WASM projects with live reload, module inspection, and a REST sandbox API for AI agents — no Docker required.

By
Share: X in
Wasmrun WebAssembly runtime banner

TL;DR

TL;DR: Wasmrun is a Rust-based WebAssembly runtime that compiles and serves WASM projects with live reload, module inspection, and a REST sandbox API for AI agents — no Docker required.

Source and Accuracy Notes

⚠️ This section is MANDATORY. All links must be verified from actual source, not guessed.

What Is Wasmrun?

Wasmrun is a WebAssembly runtime built in Rust that runs .wasm files directly from the terminal. It positions itself as a lightweight alternative to Docker-based WASM execution, offering four distinct operating modes: a dev server with live reload, a native executor, an AI agent sandbox with a REST API, and a browser-based virtual machine.

The project was shared on Hacker News as “Chakra” by anistark, but the canonical name in the repository is Wasmrun — the chakra CLI command is an alias. The README describes it as “a powerful WebAssembly runtime that simplifies development, compilation, and deployment of WebAssembly applications.”

Key capabilities:

  • Multi-language support — Rust, Go, Python, C/C++, and AssemblyScript via wasm32-unknown-unknown
  • Four execution modes — Server, Exec, Agent, and OS (browser-based VM)
  • Plugin architecture — Built-in and external plugins for extending runtime capabilities
  • Zero-config web server — Built-in HTTP server for serving WASM and web applications
  • Agent sandbox — REST API that gives AI agents isolated environments to run code, without Docker

Setup Workflow

Prerequisites

  • Rust toolchain (rustup, cargo) — required for installation via cargo install
  • wasm32-unknown-unknown target for compiling non-Rust languages

Step 1: Install Wasmrun

Install via cargo:

cargo install wasmrun

On Arch Linux, use the AUR package:

yay -S wasmrun-bin

Other installation methods (DEB, RPM, source) are documented in the installation guide.

Step 2: Install the Target Toolchain

For Rust:

rustup target add wasm32-unknown-unknown

For other languages, install the respective SDKs that target wasm32-unknown-unknown (TinyGo, Emscripten for C/C++, py2wasm for Python, AssemblyScript).

Step 3: Compile and Run a WASM File

Compile a Rust program to WASM:

cargo build --target wasm32-unknown-unknown --release

Run it with the exec mode (no browser, no server):

wasmrun exec ./target/wasm32-unknown-unknown/release/myapp.wasm arg1 arg2

Step 4: Run a WASM Dev Server with Live Reload

For a full development workflow with in-browser module inspection and live reload:

wasmrun ./my-wasm-project

This launches a local server, streams console logs to the browser, and watches for file changes.

Step 5: Use the Agent Sandbox API

The Agent mode exposes a REST API for AI agents to execute WASM in isolated environments:

wasmrun agent

This starts a REST sandbox without Docker or a daemon — useful for integrating WASM execution into AI agent pipelines.

Deeper Analysis

Four Modes in Detail

The README documents four distinct modes:

| Mode | Command | Use case | |------|---------|----------| | Server | wasmrun ./my-project | Dev server with live reload, browser-based module inspection | | Exec | wasmrun exec ./program.wasm | Native WASM execution via built-in interpreter with WASI | | Agent | wasmrun agent | REST sandbox API for AI agents, no Docker required | | OS | wasmrun os ./my-project | Browser-based VM with virtual filesystem and multi-language runtimes |

Comparison with Docker-based WASM

The project’s central claim is that WASM execution outside Docker is simpler and lighter. For AI agent use cases, the wasmrun agent REST API provides an interesting alternative to spinning up Docker containers — the process isolation comes from the WASM runtime itself rather than OS-level containerization.

Plugin System

Wasmrun ships with built-in plugins for Rust (wasmrust) and Go (wasmgo), installable via:

wasmrun plugin install wasmrust
wasmrun plugin install wasmgo

Practical Evaluation Checklist

  • Install via cargo install wasmrun and verify wasmrun --help output
  • Compile a simple Rust fn add(a: i32, b: i32) -> i32 to WASM and run via wasmrun exec
  • Test live reload by running wasmrun ./ on a project directory and verifying browser auto-refresh
  • Verify the Agent REST API starts on the expected port (check docs for default port)
  • Test module inspection with wasmrun inspect ./myfile.wasm

Security Notes

  • The Agent sandbox mode runs WASM with full WASI capabilities — review WASI permissions before exposing the REST API externally
  • The wasmrun agent mode is designed for trusted AI agent code; do not expose it to untrusted input without additional authentication layers
  • Plugin installation fetches external code — verify plugin sources before installing

FAQ

Q: Does Wasmrun require Docker? A: No. The Exec and Agent modes run WASM natively without Docker. The OS mode runs a browser-based VM which does use a browser runtime, but not Docker.

Q: What is the difference between wasmrun exec and wasmrun (server mode)? A: wasmrun exec runs a WASM file natively through the built-in interpreter with WASI support — no browser, no server. Server mode (wasmrun ./project) launches a local dev server with live reload, console log streaming, and browser-based module inspection.

Q: Can Wasmrun run arbitrary binaries? A: No — it runs WebAssembly modules targeting the wasm32-unknown-unknown ABI. It is not a general-purpose binary executor.

Q: Is this the same project as “Chakra” on Hacker News? A: The HN post referenced “Chakra,” but the repository uses the name Wasmrun. The chakra CLI command is an alias for wasmrun within the project.

Conclusion

Wasmrun is a Rust-based WASM runtime that makes it straightforward to compile, inspect, and run WebAssembly modules from the terminal. Its four-mode design (Server, Exec, Agent, OS) covers both local development and AI agent integration use cases. For developers working with multi-language WASM projects or building AI agents that need isolated code execution, the wasmrun agent REST sandbox is the most distinctive feature — no Docker daemon required.

If you want a lightweight alternative to Docker for running WASM workloads in agent pipelines, or need fast iteration with live reload on a WASM dev project, Wasmrun is worth evaluating.

Source and Accuracy Notes