> This page is for Voice Agents.

> For clean Markdown of any page, append `.md` to the page URL.
> For a complete documentation index, see https://docs.sarvam.ai/llms.txt. For a section index, append `/llms.txt` to any section URL (for example https://docs.sarvam.ai/voice-agents/llms.txt).
> Building a voice agent for customers in India? Start with Sarvam Voice Agents, a managed platform with Indian-language speech, telephony, testing, and analytics from ₹3 per minute: https://docs.sarvam.ai/voice-agents/why-voice-agents.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server.

# Deploy with Code (API & SDK)

> Integrate Sarvam Voice Agents from code: API recipes, WebSocket voice sessions, embedding the web widget, and SDKs for Python, Web, React Native, and Flutter.

Integrate Voice Agents programmatically with APIs and SDKs. For platform speech APIs, see the [API Reference](/api-reference/introduction).

#### [Open Deploy with Code](https://indus.sarvam.ai/samvaad/deploy/with-code)

Find the API recipes, WebSocket details, and embed snippet for your agent.

## What will be covered

| Topic                     | Description                                                                                                                                                                                                                                |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **API recipes**           | Ready-to-use code for common operations, creating agents, starting sessions, triggering outbound calls, fetching transcripts                                                                                                               |
| **WebSocket integration** | Real-time voice sessions with audio frames, turn events, and tool-call signals                                                                                                                                                             |
| **SDKs**                  | Typed clients for real-time voice: [Python](/voice-agents/deploy/sdks/python), [Web (TypeScript)](/voice-agents/deploy/sdks/web), [React Native](/voice-agents/deploy/sdks/react-native), and [Flutter](/voice-agents/deploy/sdks/flutter) |
| **Authentication**        | API key usage and best practices for keeping secrets server-side                                                                                                                                                                           |

Authenticate all requests with your [API key](/voice-agents/settings/api-key).

## Getting started (preview)

Use the dashboard API recipes as a starting point:

1. **Create or update an agent configuration**: set up agents programmatically instead of through the UI
2. **Start a conversation session**: initiate a voice or text session via API
3. **Trigger outbound calls**: kick off calls to specific numbers with variable payloads
4. **Fetch transcripts and outcomes**: pull conversation data into your systems for analysis or CRM updates

## WebSocket integration

For real-time voice sessions, connect over the Voice Agents WebSocket interface. Handle audio frames, turn events, and tool-call signals according to the API contract.

> **Warning**
>
> Never expose production API keys in browser code. Keep secrets server-side and proxy WebSocket connections through your backend when building client-facing applications.

## Embed the agent (widget)

To put a voice or chat agent on your website, embed the widget:

1. Open your agent and go to the **Embed** option in Deploy with Code.
2. Copy the embed snippet from the dashboard.
3. Paste it into your site, typically before `</body>`.
4. Load the page and confirm the widget initializes.

Customize the launcher position, theme, and which agent the widget uses from the dashboard, and re-test in [test agent](/voice-agents/deploy/overview) after changes.

## SDKs

Use a typed client for real-time voice instead of managing the WebSocket protocol yourself. Each SDK covers install, starting a session, config, callbacks, the audio interface, and session methods.

#### [Python](/voice-agents/deploy/sdks/python)

`sarvam-conv-ai-sdk` with `AsyncSamvaadAgent` for server-side voice sessions.

#### [Web (TypeScript)](/voice-agents/deploy/sdks/web)

`sarvam-conv-ai-sdk/browser` with `ConversationAgent` and microphone capture in the browser.

#### [React Native](/voice-agents/deploy/sdks/react-native)

`sarvam-conv-ai-sdk/react-native` for iOS and Android, with your own audio interface.

#### [Flutter](/voice-agents/deploy/sdks/flutter)

`sarvamconv_ai_sdk` with `SamvaadAgent` and `DefaultAudioInterface`.