nanocode
A headless, library-first Rust SDK for building products around an OpenAI coding-agent stack with retained sessions, typed history, tools, Code Mode, branches, and events.
At a Glance
Fully open-source under MIT OR Apache-2.0. Free to use, modify, and distribute.
Engagement
Available On
Alternatives
Updated Oct 2026
About nanocode
Nanocode (previously named Nanocodex) is an open-source SDK for embedding coding agents in applications, published by gakonst on GitHub under the Apache License 2.0. According to the project site, it runs Codex and Claude behind one durable runtime, usable from Rust or from TypeScript through WebAssembly. The latest release listed is v0.6.7.
What It Is
nanocode is a software development kit for embedded agents. Developers use its Rust SDK directly, or use it from TypeScript through a WebAssembly build. The homepage describes a single durable runtime that sits behind both Codex and Claude models.
How the Demo Works
The homepage runs an agent inside the visitor's browser. It uses the Rust SDK compiled to WebAssembly, an in-memory SQLite journal, and the documentation mounted as files in the agent's workspace. Model requests are served through Cloudflare AI Gateway. The demo offers prompts for making a session durable, using nanocode from TypeScript, and explaining Code Mode.
Where It Fits
The site links to related pieces: xframes, nanocode-machines, nanocode-ts, and deployments on Vercel and Cloudflare. It also provides docs, a playground, and a prompts page.
Community Discussions
Be the first to start a conversation about nanocode
Share your experience with nanocode, ask questions, or help others learn from your insights.
Pricing
Open Source
Fully open-source under MIT OR Apache-2.0. Free to use, modify, and distribute.
- Full Rust SDK (nanocode, nanocode-agent, nanocode-oai-api, nanocode-tools)
- JavaScript bindings for Node.js, browser, and WASM
- Python bindings via PyO3/Maturin
- Native CLI/TUI
- Optional observability, durability, and subagents crates
Capabilities
Key Features
- Owned agent lifecycle with cheap cloneable command handle
- Retained OpenAI Responses WebSocket sessions with typed history
- Ordered turn submission with FIFO prompt queue
- Typed event stream independent from turn result awaiting
- Code Mode: compositional JavaScript execution tool for the model
- MCP support (stdio and Streamable HTTP) with BM25 deferred tool search
- #[tool] attribute macro for defining typed JSON function tools
- Branching: spawn
- fork
- fork_from
- and SessionSnapshot for resumption
- Optional nanocode-durability: append-only journal with SQLite/Postgres stores
- Automatic USD cost estimation per turn from provider token usage
- Native CLI/TUI consumer built on Ratatui
- JavaScript bindings for Node.js
- browser
- and WASM
- Python bindings via PyO3/Maturin
- Optional nanocode-observability with OpenTelemetry/OTLP tracing
- Experimental browser automation (nanocode-browser) with Chromium control
- Experimental VM workspaces via libkrun (nanocode-vm)
- Experimental voice input via GPT Realtime (nanocode-voice)
- Experimental evaluation harness with VM-isolated attempts (nanocode-eval)
- Subagent task-tree with seven canonical child-agent tools (nanocode-subagents)
- Cancellation targeting one active or queued turn with subprocess group cleanup
