A standalone Sarvam voice-agent project with a Next.js 16 web client, Python FastAPI backend, Agora Conversational AI, live RTC/RTM transcripts, and Agent UIKit visualization.
The speech pipeline is fixed:
- STT: Sarvam, language
SARVAM_LANGUAGE(defaulten-IN) - LLM: Agora-managed OpenAI
gpt-4o-mini - TTS: Sarvam, speaker
SARVAM_SPEAKER(defaultanushka), 24 kHz
- Python 3.10+
- Bun
- An Agora project with Conversational AI enabled
- A Sarvam API key
Create a local server environment from server/.env.example and set real values without committing the file:
AGORA_APP_ID=your_agora_app_id
AGORA_APP_CERTIFICATE=your_agora_app_certificate
SARVAM_API_KEY=your_sarvam_api_key
SARVAM_LANGUAGE=en-IN
SARVAM_SPEAKER=anushka
AGENT_GREETING=Hi there! I'm Ada, your virtual assistant from Agora. How can I help?
PORT=8001For the web process, AGENT_BACKEND_URL must point to FastAPI. Root development scripts set it to http://localhost:8001; standalone or deployed web processes must set it explicitly.
bun install
bun run setup:backend
bun run dev- Web:
http://localhost:3000 - FastAPI:
http://localhost:8001 - API docs:
http://localhost:8001/docs
GET /api/get_configreturns Agora app, token, UID, channel, and agent UID data.POST /api/startAgentaccepts{ channelName, rtcUid, userUid, parameters? }.POST /api/stopAgentaccepts{ agentId }.
Next.js rewrites /api/* to the corresponding FastAPI routes. The backend owns all credentials, token generation, and agent lifecycle logic.
bun run doctor
bun run verify:backend
bun run verify:web:api
bun run verify:web
bun run verify:localStandalone tests do not call Agora Cloud:
cd server && pytest
cd web && bun testDeploy web/ as a Next.js application with AGENT_BACKEND_URL set to the public FastAPI origin. Deploy the root Dockerfile or server/ separately with the required Agora and Sarvam environment variables. The backend listens on PORT, defaulting to 8001.
web/: Next.js browser client, RTC/RTM lifecycle, transcript, and metrics UIserver/: FastAPI token and fixed Sarvam agent serviceARCHITECTURE.md: request and voice pipeline flowAGENTS.md: contributor workflow and invariants
Keep AGORA_APP_CERTIFICATE and SARVAM_API_KEY server-only. The sample backend has permissive CORS and no end-user authentication or rate limiting; restrict these before a public production deployment.
Released under the MIT License.