Examples
Use these examples as copy-ready starting points.
Recommended order
- Staff agent (basic)
- Department agent (supervisor + delegation)
- Memory and persistence
- Workflow orchestration
- Voice assistant (NewnaVoiceKit)
- Frontend integration (Next.js)
Core examples
1. Staff agent (basic)
Start here to learn createStaffAgent with a simple task loop.
2. Department agent
Learn how a manager agent delegates tasks to specialist staff agents.
3. Memory and persistence
Learn how to keep run history and agent memory with storage adapters.
4. Workflow builder
Learn step-by-step orchestration with transitions and conditional routing.
5. Voice assistant (NewnaVoiceKit)
The scaffolded sample at lib/agents/voice-assistant.ts uses createVoiceAgent with Deepgram STT and Cartesia TTS. Walk through setup, env vars, and the debugger Voice panel here:
See: Voice agents
6. Next.js frontend starter
Includes:
useNewnadoonAgent()- full-page chat
- panel chat
- widget chat
- App Router API route using
createNewnadoonApiRoute()
See: Bring agents to frontend apps
Run examples locally
From the framework root:
npm installRun any example file with tsx:
npx tsx examples-new/workflow-builder-examples/multistep-workflow-example.tsFor frontend starter:
cd examples-new/next-app-router-starter
npm install
npm run dev