The Case for WASM in AI Agent Systems
The Problem with LLM-Only Agents
Most AI agent frameworks route every task through an LLM. Need to parse JSON? LLM call. Need to format a date? LLM call. Need to count words? LLM call.
This is wasteful. These are deterministic tasks with known solutions. Sending them to an LLM costs money, adds latency, and introduces non-determinism where none is needed.
Enter WASM Skills
Nexus OS introduces WASM skill modules — small, sandboxed programs that handle deterministic tasks at near-zero cost.
| Handler | Cost per call | Latency | Deterministic |
|---|---|---|---|
| Skill (pattern match) | ~$0.00 | ~5ms | Yes |
| WASM module | ~$0.00 | ~10ms | Yes |
| LLM (Claude Sonnet) | ~$0.01 | ~1000ms | No |
The broker routing engine evaluates every task against registered skills first. Only when no skill matches with sufficient confidence does it fall back to the LLM.
How It Works
- You define a skill with patterns and a handler function
- The broker matches incoming tasks against skill patterns
- If confidence exceeds the threshold (default 90%), the skill handles it
- If not, the task cascades to WASM, then to the LLM
skills:
- name: summarize
patterns: [summarize, summary, tldr]
handler: "fn:summarize_text"
cost: "$0.0001"
The Marketplace
The WASM skill marketplace lets you install community-built skills:
naos marketplace install [email protected]
naos marketplace install [email protected]
naos marketplace install [email protected]
Skills are versioned, portable, and composable. They run in sandboxed WASM environments with no access to the filesystem or network unless explicitly granted.
Real-World Impact
In our benchmarks, a typical agent workload with WASM skills enabled saw ~90% reduction in token costs compared to LLM-only execution. The broker routed 70% of tasks to skills or WASM modules, reserving the LLM for genuinely creative or ambiguous tasks.
This isn't just a cost optimization — it's an architecture decision. Deterministic tasks should run deterministically.