Docs
Introduction
NanoCodana is a tiny but mighty coding agent that runs in your browser, on your phone, or at the edge. It reads, writes, edits, searches, and runs code against a filesystem — built on the Vercel AI SDK, so any model works through one familiar API.
In the browser, the whole agent — the loop, the tools, the filesystem — runs client-side in the tab. No server, no upload: a user's API key never leaves their machine.
import { BrowserAgent } from '@nanocodana/browser'
import { openai } from '@ai-sdk/openai'
const agent = BrowserAgent({
model: openai('gpt-5.1'),
initialFiles: [{ path: 'index.html', content: '<h1>hi</h1>' }],
persist: true, // IndexedDB (default). false = in-memory only.
})
await agent.stream({
messages: [{ role: 'user', content: 'Add a dark-mode toggle to index.html.' }],
})The same API runs on Node against real files — for CLIs, servers, and scripts — or embeds in your own app over a custom filesystem or sandbox.
import { NodeAgent } from '@nanocodana/nodejs'
import { anthropic } from '@ai-sdk/anthropic'
const agent = NodeAgent({
model: anthropic('claude-sonnet-5'),
workingDirectory: process.cwd(),
})
const result = await agent.stream({
messages: [{ role: 'user', content: 'Add a CHANGELOG.md summarizing recent commits.' }],
})
for await (const chunk of result.fullStream) {
if (chunk.type === 'text-delta') process.stdout.write(chunk.text)
}Out of the box it ships the file tools, a virtual shell, MCP support, tool-approval gating, automatic prompt caching, and Anthropic-style Agent Skills — and it works with any model the AI SDK supports: Anthropic, OpenAI, Google, or any OpenAI-compatible endpoint.
The packages#
Everything is published on npm under the @nanocodana scope. Two adapters wrap the core and pre-wire a filesystem plus the platform-appropriate tools — most apps use an adapter.
| Package | Use it when… |
|---|---|
| @nanocodana/nodejs | building a CLI, server, or script that works on real files. Entry point: NodeAgent(config). |
| @nanocodana/browser | running an agent fully in the browser over an in-memory / IndexedDB filesystem. Entry point: BrowserAgent(config). |
| @nanocodana/core | embedding the agent with your own filesystem or sandbox backend. Entry point: new NanoCodana(config). |
| @nanocodana/cli | you want a ready-to-use terminal coding agent, no code required. Entry point: codana chat. |
Seen it in action?#
Sharables — the build-React-Native-apps-in-your-browser product — is @nanocodana/browser in production. Every file it writes, every command it runs, happens inside the tab. The Examples section walks through it, plus Forge — an agent that builds (and tests) new NanoCodana agents.