Skip to content

Repository files navigation

Agora Sarvam Voice Agent

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 (default en-IN)
  • LLM: Agora-managed OpenAI gpt-4o-mini
  • TTS: Sarvam, speaker SARVAM_SPEAKER (default anushka), 24 kHz

Prerequisites

  • Python 3.10+
  • Bun
  • An Agora project with Conversational AI enabled
  • A Sarvam API key

Configure

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=8001

For 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.

Run

bun install
bun run setup:backend
bun run dev
  • Web: http://localhost:3000
  • FastAPI: http://localhost:8001
  • API docs: http://localhost:8001/docs

API Contract

  • GET /api/get_config returns Agora app, token, UID, channel, and agent UID data.
  • POST /api/startAgent accepts { channelName, rtcUid, userUid, parameters? }.
  • POST /api/stopAgent accepts { agentId }.

Next.js rewrites /api/* to the corresponding FastAPI routes. The backend owns all credentials, token generation, and agent lifecycle logic.

Verify

bun run doctor
bun run verify:backend
bun run verify:web:api
bun run verify:web
bun run verify:local

Standalone tests do not call Agora Cloud:

cd server && pytest
cd web && bun test

Deploy

Deploy 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.

Project Map

  • web/: Next.js browser client, RTC/RTM lifecycle, transcript, and metrics UI
  • server/: FastAPI token and fixed Sarvam agent service
  • ARCHITECTURE.md: request and voice pipeline flow
  • AGENTS.md: contributor workflow and invariants

Security

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.

License

Released under the MIT License.

sarvam-agent

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages