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

# Voice Agent API

> Real-time voice agents that talk and listen. Configure an agent once, then deploy it to a browser, your own app, or the phone.

Talk to a voice agent in your browser in four commands, then put it on a phone number.

> [card] [Python starter](https://github.com/AssemblyAI/voice-agent-starter-python)
>
> Python 3.9+, standard library only.

> [card] [JavaScript starter](https://github.com/AssemblyAI/voice-agent-starter-js)
>
> Node 18+, no dependencies.

## Step 1: Clone

```bash Python theme={null}
git clone https://github.com/AssemblyAI/voice-agent-starter-python
cd voice-agent-starter-python
cp .env.example .env
```

```bash JavaScript theme={null}
git clone https://github.com/AssemblyAI/voice-agent-starter-js
cd voice-agent-starter-js
cp .env.example .env
```

## Step 2: Add your key

Paste your [API key](https://www.assemblyai.com/dashboard/api-keys) into `.env`:

```bash .env theme={null}
ASSEMBLYAI_API_KEY=<your-key>
```

## Step 3: Publish the starter agent

```bash Python theme={null}
python publish.py
```

```bash JavaScript theme={null}
npm run publish
```

Publishes the starter agent to your account and saves its ID for the next step.

## Step 4: Talk to it

```bash Python theme={null}
python deployment/browser/server.py
```

```bash JavaScript theme={null}
npm start
```

Open `http://localhost:3000` in Chrome or Edge and start talking.

## Put it on a phone number

Twilio passes calls to AssemblyAI over SIP, so there's no media server or webhook to run. Buy a Twilio number, then add your credentials and a trunk domain you invent:

```bash .env theme={null}
TWILIO_ACCOUNT_SID=AC...                          # console.twilio.com, top of the page
TWILIO_AUTH_TOKEN=your_token_here                 # same place, hidden until you click it
TWILIO_PHONE_NUMBER=+1...                         # a number already in your account, E.164
TWILIO_TRUNK_DOMAIN=acme-agent.pstn.twilio.com    # a name you invent, unique across Twilio
```

```bash Python theme={null}
python deployment/telephony/connect.py
```

```bash JavaScript theme={null}
npm run phone
```

That creates the SIP trunk on your domain, routes it to AssemblyAI, attaches your number to it, and binds your agent. Every step checks for existing state first, so it's safe to re-run.

Call the number.

## Next steps

> [accordion] Get the recording and transcript of a call
>
> Every call is stored as a **session**. List them, newest first:
>
> ```bash theme={null}
> curl "https://agents.assemblyai.com/v1/sessions?limit=5" \
>   -H "Authorization: $ASSEMBLYAI_API_KEY"
> ```
>
> ```json theme={null}
> {
>   "sessions": [
>     {
>       "id": "sess_9a648a2ab75747a9a597ba046ced3e13",
>       "agent_id": "7ad24396-b822-4dca-871a-be9cc4781cf9",
>       "status": "completed",
>       "duration_seconds": 42.6,
>       "created_at": "2026-07-14T18:04:27.607110Z",
>       "ended_at": "2026-07-14T18:05:10.204981Z"
>     }
>   ],
>   "has_more": false
> }
> ```
>
> Fetch one by `id` to get its `artifacts`: pre-signed download URLs for the **audio** recording (OGG/Opus), the **timeline** (the conversation as JSON, each turn pairing `user_transcript` with `agent_text`), and recording **metadata**:
>
> ```bash theme={null}
> curl "https://agents.assemblyai.com/v1/sessions/$SESSION_ID" \
>   -H "Authorization: $ASSEMBLYAI_API_KEY"
> ```
>
> ```json theme={null}
> {
>   "id": "sess_9a648a2ab75747a9a597ba046ced3e13",
>   "status": "completed",
>   "artifacts": [
>     { "type": "audio", "url": "https://s3.amazonaws.com/...", "content_type": "audio/ogg" },
>     { "type": "timeline", "url": "https://s3.amazonaws.com/...", "content_type": "application/json" },
>     { "type": "metadata", "url": "https://s3.amazonaws.com/...", "content_type": "application/json" }
>   ]
> }
> ```
>
> Download each artifact straight from its `url` with no `Authorization` header. The URLs expire after a short TTL, so store the session `id` and re-fetch for fresh links. See [Recordings & transcripts](https://assemblyai.com/docs/voice-agents/voice-agent-api/session-history.md) for pagination, the full timeline schema, and parsing code.

> [accordion] Write your own agent
>
> Every file in `agents/` is the request body for [`POST /v1/agents`](https://assemblyai.com/docs/voice-agents/voice-agent-api/api-spec/create-agent), sent unchanged. The starter agent is four fields:
>
> ```json agents/minimal.jsonc theme={null}
> {
>   "name": "Minimal agent",
>   "system_prompt": "You are a friendly assistant on a voice call. Keep every reply to one or two short sentences. Answer what was asked, lead with the answer, and skip the preamble. If you don't know something, say so. No exclamation marks.",
>   "voice": { "voice_id": "anna" },
>   "greeting": "Hey, what can I do for you?"
> }
> ```
>
> Copy the closest file to start your own (`cp agents/http-tools.jsonc agents/my-agent.jsonc`). Every field is commented. Publish again and both the browser tab and the phone number pick up the change on the next call.

> [accordion] Publish one of the other agents
>
> Nine agents ship with each starter. Set `AGENT=` to pick one:
>
> | `AGENT=` | Demonstrates | Requires |
> | - | - | - |
> | `minimal` | The three required fields, and the defaults applied to the rest | |
> | `keyterms` | Biasing transcription toward names and jargon | |
> | `turn-taking` | Silence thresholds and interruption handling | |
> | `byo-llm` | Claude through the AssemblyAI gateway, or your own endpoint | |
> | `http-tools` | Tools that AssemblyAI calls on the agent's behalf | |
> | `exa-search` | Web search during a call | `EXA_API_KEY` |
> | `airtable-crm` | Reading a caller record and writing one back | `AIRTABLE_*` |
> | `cal-booking` | Checking availability, then booking a slot | `CAL_*` |
> | `dtmf` | PCI compliance: card entry on the keypad, never in the transcript, the logs, or the model | `DTMF_WEBHOOK_URL` |
>
> ```bash Python theme={null}
> AGENT=cal-booking python publish.py
> python deployment/browser/server.py
> ```
>
> ```bash JavaScript theme={null}
> AGENT=cal-booking npm run publish
> npm start
> ```

> [accordion] Give an agent your API keys
>
> Values written as `${VAR}` in an agent file are substituted at publish time from `.env`, or from `agents/<name>.env` for credentials only one agent uses. Both are gitignored, so the JSON is safe to commit.

> [accordion] Put the browser app online
>
> Deploy the [Python](https://render.com/deploy?repo=https://github.com/AssemblyAI/voice-agent-starter-python) or [JavaScript](https://render.com/deploy?repo=https://github.com/AssemblyAI/voice-agent-starter-js) starter to Render. It prompts for `ASSEMBLYAI_API_KEY` and nothing else.
>
> Anyone with the URL can start sessions billed to that key.

> [card] [1. Create](https://assemblyai.com/docs/voice-agents/voice-agent-api/create-agent.md)
>
> Create a reusable agent with one REST call, then update, list, and delete it.

> [card] [2. Configure](https://assemblyai.com/docs/voice-agents/voice-agent-api/prompting-guide.md)
>
> Shape how it sounds and behaves: prompt, voice, greeting, audio, turn detection, keyterms, tools.

> [card] [3. Deploy](https://assemblyai.com/docs/voice-agents/voice-agent-api/deploy.md)
>
> Connect by `agent_id` over the API, from a browser, or to a phone number with Twilio.

Or jump straight to a topic:

* [Add tools](https://assemblyai.com/docs/voice-agents/voice-agent-api/tools/overview.md): server-side HTTP tools and client-side function tools
* [Connect your own LLM](https://assemblyai.com/docs/voice-agents/voice-agent-api/connect-your-own-llm.md): point the agent at an OpenAI-compatible model
* [Manage agents (REST)](https://assemblyai.com/docs/voice-agents/voice-agent-api/manage-agents.md): every endpoint, field, and validation rule
* [Browser integration](https://assemblyai.com/docs/voice-agents/voice-agent-api/browser-integration.md): mint tokens and build your own client
* [Phone agents over SIP](https://assemblyai.com/docs/voice-agents/voice-agent-api/connect-to-twilio.md): the phone step above in full, including a Twilio CLI path
* [Bluejay simulations](https://assemblyai.com/docs/voice-agents/voice-agent-api/test-with-bluejay.md): run simulated callers against your agent and score the results
* [Cekura simulations](https://assemblyai.com/docs/voice-agents/voice-agent-api/test-with-cekura.md): call your phone agent with simulated callers and review AssemblyAI's transcript and tool calls
* [Events reference](https://assemblyai.com/docs/voice-agents/voice-agent-api/events-reference.md): every WebSocket event with full payloads
* [Build with AI coding tools](https://assemblyai.com/docs/voice-agents/voice-agent-api/build-with-ai-tools.md): point Claude Code, Cursor, or v0 at these docs
* [Troubleshooting](https://assemblyai.com/docs/voice-agents/voice-agent-api/troubleshooting.md): symptom-to-fix table and support logging

No code at all? Talk to an agent in the [Voice Agent playground](https://www.assemblyai.com/dashboard/playground/voice-agent).
