Sarvam AI- AgentStream Integration
13 min
exotel agentstream run an indian language voice bot on exotel using sarvam https //www sarvam ai saaras (stt) and bulbul (tts) this is a cascaded pipeline (speech → text → speech), not native speech to speech sample code integrations/sarvam https //github com/exotel/agent stream/tree/main/integrations/sarvam in the agent stream https //github com/exotel/agent stream repo if you have not set up connect yet, start with connect voice ai with agentstream docid xb3tdmzuz6jbcqdsboqd what you get agentstream websocket server ( server py ) that greets the caller and echoes turns via sarvam greeting audio pre synthesized at process start so time to first audio after start is usually under one second paced pcm frames aligned with agentstream expectations ( 100 ms) for a deeper production write up, see integrations/sarvam/sarvam agentstream integration md in the repo before you start item notes sarvam sarvam api key from the sarvam dashboard exotel account sid, api key, api token, exophone python 3 10+ virtualenv recommended public wss cloudflared or ngrok for the first test install git clone https //github com/exotel/agent stream git cd agent stream cp shared/env exotel example shared/ env exotel \# fill exotel values cd integrations/sarvam python3 m venv venv && source venv/bin/activate pip install r requirements txt cp env example env edit env sarvam api key=sk greeting text=namaste! please say something after the beep sample rate=8000 server port=8000 run the server and open a tunnel terminal a (from integrations/sarvam ) source venv/bin/activate export pythonpath="$(cd / && pwd)" python server py you should see greeting cache ready… and a listener on 0 0 0 0 8000 websocket path /ws terminal b cloudflared tunnel url http //127 0 0 1 8000 place a connect call from the repo root set a && source shared/ env exotel && set +a python shared/place connect call py \\ \ to +91xxxxxxxxxx \\ \ stream url "wss\ //your cloudflare host/ws?sample rate=8000" streamurl wss\ //host/ws?sample rate=8000 port 8000 answer the phone the greeting should play quickly speak a short sentence; watch user / agent style logs and hear the reply verify boot greeting cache ready call first audio ms typically under 1000 for the cached greeting after you speak stt text and tts playback; clean stop when the call ends note generative replies still wait on sarvam http tts ( 1–2 seconds) only the greeting is pre warmed go live checklist server on a stable host with valid tls for wss\ // sarvam api key only in secrets streamurl includes /ws?sample rate=8000 greeting text and language settings match your market timeouts and concurrency limits sized for sarvam api quotas consider caching common prompts if you need lower reply latency troubleshoot symptom what to check no greeting boot cache failed — check api key and greeting text ; look for cache errors hangup in a few seconds wrong streamurl (must include /ws ); tunnel down slow replies after you speak expected for http stt/tts; shorten prompts or cache tts wrong language sarvam language / speaker settings in pipeline config related repo readme integrations/sarvam/readme md full guide integrations/sarvam/sarvam agentstream integration md connect voice ai api https //docs exotel com/exotel agentstream/connect voice ai api openai realtime agentstream integration docid\ t3ukaryxrfdiutrpue79n elevenlabs's elevenagents agentstream integration docid\ xwx948gytzp66hccgkklq
