DOCUMENTATION / AGENT FRAMEWORK
Build the agent your product needs.
NAH gives you a model loop and explicit extension points. Choose the model, define the tools, set the run policy, and connect events and results to your application.
The shape of an agent
An agent is a model plus a system prompt, a set of tools, and a policy for how long it may run. runAgent coordinates the turn and returns both a live event stream and a final result. Your app owns authentication, tool implementations, user experience, and persistence choices.
const run = runAgent({
model, // AI SDK language model
system, // agent behavior and constraints
prompt: userRequest, // this task
tools, // capabilities available to this run
maxSteps: 24, // optional run limit
});
for await (const event of run.events) render(event);
const result = await run.result;Start with the SDK build guide, then use the focused references below to configure the parts your application needs.
Install NAH
Get the CLI running or install the runtime package in your app.
Read guideBuild an agent
Choose a model, configure tools, start a run, and handle its result.
Read guideEmbed it in a web app
Use nah-js with Next.js, React, Hono, Remix, SvelteKit, Astro, or Web APIs.
Read guideMount a server adapter
Expose registered agents, tools, and workflows through your existing HTTP server.
Read guideConfigure tools
Define typed capabilities and decide which operations need approval.
Read guideControl a run
Set limits, steer a running task, cancel it, and persist its transcript.
Read guideStream to your UI
Render text and tool activity, track completion, and recover errors.
Read guideDelegation patterns
See how parent agents hand off bounded work and review child results.
Read guideUse Orchestrator
Configure child tools and isolation, run tasks, and review their artifacts.
Read guideMake workflows
Turn known sequences into validated, reusable steps.
Read guideConversation state
Continue chats from transcript history and persist sessions safely.
Read guideCognitive memory
Configure durable facts and retrieval across conversations.
Read guideChoose the right extension point
ToolsAdd product actions and data access; the tool map is the agent’s capability boundary.Run optionsSet step and spend limits, context handling, stop rules, and approval behavior.EventsRender streamed output, track tool activity, and handle cancellation and errors.WorkflowsEncode a known sequence in validated code when the order should not be left to the model.DelegationGive independent subtasks their own context and isolated workspaces.Conversation statePersist transcript history so a session can continue across turns.Cognitive memoryAdd optional cross-session retrieval behind a configurable memory interface.Runtime and CLI
The core runtime owns the iteration loop, tool execution, typed event stream, stop conditions, and optional transcript compaction. You provide an AI SDK language model and decide how to present and persist the run. The CLI is an application built on that runtime: it adds terminal interaction, provider selection, permissions, and JSONL sessions.
Use the SDK when embedding an agent in a product or service. Use the CLI when you want an interactive coding agent in a repository.