agent_id, answers wherever you point it. Pick where.
From a browser
A web app, widget, or in-product voice. Your server mints a short-lived token so no API key reaches the page.
Over the phone
An inbound number people call. Twilio hands the call straight to AssemblyAI over SIP.
Want both? Publish the agent once and point both at the same
agent_id. The Quickstart 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:
session.ready before streaming audio, and finish with session.end. Skipping session.end leaves the session in a 30-second grace window that you pay for. See Ending the session cleanly.
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.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 theAuthorization header, and move the audio yourself. Stream audio has the encodings and the send, play, and barge-in handling.