wasm-agent
ReAct agent loop for WASM and edge environments — Thought-Action-Observation with tool dispatch.
A minimal, dependency-light agent loop that runs in WebAssembly, Cloudflare Workers, Fastly Compute, and any environment where you can't use OS threads or a full Tokio runtime.
What's inside
- ReActLoop — Thought → Action → Observation cycle with configurable max iterations
- ToolRegistry — register sync or async tools as closures; dispatch by name
- AgentContext — scratchpad memory for the current reasoning chain
- StopCondition — pluggable termination: goal reached, max steps, timeout, error threshold
- Trace — structured log of every thought/action/observation for debugging
Features
- WASM-compatible — no OS threads, no
std::time, no filesystem - Tool dispatch — tools are plain functions; no macros or derive required
- Traceable — full reasoning trace returned alongside the final answer
- Resumable — serialize agent state mid-loop and resume later
Quick start
use ;
let mut tools = new;
tools.register;
let agent = new
.max_steps;
let result = agent.run.await?;
println!;
println!;
Add to your project
[]
= { = "https://github.com/Mattbusel/wasm-agent" }
Test coverage