Skip to Content

Examples

Use these examples as copy-ready starting points.

  1. Staff agent (basic)
  2. Department agent (supervisor + delegation)
  3. Memory and persistence
  4. Workflow orchestration
  5. Voice assistant (NewnaVoiceKit)
  6. 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 install

Run any example file with tsx:

npx tsx examples-new/workflow-builder-examples/multistep-workflow-example.ts

For frontend starter:

cd examples-new/next-app-router-starter npm install npm run dev