Docs
Quickstart
Five minutes, three steps: install, construct an agent, stream a turn. This walkthrough uses the Node adapter — the browser version is the same shape with a different import.
1. Install#
npm install @nanocodana/nodejs @ai-sdk/anthropic ai2. Construct an agent#
An agent is a model plus a place to work. The Node adapter points it at a real directory and pre-wires the file tools and a sandboxed shell.
agent.ts
import { NodeAgent } from '@nanocodana/nodejs'
import { anthropic } from '@ai-sdk/anthropic'
const agent = NodeAgent({
model: anthropic('claude-sonnet-5'),
workingDirectory: process.cwd(),
// Risky tools prompt for approval; everything else runs freely.
needsApproval: ['Write', 'Edit', 'MultiEdit', 'Delete'],
})3. Stream a turn#
agent.ts
const messages = [{ role: 'user', content: 'Rename getFoo to getBar across src/.' }]
const result = await agent.stream({ messages })
for await (const chunk of result.fullStream) {
if (chunk.type === 'text-delta') process.stdout.write(chunk.text)
else if (chunk.type === 'tool-call') console.log(`\n↳ ${chunk.toolName}`, chunk.input)
else if (chunk.type === 'tool-approval-request') {
// Decide, then continue the turn — see the Tool Approval docs.
}
}Run it with npx tsx agent.ts (or compile with tsc) and watch the agent read your project, propose edits, and ask before touching anything you gated.
Where to next#
- Streaming & Results — every chunk type and how to keep conversation history.
- Tool Approval — wire the human-in-the-loop decision into your UI.
- Agent Skills — teach the agent your team's conventions with SKILL.md files.
Prefer zero code?
npm install -g @nanocodana/cli and run codana chat in any project — it's this exact agent in a terminal UI.