Machine Learning One

Building an AI Agent Runtime with WebAssembly

A 14-part technical series on designing and implementing a sandboxed AI agent runtime from scratch.

You have an LLM that can reason, plan, and generate code. You want it to do things. The obvious approach — exec() the output — is a terrible idea. This series builds the right answer from scratch.

Starting from the threat model, you'll design and implement a sandboxed runtime where an LLM reasons about a task, generates WebAssembly programs to execute it, observes the results, and iterates. By the end, you'll have a WASM engine, a capability plugin system, a preprocessor, an LLM-driven ReAct loop, an HTTP server with SSE streaming, and a React frontend — defended by seven concentric layers of security.

What you'll build

A complete agentic runtime: WASM sandbox, wire protocol, capability traits, a custom preprocessor, ReAct orchestration loop, HTTP + SSE server, and a frontend. Each chapter adds a real, working layer.


Chapter Guide

I. Foundations

The problem space and why WebAssembly is the answer.

III. Developer Experience

Making WAT writable with a custom preprocessor.

IV. Agent Architecture

Expanding the plugin system and building the ReAct orchestration loop.

V. Integration

CLI tooling, HTTP server with streaming, and a browser frontend.

VI. Production

Defense in depth, error recovery, and where the project goes next.

On this page