> ## Documentation Index
> Fetch the complete documentation index at: https://assemblyai.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy your agent

One agent, bound by its `agent_id`, answers wherever you point it. Pick where.

> [card] [From a browser](https://assemblyai.com/docs/voice-agents/voice-agent-api/browser-integration.md)
>
> A web app, widget, or in-product voice. Your server mints a short-lived token so no API key reaches the page.

> [card] [Over the phone](https://assemblyai.com/docs/voice-agents/voice-agent-api/connect-to-twilio.md)
>
> An inbound number people call. Twilio hands the call straight to AssemblyAI over SIP.

| | Browser | Phone |
| - | - | - |
| **Best for** | Web apps, widgets, demos | Support lines, reception, order taking |
| **You provide** | A server endpoint that mints tokens | A Twilio account and a number you own |
| **You run** | Your web app | Nothing |
| **Auth** | Short-lived token, per session | API key, server-side at setup |
| **Audio** | The browser captures and plays it | Twilio and AssemblyAI handle it end to end |
| **Echo** | Handled by the browser, no headphones needed | Handled by the carrier |
| **Setup** | Minutes | About 10 minutes, mostly Twilio config |

Want both? Publish the agent once and point both at the same `agent_id`. The [Quickstart](https://assemblyai.com/docs/voice-agents/voice-agent-api.md) does exactly that in five commands.

## Whichever you pick

Both open the same WebSocket, `wss://agents.assemblyai.com/v1/ws`, and bind the same way. Send one `session.update` with the `agent_id` and nothing else, and the stored prompt, voice, and tools load server-side:

```json theme={null}
{
  "type": "session.update",
  "session": { "agent_id": "7ad24396-b822-4dca-871a-be9cc4781cf9" }
}
```

Wait for [`session.ready`](https://assemblyai.com/docs/voice-agents/voice-agent-api/events-reference#session-ready) before streaming audio, and finish with [`session.end`](https://assemblyai.com/docs/voice-agents/voice-agent-api/events-reference#session-end). Skipping `session.end` leaves the session in a 30-second grace window that you pay for. See [Ending the session cleanly](https://assemblyai.com/docs/voice-agents/voice-agent-api/browser-integration.md#6-ending-the-session-cleanly).

> [!NOTE]
>
> `agent_id` is **mutually exclusive** with inline session fields. Binding to a stored agent and also sending `system_prompt`, `greeting`, `tools`, `input`, or `output` is rejected. To configure per session instead, send those inline and omit `agent_id`. See [Inline configuration](https://assemblyai.com/docs/voice-agents/voice-agent-api/session-configuration.md).

## Neither of these

On another telephony provider, or embedding in something we don't have a guide for? You connect the same way with your API key in the `Authorization` header, and move the audio yourself. [Stream audio](https://assemblyai.com/docs/voice-agents/voice-agent-api/audio-format.md) has the encodings and the send, play, and barge-in handling.

> [!WARNING]
>
> A raw API key is fine for servers and trusted backends. **Never ship it in browser or mobile client code.** Use the [browser token flow](https://assemblyai.com/docs/voice-agents/voice-agent-api/browser-integration.md) for anything client-side.
