Quickstart
From zero to a running, streaming agent app in one command.
Scaffold
npm create agentoria@latest my-appPick a template — next (a Next.js App Router app with a streaming route + <ChatPanel/>) or node (an http server + a zero-dependency web client) — then:
cd my-app
npm install
cp .env.example .env # add your ANTHROPIC_API_KEY
npm run dev # → http://localhost:3000That's a full-stack streaming agent. Everything below is what the scaffold wires up.
Add to an existing project
Install just the layers you need:
npm i @agentoria/runtime @agentoria/react @agentoria/ui zodServer — a Fetch handler
createAgentHandler returns a standard (Request) => Promise<Response>, so it is your route handler on any Fetch-native runtime (Next.js, Cloudflare Workers, Deno, Bun, Hono):
import { z } from 'zod';
import { createAgentHandler, createAnthropicProvider, defineTool } from '@agentoria/runtime';
const currentTime = defineTool({
name: 'current_time',
description: 'Get the current time (ISO 8601).',
parameters: z.object({}),
handler: () => new Date().toISOString(),
});
export const POST = createAgentHandler({
provider: createAnthropicProvider({ apiKey: process.env.ANTHROPIC_API_KEY!, model: 'claude-sonnet-4-6' }),
tools: [currentTime],
});Client — one hook, one component
'use client';
import { ChatPanel } from '@agentoria/ui';
export default function Page() {
return <ChatPanel endpoint="/api/agent" />;
}The same AgentEvent type flows from the loop to the browser, so there's no glue between them. Want full control instead of the component? Use the useAgentChat hook.
Not on a Fetch runtime?
On a raw Node http server or Express, wrap the handler with @agentoria/node's toNodeHandler.