# tokenworm > The systems-language agent SDK. MIT-licensed, written in Zig 0.16. Ships as a 960KB ReleaseSmall native binary with zero runtime dependencies. The same agent core is exposed as a CLI (`tokenworm`), a C ABI library (`libtokenworm.so` / `.dylib`), and idiomatic SDKs for Python, TypeScript, and Go. Per the README: 8ms cold start, 2.4MB idle memory, .tworm binary sessions that are 5x smaller and 20x faster to parse than JSONL, OS-native sandboxing on Linux (bubblewrap) and macOS (sandbox-exec). ## What tokenworm is tokenworm is an AI coding agent SDK. The CLI is the most visible surface; the C ABI defined in `src/lib/ffi.zig` is the architectural centre. Every language SDK is a thin binding over the same Zig-compiled shared library. The agent loop, the provider implementations, the tool implementations, and the sandbox backends all live in the native binary. The core abstractions: - **Agent runner** (`src/lib/agent_runner.zig`) — orchestrates the canonical agent while-loop: provider call, tool dispatch, conversation update, stats accounting. - **Providers** (`src/providers/`) — vtable-based polymorphism over five LLM providers: OpenCode Zen (default), Anthropic Claude, OpenAI, Ollama (local), MiniMax. Switchable at runtime via `--provider` on the CLI or `agent.switch_provider()` in the SDK. - **Tools** (`src/tools/`) — six built-in workspace-scoped tools: `read`, `write`, `edit`, `bash`, `grep`, `glob`. The agent cannot access files outside the workspace directory. - **Sandbox** (`src/sandbox/`) — `bwrap` for Linux, `darwin` (sandbox-exec / Seatbelt) for macOS, plus `allowlist`, `restricted`, and `noop` fallbacks. The `bash` tool runs through this layer. - **Sessions** — `.tworm` is the portable binary session format. Stores conversation history, provider/model metadata, timestamps, token counts, workspace file snapshots. O(1) offset table for random message access. Exports from CLI; resumes in any SDK. ## Published numbers (from the README) - Binary size: 960KB (ReleaseSmall) - Cold start: 8ms - Idle memory: 2.4MB - Runtime dependencies: zero - Implementation language: Zig 0.16 - Built-in tools: 6 - LLM providers: 5 - Lifecycle hooks: 18 - Session save (100 msgs): 0.4ms - Session load (100 msgs): 0.6ms - Session size (100 msgs): 24KB (.tworm) - Tool dispatch overhead: 0.01ms - Token overhead per task: 1.0x (minimal prompt) Benchmarks were run on Linux x86_64, Intel i7-13700K, 32GB RAM. The README ships a comparison harness for verification. ## Install - Homebrew (macOS / Linux): `brew install tokenworm` - npm: `npm install -g tokenworm` - pip: `pip install tokenworm` - Go SDK: `go get github.com/tokenworm/tokenworm-go` - From source (Zig 0.16): `zig build -Doptimize=ReleaseSmall` ## Pages - / - /features/ - /how-it-works/ - /quickstart/ - /providers/ - /use-cases/ - /use-cases/embedded-agent-in-c-app/ - /use-cases/ci-coding-agent/ - /use-cases/multi-language-sdk/ - /glossary/ - /faq/ - /about/ - /blog/ - /blog/why-a-960kb-binary-changes-the-ai-agent-deployment-story/ - /blog/c-abi-as-the-universal-ai-sdk-boundary/ - /blog/when-systems-languages-start-winning-the-agent-layer/ - /compare/ - /compare/claude-agent-sdk/ - /compare/openai-agents-sdk/ - /contact/ - /404/ ## Page summaries - **/** — Marketing home. Hero (systems-language agent SDK; 960KB / 8ms / 2.4MB / Zig 0.16), six surfaces (CLI, C ABI, Python, TypeScript, Go, .tworm sessions), install + quickstart terminals, six tools panel, five providers table, layered architecture diagram, compare teaser, FAQ, GitHub CTA. - **/features/** — The full feature set in six groups: native binary & performance (960KB, 8ms cold start, zero deps — README-reported), six built-in workspace-scoped tools, five runtime-switchable LLM providers, the C ABI plus Python/TypeScript/Go SDKs, hooks/skills/MCP (18 lifecycle hooks, SKILL.md, MCP over stdio + SSE), and sandboxing + .tworm sessions. - **/how-it-works/** — The C ABI architecture. One Zig agent core; every surface (CLI + Python/TS/Go SDKs) is a thin binding over src/lib/ffi.zig. Walks the flow: surface → C ABI → AgentRunner loop → provider (vtable, runtime-selected) → workspace-scoped tools → OS-native sandbox → .tworm session. Includes a layered ASCII architecture diagram and a HowTo step list. - **/quickstart/** — Install (brew / npm / pip / zig build from source), set a provider key (OpenCode Zen default, or Anthropic/OpenAI/MiniMax, or local Ollama with no key), run a one-shot or REPL task, switch providers at runtime, export a portable .tworm session. Includes an illustrative Python SDK snippet. - **/providers/** — The five LLM providers tokenworm speaks to — OpenCode Zen (default), Anthropic, OpenAI, Ollama (local), MiniMax — each with a neutral one-liner and env var, plus how runtime switching works via --provider and switch_provider(). - **/use-cases/** — Index of where tokenworm fits, linking three walkthroughs. - **/use-cases/embedded-agent-in-c-app/** — Embedding the agent in a native app by linking libtokenworm through the C ABI — no runtime to bundle, no subprocess to manage. - **/use-cases/ci-coding-agent/** — Running a coding-agent step in CI without a heavy runtime install; leans on the README-reported 8ms cold start and 960KB binary, with the default OS-level sandbox. - **/use-cases/multi-language-sdk/** — Shipping one agent core to Python, TypeScript, and Go teams: thin idiomatic bindings over the same Zig library, with sessions portable across SDKs via .tworm. - **/glossary/** — Plain-language definitions: native binary, systems language, C ABI, FFI, agent loop, tool use, LLM provider, MCP, SKILL.md, lifecycle hook, sandboxing, .tworm session, cold start. - **/faq/** — Grounded answers: why Zig, binary size and dependencies, the five providers, the six tools, sandbox safety, MCP and skills, session portability, comparison framing, and MIT licensing. - **/contact/** — Contact form (routed to the per-zone Cloudflare Worker) plus contact@neullabs.com; topics span SDK integration, C ABI embedding, CLI usage, binary-size/zero-dependency questions, the Zig core, bugs, and commercial support. - **/about/** — Design rationale. Why a systems language, what the C ABI buys, the three architectural commitments (C ABI as contract, vtable polymorphism, OS-native sandboxing), what is in scope (skills, hooks, MCP, compaction, trace export, doctor) and what is not (hosted runtime, orchestrator, fine-tuning toolkit). - **/blog/** — Index of long-form posts. - **/blog/why-a-960kb-binary-changes-the-ai-agent-deployment-story/** — Argues that binary size, cold start, and idle memory ratios unlock deployment shapes that 200MB Node/Python runtimes cannot (CI fanout, pre-commit hooks, LSPs, fleet workers, embeddable shipping). Grounded in the README's vs-table numbers. - **/blog/c-abi-as-the-universal-ai-sdk-boundary/** — Walks through why the C ABI (`src/lib/ffi.zig`) is the load-bearing decision: a fix in the core propagates to every SDK, the portable .tworm session format falls out for free, and new language bindings are mostly bookkeeping rather than re-implementation. - **/blog/when-systems-languages-start-winning-the-agent-layer/** — Frames the first-wave (Python/Node) vs second-wave (systems-language) shift. The first wave was sold to agent builders; the second wave is sold to agent deployers. Zig 0.16 picked for explicit allocators, comptime metaprogramming, and real C interop. - **/compare/** — Index of README-grounded comparisons. - **/compare/claude-agent-sdk/** — Per-row comparison from the README's "Why Tokenworm?", "Performance", and "Comparison with Other Agent SDKs" tables. Covers runtime dependency, binary size, cold start, idle memory, sandbox, language SDKs, multi-provider, session format, deployment model, hooks, embeddability, session perf, license. Rows the README marks N/A are preserved verbatim. - **/compare/openai-agents-sdk/** — Same per-row format applied to the OpenAI Agents SDK columns from the same README tables. Includes the tool-dispatch-overhead and token-overhead rows where the OpenAI columns are populated. - **/404/** — Custom not-found page styled as an unknown-tool dispatch error. ## Project resources - Source: https://github.com/neul-labs/tokenworm - Documentation: https://docs.neullabs.com/tokenworm/ (neullabs uses a path-based docs subdomain) - License: MIT - Implementation language: Zig 0.16 - Parent org: neul-labs / neullabs