01
Quick start
Pick an agent on the home page or visit /chat. Each agent has its own system prompt. Type a question, get a streamed reply. No login required.
# local dev pnpm install cp .env.example .env.local pnpm dev
Everything you need to use, extend, and self-host the workshop.
Pick an agent on the home page or visit /chat. Each agent has its own system prompt. Type a question, get a streamed reply. No login required.
# local dev pnpm install cp .env.example .env.local pnpm dev
Single Next.js 14 app. One streaming endpoint serves all 8 agents. Each agent is a system prompt + metadata in src/lib/agents.ts.
src/ ├── app/ # routes ├── components/ # UI ├── lib/ │ ├── agents.ts # agent registry │ ├── auth.ts # BetterAuth (optional) │ └── db.ts # Postgres pool
POST /api/agent with { agentId, messages }. Response is text/plain ReadableStream. Tokens land on the client as they arrive from OpenAI.
const res = await fetch("/api/agent", {
method: "POST",
body: JSON.stringify({ agentId, messages })
});
const reader = res.body.getReader();
// decode chunks → renderAppend to AGENTS in src/lib/agents.ts. Cards, routes, and chat pick it up automatically — no other file to touch.
{
id: "my-agent",
number: "09",
name: "The Apprentice",
role: "Helper",
systemPrompt: "You are…",
starters: [...],
rules: [...]
}