Real-time voice conversation with AI agents — single Next.js project with API Routes.
# 1. Install dependencies
npm install
# 2. Configure credentials
cp .env.example .env.local
# Edit .env.local with your APP_ID, APP_CERTIFICATE, and vendor keys
# 3. Start dev server
npm run devOpen http://localhost:3000 in your browser.
Single Next.js application:
app/— Pages + API Routes (no separate backend)src/lib/agent.ts— Server-side Agent class usingagent-server-sdksrc/components/— React UI componentssrc/hooks/— Agora RTC/RTM connection hooksrc/services/api.ts— Frontend API client (calls/api/*)
| Method | Path | Description |
|---|---|---|
| GET | /api/get_config |
Generate connection config (appId, token, channel, UIDs) |
| POST | /api/v2/startAgent |
Start an AI agent in a channel |
| POST | /api/v2/stopAgent |
Stop a running agent |
See .env.example for all required configuration.
- Next.js 16 (App Router + API Routes)
- agent-server-sdk (Agora Conversational AI)
- agora-rtc-react / agora-rtm (Client-side RTC/RTM)
- agora-agent-client-toolkit (Voice AI events & transcripts)
- Tailwind CSS
- Zustand (state management)