A standalone Agora Conversational AI voice agent with a Next.js client and Python FastAPI backend. Its fixed speech pipeline is:
- Speech recognition: Sarvam STT (
SARVAM_LANGUAGE, defaulten-IN) - Reasoning: Agora-managed OpenAI
gpt-4o-mini - Voice synthesis: Murf TTS (
MURF_VOICE_ID, defaultMatthew),FALCON,en-US, 24 kHz
The web app includes live transcripts, agent state, pipeline metrics, microphone controls, and an Agent UIKit visualizer.
- Python 3.10+
- Bun
- An Agora project with Conversational AI enabled
- Sarvam and Murf API keys
-
Install dependencies:
bun run setup
-
Configure
server/.env.localfromserver/.env.examplewith your own values. Keep this file local and never commit it. -
Run both services:
bun run dev
-
Open http://localhost:3000.
Services:
- Web:
http://localhost:3000 - FastAPI:
http://localhost:8001 - API docs:
http://localhost:8001/docs
| Variable | Required | Default | Purpose |
|---|---|---|---|
AGORA_APP_ID |
Yes | - | Agora project App ID |
AGORA_APP_CERTIFICATE |
Yes | - | Server-only Agora App Certificate |
SARVAM_API_KEY |
Yes | - | Server-only Sarvam STT key |
SARVAM_LANGUAGE |
No | en-IN |
Sarvam recognition language |
MURF_API_KEY |
Yes | - | Server-only Murf TTS key |
MURF_VOICE_ID |
No | Matthew |
Murf voice ID |
AGENT_GREETING |
No | Built-in greeting | Opening utterance |
PORT |
No | 8001 |
FastAPI port |
AGENT_BACKEND_URL |
Web deploy | - | FastAPI origin used by Next rewrites |
The browser never receives the Agora certificate, Sarvam key, or Murf key.
GET /api/get_configreturns the Agora channel, RTC/RTM token, and UIDs.POST /api/startAgentaccepts{ channelName, rtcUid, userUid, parameters? }.POST /api/stopAgentaccepts{ agentId }.
Next.js rewrites /api/* to FastAPI. The start request has no runtime speech-provider option because the project always runs the Murf pipeline above.
bun run dev
bun run doctor
bun run doctor:local
bun run verify:backend
bun run verify:web
bun run verify:localStandalone tests do not call Agora cloud:
cd server && pytest tests -v
cd web && bun testDeploy web/ to a Next.js host and server/ to a Python host. Set AGENT_BACKEND_URL=https://your-fastapi-service.example.com for the web deployment and set all server credentials only on the Python host. The backend listens on PORT=8001 by default.
- The browser requests a channel and combined RTC/RTM token from
/api/get_config. - It logs into RTM, joins RTC, and calls
/api/startAgent. - FastAPI starts the fixed Sarvam STT, managed OpenAI, and Murf TTS agent.
- Audio travels over RTC; transcripts, state, and metrics arrive over RTM.
/api/stopAgentstops the session and the browser releases RTC/RTM resources.
server/src/agent.py: fixed voice pipeline and session lifecycleserver/src/server.py: FastAPI routes and token generationweb/src/lib/pipeline.ts: immutable pipeline description used by the UIweb/src/services/api.ts: browser API clientARCHITECTURE.md: ownership and request flowserver/README.md: backend-only usage
- Agent startup reports
SARVAM_API_KEY is required: configure the Sarvam key on the backend. - Agent startup reports
MURF_API_KEY is required: configure the Murf key on the backend. - Web requests return 404: set
AGENT_BACKEND_URLto the FastAPI origin. - Agora auth fails: verify
AGORA_APP_ID,AGORA_APP_CERTIFICATE, and Conversational AI enablement.
Released under the MIT License.