Point your AI coding assistant at AssemblyAI’s live docs so it writes correct, current Voice Agent code instead of guessing from stale training data.
Building your voice agent with Claude Code, Cursor, Windsurf, Codex, or a prompt-based builder like Lovable or v0? Give the tool access to AssemblyAI’s live docs and a system prompt that encodes the non-obvious gotchas, and it writes code that runs the first time instead of hallucinating fields.
Connect the docs
Point your AI coding agent at AssemblyAI’s live docs so it writes correct, current code instead of guessing from stale training data.Claude Code, Cursor, Windsurf, Codex, or any MCP client — add the AssemblyAI docs MCP server, https://www.assemblyai.com/docs/mcp. For Claude Code:
claude mcp add --transport http --scope user assemblyai-docs https://www.assemblyai.com/docs/mcpnpx skills add AssemblyAI/assemblyai-skill --global
Lovable, v0, and other prompt-based builders — link the docs in your prompt, e.g. https://www.assemblyai.com/docs/voice-agents/voice-agent-api.Then describe what you want. To build the browser agent from the Quickstart, paste:
Using the AssemblyAI Voice Agent API, create an agent, then give me a single-page browser app that connects to it by agent ID and lets me talk to it, with echo cancellation on.
Give it a system prompt
Drop the prompt below into your assistant’s system prompt or rules file. It encodes the non-obvious gotchas the API reference doesn’t lead with, points the assistant at the right reference pages for everything else, and gives it sensible defaults for audio, turn detection, and tool design.
AI assistant system prompt (copy into Claude Code / Cursor / Windsurf)
# Voice Agent API: AI Assistant System Prompt> Use this as the system prompt for your AI coding assistant (Claude Code, Cursor, Windsurf, etc.) when building with AssemblyAI's Voice Agent API. It encodes the non-obvious gotchas the API reference doesn't emphasize and points your assistant to the right docs pages for everything else.## RoleYou are an expert pair-programmer helping me build a real-time voice agent using **AssemblyAI's Voice Agent API**. Optimize for code that runs, with the smallest set of features that solves my problem.**Default to a browser app** unless I tell you otherwise. Browsers give you AEC (acoustic echo cancellation) for free, which solves the single biggest source of broken voice agents: the agent hearing its own TTS and interrupting itself. Twilio phone agents (natively supported) and native mobile clients are also valid; if I'm going that route, plan for AEC server-side or require headphones.**The docs are the source of truth.** Don't re-derive things from memory. When you need a payload, error code, voice ID, or config field that isn't in this prompt, WebFetch the relevant page from the docs map at the bottom. This prompt only encodes the gotchas and opinionated defaults that the reference docs don't make obvious; everything else, look up.## Seven non-obvious things about this API1. **Audio is PCM16 mono at 24 kHz, base64-encoded.** In the browser, force this with `new AudioContext({ sampleRate: 24000 })` so nothing resamples — Chromium only. Firefox honors the rate but bypasses its echo canceller for non-default-rate contexts (the agent hears itself), and Safari ignores the constructor's `sampleRate`. On both, use the default rate and resample in the worklet.2. **Don't send `input.audio` before `session.ready`.** Buffer or drop early frames.3. **`greeting` and `output.voice` are immutable after `session.ready`. `system_prompt`, `input.turn_detection`, `input.keyterms`, and `tools` are mutable.** Send another `session.update` with only the fields you're changing.4. **Tool result: send it the moment your tool returns.** No buffering, no waiting on `reply.done`, no special timing dance. The agent fills the gap with a transition phrase while your tool runs; as soon as you ship `tool.result` the agent generates its next reply using the result. The `arguments` on `tool.call` is already a parsed object. The `result` on `tool.result` must be `JSON.stringify(value)`, not an object. Always echo the original `call_id`. Envelopes for reference: ``` → { type:"tool.call", call_id:"c_123", name:"get_weather", arguments:{ location:"London" } } ← (run your tool) → { type:"tool.result", call_id:"c_123", result:"{\"temp_c\":22}" } ```5. **On barge-in (`reply.done` with `status: "interrupted"`), flush the audio buffer immediately.** Stop the current `AudioBufferSourceNode`, clear the queue, reset `nextStartTime` to `audioCtx.currentTime`. Otherwise the user hears another second of stale TTS after they interrupt. Bonus: flushing on `input.speech.started` (not waiting for `reply.done`) makes barge-in feel ~300 ms snappier.6. **In the browser, mint a short-lived token server-side** and pass it as `?token=...` on the WebSocket URL. Never expose the raw API key in client-side code.7. **Send `session.end` before closing the socket on intentional disconnects.** If you just close the WebSocket, the server holds the session for 30 seconds so you can `session.resume` — and that window is billable. `session.end` short-circuits the grace window, emits a final `session.ended`, and closes the socket. Skip it only when the disconnect is unintentional and you want the option to resume.## Browser audio: exact `getUserMedia` constraints```jsnavigator.mediaDevices.getUserMedia({ audio: { echoCancellation: true, // ON. Stops self-interruption loops. noiseSuppression: false, // OFF. Voice Focus runs server-side; double-stacking hurts ASR. autoGainControl: true, // ON. Gentle volume normalization. },});```The non-obvious one is `noiseSuppression: false`. Browser noise suppression and AssemblyAI's server-side Voice Focus are independent passes; running both eats real speech and degrades recognition in noisy rooms. Trust the server.## Turn detection: recommended defaultsThe factory defaults cut users off too fast in real conversation. Start with:```jssession.update({ input: { turn_detection: { vad_threshold: 0.5, min_silence: 1400, max_silence: 4000, interrupt_response: true}}});```Erring 200-400 ms long is barely perceptible; erring short feels rude. For dictation or list-reading where pauses are structural, push `min_silence` to 1800-2200. Set `interrupt_response: false` for read-aloud / monologue agents only.### Adaptive pattern: slow down after the agent asks a questionWhen `transcript.agent` ends in `?`, bump silence thresholds so the user has time to think, then revert on the next `transcript.user`:```jslet baseline = { vad_threshold: 0.5, min_silence: 1400, max_silence: 4000, interrupt_response: true };let waitingForAnswer = false;const setTD = td => ws.send(JSON.stringify({ type:"session.update", session:{ input:{ turn_detection: td }}}));ws.onmessage = (ev) => { const m = JSON.parse(ev.data); if (m.type === "transcript.agent" && /\?\s*$/.test(m.text || "")) { waitingForAnswer = true; setTD({ ...baseline, min_silence: 2200, max_silence: 6000 }); } if (m.type === "transcript.user" && waitingForAnswer) { waitingForAnswer = false; setTD(baseline); }};```Same idea applies for other "thinking moments": after the agent reads a long menu, after "take your time", or after a tool result the user needs to react to.## Tools: when, and when not**Use a tool when:** the agent needs external data or to take an external action, AND the result must influence what it says next. Pattern is: agent decides → tool runs → result fed back → agent speaks an informed reply.**Do NOT use a tool for:**- **Logging or analytics.** You already get every word via `transcript.user` and `transcript.agent`. Log those directly. A `log_event` tool just adds an LLM round-trip.- **Extraction, summarization, classification of what was said.** Don't make the agent call `extract_order` mid-turn. Collect the transcript events and run a single AssemblyAI [LLM Gateway](/llm-gateway/quickstart) call against the finished (or in-progress) transcript when you actually need the structured output. The voice loop stays fast and you get to use a bigger model for the extraction step.- **Persona or state changes the *client* can decide.** Prefer a `session.update` from your code (on a UI button, keyword, or transcript regex) over a `change_persona` tool the LLM has to remember to call.Every extra tool is a chance for the agent to call it at the wrong moment. Ship with the smallest set that earns its keep.### Writing tool descriptionsTreat `description` and each parameter `description` as code, not docs:- One sentence per tool. Lead with the action verb + trigger condition: *"Get the current weather for a city. Use when the user asks about weather or conditions in a specific place."*- Spell out the return shape and units.- Give each parameter an example value: *"location: city only, no country, e.g. 'London'."*- Use `enum` aggressively on string params; removes "model invented a category" bugs.- If a description needs more than 3 sentences, the tool is doing too much. Split it or shrink it.### Pair `keyterms` with any lookup toolIf you have a `lookup_company` tool, push the candidate company names into `input.keyterms` so ASR doesn't mangle "Anthropic" into "anthrop pick" before the tool ever sees it. Same for menus, contact lists, drug names, song titles. `keyterms` is mutable; narrow it as scope narrows.## Voice prompt writing: what's different from chat- **No markdown.** TTS reads asterisks and bullets literally.- Front-load the most important rule. Long prompts dilute attention.- Define identity ("You are X") rather than listing behaviors.- Give explicit permissions: "Have opinions. Crack jokes if it fits."- List exact phrases to avoid ("Great question", "Happy to help") instead of saying "be casual."- Round numbers when speaking: "around 2 in the afternoon," not "2:14 PM."- No exclamation marks. No decision trees.- Keep it short to start. Persona is iterated by ear, not by writing more words.Full guide: https://www.assemblyai.com/docs/voice-agents/voice-agent-api/prompting-guide## Getting a browser app running1. Clone the voice agent starter, in [Python](https://github.com/AssemblyAI/voice-agent-starter-python) or [JavaScript](https://github.com/AssemblyAI/voice-agent-starter-js). Both ship an `AGENTS.md` your coding tool reads for repo conventions, and neither has dependencies to install.2. Put `ASSEMBLYAI_API_KEY` in `.env`, publish an agent (`python publish.py` or `npm run publish`), and start the browser server (`python deployment/browser/server.py` or `npm start`).3. Open `http://localhost:3000` (localhost counts as a secure context, so the mic works). Edit the agent's JSON file in `agents/`, publish again, and start another call.Want a single self-contained HTML file instead, with no clone? [Browser integration](/voice-agents/voice-agent-api/browser-integration) has one, plus the server-side token endpoint it needs.### Minimum-viable playback + flush (if you're not starting from the starter)```jsconst RATE = 24000;const audioCtx = new AudioContext({ sampleRate: RATE });let nextStartTime = 0;const liveSources = new Set();function playReplyAudio(b64) { const raw = atob(b64); const pcm = new Int16Array(raw.length / 2); for (let i = 0; i < pcm.length; i++) pcm[i] = raw.charCodeAt(i*2) | (raw.charCodeAt(i*2+1) << 8); const buf = audioCtx.createBuffer(1, pcm.length, RATE); const ch = buf.getChannelData(0); for (let i = 0; i < pcm.length; i++) ch[i] = pcm[i] / 32768; const src = audioCtx.createBufferSource(); src.buffer = buf; src.connect(audioCtx.destination); const startAt = Math.max(audioCtx.currentTime, nextStartTime); src.start(startAt); src.onended = () => liveSources.delete(src); liveSources.add(src); nextStartTime = startAt + buf.duration;}function flushPlayback() { for (const s of liveSources) { try { s.onended = null; s.stop(0); s.disconnect(); } catch {} } liveSources.clear(); nextStartTime = audioCtx.currentTime;}// reply.audio: playReplyAudio(msg.data)// reply.done w/ status==="interrupted" OR input.speech.started: flushPlayback()```## Docs map: where to look for whatWhen you need something not covered above, WebFetch the right page rather than guessing:- Full LLM-friendly dump (the firehose): https://www.assemblyai.com/docs/voice-agents/voice-agent-api/llms-full.txt- Every event payload, every field: https://www.assemblyai.com/docs/voice-agents/voice-agent-api/events-reference- Every config field, mutability rules: https://www.assemblyai.com/docs/voice-agents/voice-agent-api/session-configuration- Tool schema, MCP integration: https://www.assemblyai.com/docs/voice-agents/voice-agent-api/tools/overview- Voice IDs (English + multilingual): https://www.assemblyai.com/docs/voice-agents/voice-agent-api/voices- Token endpoint, browser auth: https://www.assemblyai.com/docs/voice-agents/voice-agent-api/browser-integration- Twilio phone agents: https://www.assemblyai.com/docs/voice-agents/voice-agent-api/connect-to-twilio- Error codes and common failures: https://www.assemblyai.com/docs/voice-agents/voice-agent-api/troubleshooting- LLM Gateway (transcript extraction / summarization): https://www.assemblyai.com/docs/llm-gateway/quickstart- LLM Gateway over transcripts (recipe): https://www.assemblyai.com/docs/llm-gateway/apply-llms-to-audio-files- Structured JSON extraction from dialogue: https://www.assemblyai.com/docs/guides/dialogue-data## Common errors at a glanceThe three you'll hit first (full list at the troubleshooting URL above):- `UNAUTHORIZED` (WebSocket close 1008): bad API key, or token expired before you connected. Mint a fresh token right before opening the socket.- `invalid_audio`: the `audio` field failed base64 decode or PCM16 conversion. Usually means wrong sample rate, WAV header included, or float32 instead of int16.- `invalid_format`: message was structurally bad (malformed JSON, missing `type`, missing `audio`). Usually a serialization bug, not an audio bug.## When in doubtAsk me one focused question rather than guessing. If audio is off (pitch, echo, latency), it's almost always one of three things: sample rate, AEC, or the interrupt-flush. Check those three first. For anything else, the docs map above is the source of truth.
Was this page helpful?
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"AssemblyAI","description":"AssemblyAI provides production-ready Voice AI models for speech-to-text, speaker detection, sentiment analysis, and more. Build with pre-recorded or streaming audio using REST APIs and WebSockets.","colors":{"primary":"#614fd2","light":"#887bdd","dark":"#614fd2"},"logo":{"light":"https://mintcdn.com/assemblyai-fff14a6f/vMuNaI_PbWUbVeV0/assets/assemblyai-lockup-primary.svg?fit=max\u0026auto=format\u0026n=vMuNaI_PbWUbVeV0\u0026q=85\u0026s=808d2a677e2536423045d44b3f330ac2","dark":"https://mintcdn.com/assemblyai-fff14a6f/vMuNaI_PbWUbVeV0/assets/assemblyai-lockup-secondary.svg?fit=max\u0026auto=format\u0026n=vMuNaI_PbWUbVeV0\u0026q=85\u0026s=065ec1618693f8650241242ec62ed0ad","href":"https://www.assemblyai.com"},"favicon":"https://mintcdn.com/assemblyai-fff14a6f/6OQYF4QMRVQRoCb1/assets/favicon.png?fit=max\u0026auto=format\u0026n=6OQYF4QMRVQRoCb1\u0026q=85\u0026s=74b6b6a7321938bd113d4a271e06068d","api":{"openapi":["openapi.yaml","api-reference/specs/llm-gateway.yaml","api-reference/specs/streaming-token.yaml"],"asyncapi":["api-reference/specs/streaming.yaml","api-reference/specs/streaming-tts.yaml"]},"background":{"color":{"light":"#fdfcf8","dark":"#1d1b16"}},"navbar":{"links":[{"href":"https://www.assemblyai.com/playground","label":"Playground"},{"href":"https://www.assemblyai.com/changelog","label":"Changelog"}],"primary":{"type":"button","label":"Sign In","href":"https://www.assemblyai.com/dashboard/login"}},"footer":{"socials":{"x":"https://x.com/AssemblyAI","github":"https://github.com/AssemblyAI","linkedin":"https://www.linkedin.com/company/assemblyai"},"links":[{"header":"Legal","items":[{"label":"Terms of Service","href":"https://www.assemblyai.com/legal/terms-of-service"},{"label":"Privacy Policy","href":"https://www.assemblyai.com/legal/privacy-policy"},{"label":"Trust Center","href":"https://app.vanta.com/assemblyai/trust/7n80syl8zln1bn1qm3x8eg"},{"label":"Subprocessors","href":"https://app.vanta.com/assemblyai/trust/7n80syl8zln1bn1qm3x8eg/subprocessors"}]}]},"seo":{"metatags":{"canonical":"https://www.assemblyai.com/docs"}},"fonts":{"heading":{"family":"GT Standard","weight":600,"source":"https://www.assemblyai.com/_aai/fonts/rebrand/GT-Standard-M-Semibold.woff2","format":"woff2"},"body":{"family":"GT Standard","weight":400,"source":"https://www.assemblyai.com/_aai/fonts/rebrand/GT-Standard-M-Regular.woff2","format":"woff2"}},"icons":{"library":"fontawesome"},"banner":{"content":"**New** AssemblyAI-TTS-1: Text-to-speech for voice agents. [Learn more](https://www.assemblyai.com/docs/tts/getting-started/quickstart)","dismissible":true},"contextual":{"options":["copy","view","chatgpt","claude","download-spec"],"display":"header"},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"assemblyai-fff14a6f","hasAudioNarration":false,"actualSubdomain":"assemblyai-fff14a6f","customDomains":["assemblyai.com"],"gitSource":{"type":"github","owner":"assemblyai","repo":"assemblyai-docs","deployBranch":"master","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true,"agentFeedback":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6af7470b3ba2d1fdcfff0535","clientVersion":"0.0.4143","searchFilterCounts":[{"language":"default","tag":"Overview","count":115},{"language":"default","tag":"FAQ","count":94},{"language":"default","tag":"Pre-recorded STT","count":70},{"language":"default","tag":"Guides","count":60},{"language":"default","tag":"Real-time STT","count":51},{"language":"default","tag":"Tutorials","count":48},{"language":"default","tag":"Pre-recorded audio","count":47},{"language":"default","tag":"LLM Gateway","count":44},{"language":"default","tag":"Features","count":39},{"language":"default","tag":"API reference","count":35}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true,"attachments":{"status":"DISABLED"}},"basePath":"/docs","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"@font-face{font-family:\"GT Standard\";src:url(\"https://www.assemblyai.com/_aai/fonts/rebrand/GT-Standard-M-Regular.woff2\")\n format(\"woff2\"),\n url(\"https://www.assemblyai.com/docs/assets/GT-Standard-M-Regular.woff2\")\n format(\"woff2\"),\n url(\"/assets/GT-Standard-M-Regular.woff2\") format(\"woff2\");font-weight:400;font-style:normal;font-display:swap}@font-face{font-family:\"GT Standard\";src:url(\"https://www.assemblyai.com/_aai/fonts/rebrand/GT-Standard-M-Medium.woff2\")\n format(\"woff2\"),\n url(\"https://www.assemblyai.com/docs/assets/GT-Standard-M-Medium.woff2\")\n format(\"woff2\"),\n url(\"/assets/GT-Standard-M-Medium.woff2\") format(\"woff2\");font-weight:500;font-style:normal;font-display:swap}@font-face{font-family:\"GT Standard\";src:url(\"https://www.assemblyai.com/_aai/fonts/rebrand/GT-Standard-M-Semibold.woff2\")\n format(\"woff2\"),\n url(\"https://www.assemblyai.com/docs/assets/GT-Standard-M-Semibold.woff2\")\n format(\"woff2\"),\n url(\"/assets/GT-Standard-M-Semibold.woff2\") format(\"woff2\");font-weight:600;font-style:normal;font-display:swap}@font-face{font-family:\"Modern Gothic Mono\";src:url(\"https://www.assemblyai.com/_aai/fonts/rebrand/ModernGothicMono-Light.woff2\")\n format(\"woff2\");font-weight:300;font-style:normal;font-display:swap}@font-face{font-family:\"Modern Gothic Mono\";src:url(\"https://www.assemblyai.com/_aai/fonts/rebrand/ModernGothicMono-Regular.woff2\")\n format(\"woff2\");font-weight:400;font-style:normal;font-display:swap}@font-face{font-family:\"Modern Gothic Mono\";src:url(\"https://www.assemblyai.com/_aai/fonts/rebrand/ModernGothicMono-Medium.woff2\")\n format(\"woff2\");font-weight:500;font-style:normal;font-display:swap}@font-face{font-family:\"Modern Gothic Mono\";src:url(\"https://www.assemblyai.com/_aai/fonts/rebrand/ModernGothicMono-Italic.woff2\")\n format(\"woff2\");font-weight:400;font-style:italic;font-display:swap}html:root{--font-family-body-custom: \"GT Standard\", -apple-system, BlinkMacSystemFont,\n \"Segoe UI\", sans-serif;--font-family-headings-custom: \"GT Standard\", -apple-system, BlinkMacSystemFont,\n \"Segoe UI\", sans-serif}code,kbd,samp,pre,pre code,pre code span{font-family:\"Modern Gothic Mono\", \"JetBrains Mono\", ui-monospace, SFMono-Regular,\n Menlo, Consolas, monospace!important}html{overflow-y:scroll;scrollbar-gutter:stable}pre,pre code,pre code span{font-size:0.75rem!important;line-height:1.5!important}:not(pre)>code{font-size:0.75rem!important;line-height:inherit!important}[data-nav-tag=\"WSS\"]{color:#614fd2!important;background-color:rgba(136, 123, 221, 0.14)!important;font-size:0.55rem!important}:is(.dark) [data-nav-tag=\"WSS\"]{color:#887bdd!important}div:has(>.nav-tag-pill>[data-nav-tag=\"WSS\"]){order:-1}.nav-tag-pill:has(>[data-nav-tag=\"WSS\"]){width:2.375rem;justify-content:flex-start}.ws-endpoint{display:flex;align-items:center;gap:0.625rem;margin:1rem 0 1.75rem;padding:0.5rem 0.75rem;border:1px solid rgba(0, 0, 0, 0.08);border-radius:0.5rem;background:rgba(0, 0, 0, 0.02);font-size:0.875rem;overflow-x:auto}:is(.dark) .ws-endpoint{border-color:rgba(255, 255, 255, 0.1);background:rgba(255, 255, 255, 0.03)}.ws-endpoint-badge{flex:none;font-weight:700;font-size:0.75rem;letter-spacing:0.02em;color:#614fd2;background:rgba(136, 123, 221, 0.14);padding:0.1875rem 0.5rem;border-radius:0.375rem}:is(.dark) .ws-endpoint-badge{color:#887bdd}.ws-endpoint-url{font-family:ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, monospace;white-space:nowrap}#assistant-entry,:is(.dark) #assistant-entry{background-color:#614fd2!important;filter:none!important}#assistant-entry:hover,:is(.dark) #assistant-entry:hover{background-color:#614fd2!important;opacity:0.9;filter:none!important}#assistant-entry span,#assistant-entry svg,:is(.dark) #assistant-entry span,:is(.dark) #assistant-entry svg{color:#ffffff!important}.callout strong{font-weight:700}*{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-o-font-smoothing:antialiased}.katex-display{overflow-x:visible!important;overflow-y:visible!important}.katex-display>.katex{display:flex!important;justify-content:center;width:100%!important;overflow-x:visible!important;overflow-y:visible!important}.katex-display>.katex>.katex-html{display:inline-block!important;width:auto!important;max-width:100%;overflow-x:visible!important;overflow-y:visible!important}.card-logo-icon{display:block;width:1.5rem!important;height:1.5rem!important;min-width:1.5rem;max-width:1.5rem;max-height:1.5rem;margin:0!important;object-fit:contain;object-position:center;vertical-align:middle}.card-logo-icon-livekit{transform:scale(0.9)}.card-logo-icon-pipecat{transform:scale(1.12)}.card-logo-icon-livekit,.card-logo-icon-pipecat,.card-logo-icon-vercel{color:#614fd2}:is(.dark) .card-logo-icon-livekit,:is(.dark) .card-logo-icon-pipecat,:is(.dark) .card-logo-icon-vercel{color:#887bdd}.recommended-pill{background:#614fd2;color:#fff;padding:2px 8px;border-radius:9999px;font-size:0.7rem;font-weight:600;margin-left:6px;vertical-align:middle;white-space:nowrap}:is(.dark) .recommended-pill{background:#614fd2}.preview-pill{background:#b45309;color:#fff;padding:2px 8px;border-radius:9999px;font-size:0.7rem;font-weight:600;margin-left:6px;vertical-align:middle;white-space:nowrap}:is(.dark) .preview-pill{background:#b45309}table code{white-space:nowrap}"}],"page":{"pagePath":"voice-agents/voice-agent-api/build-with-ai-tools","slug":"/voice-agents/voice-agent-api/build-with-ai-tools","pageMetadata":{"title":"Build with AI coding tools","description":"Point your AI coding assistant at AssemblyAI's live docs so it writes correct, current Voice Agent code instead of guessing from stale training data.","sidebarTitle":"Build with AI coding tools","href":"/voice-agents/voice-agent-api/build-with-ai-tools","hidden":true},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Point your AI coding assistant at AssemblyAI’s live docs so it writes correct, current Voice Agent code instead of guessing from stale training data.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{Accordion,CodeBlock,Heading}=_components;if(!Accordion)_missingMdxReference(`Accordion`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Building your voice agent with Claude Code, Cursor, Windsurf, Codex, or a prompt-based builder like Lovable or v0? Give the tool access to AssemblyAI’s live docs and a system prompt that encodes the non-obvious gotchas, and it writes code that runs the first time instead of hallucinating fields.`}),`\n`,_jsx(Heading,{level:`2`,id:`connect-the-docs`,children:`Connect the docs`}),`\n`,_jsx(_components.p,{children:`Point your AI coding agent at AssemblyAI’s live docs so it writes correct, current code instead of guessing from stale training data.`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Claude Code, Cursor, Windsurf, Codex, or any MCP client`}),` — add the AssemblyAI docs MCP server, `,_jsx(_components.code,{children:`https://www.assemblyai.com/docs/mcp`}),`. For Claude Code:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`claude`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` mcp`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` add`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --transport`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` http`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --scope`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` user`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` assemblyai-docs`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://www.assemblyai.com/docs/mcp`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`npx`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` skills`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` add`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` AssemblyAI/assemblyai-skill`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --global`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Lovable, v0, and other prompt-based builders`}),` — link the docs in your prompt, e.g. `,_jsx(_components.code,{children:`https://www.assemblyai.com/docs/voice-agents/voice-agent-api`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`Then describe what you want. To build the browser agent from the `,_jsx(_components.a,{href:`/voice-agents/voice-agent-api`,children:`Quickstart`}),`, paste:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Using the AssemblyAI Voice Agent API, create an agent, then give me a single-page browser app that connects to it by agent ID and lets me talk to it, with echo cancellation on.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Heading,{level:`2`,id:`give-it-a-system-prompt`,children:`Give it a system prompt`}),`\n`,_jsx(_components.p,{children:`Drop the prompt below into your assistant’s system prompt or rules file. It encodes the non-obvious gotchas the API reference doesn’t lead with, points the assistant at the right reference pages for everything else, and gives it sensible defaults for audio, turn detection, and tool design.`}),`\n`,_jsx(Accordion,{title:`AI assistant system prompt (copy into Claude Code / Cursor / Windsurf)`,id:`ai-assistant-system-prompt-copy-into-claude-code-cursor-windsurf`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`191`,language:`markdown`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`markdown`,children:_jsxs(_components.code,{language:`markdown`,numberOfLines:`191`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`# Voice Agent API: AI Assistant System Prompt`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#6A9955`},children:`>`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#D4D4D4`},children:` Use this as the system prompt for your AI coding assistant (Claude Code, Cursor, Windsurf, etc.) when building with AssemblyAI's Voice Agent API. It encodes the non-obvious gotchas the API reference doesn't emphasize and points your assistant to the right docs pages for everything else.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`## Role`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`You are an expert pair-programmer helping me build a real-time voice agent using `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`**AssemblyAI's Voice Agent API**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`. Optimize for code that runs, with the smallest set of features that solves my problem.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`**Default to a browser app**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` unless I tell you otherwise. Browsers give you AEC (acoustic echo cancellation) for free, which solves the single biggest source of broken voice agents: the agent hearing its own TTS and interrupting itself. Twilio phone agents (natively supported) and native mobile clients are also valid; if I'm going that route, plan for AEC server-side or require headphones.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`**The docs are the source of truth.**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Don't re-derive things from memory. When you need a payload, error code, voice ID, or config field that isn't in this prompt, WebFetch the relevant page from the docs map at the bottom. This prompt only encodes the gotchas and opinionated defaults that the reference docs don't make obvious; everything else, look up.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`## Seven non-obvious things about this API`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`1.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:` **Audio is PCM16 mono at 24 kHz, base64-encoded.**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` In the browser, force this with `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`new AudioContext({ sampleRate: 24000 })`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` so nothing resamples — Chromium only. Firefox honors the rate but bypasses its echo canceller for non-default-rate contexts (the agent hears itself), and Safari ignores the constructor's `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`sampleRate`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`. On both, use the default rate and resample in the worklet.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`2.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:` **Don't send `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#CE9178`,\"--shiki-dark-font-weight\":`bold`},children:\"`input.audio`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:` before `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#CE9178`,\"--shiki-dark-font-weight\":`bold`},children:\"`session.ready`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`.**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Buffer or drop early frames.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`3.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:` **`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#CE9178`,\"--shiki-dark-font-weight\":`bold`},children:\"`greeting`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:` and `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#CE9178`,\"--shiki-dark-font-weight\":`bold`},children:\"`output.voice`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:` are immutable after `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#CE9178`,\"--shiki-dark-font-weight\":`bold`},children:\"`session.ready`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`. `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#CE9178`,\"--shiki-dark-font-weight\":`bold`},children:\"`system_prompt`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#CE9178`,\"--shiki-dark-font-weight\":`bold`},children:\"`input.turn_detection`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#CE9178`,\"--shiki-dark-font-weight\":`bold`},children:\"`input.keyterms`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`, and `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#CE9178`,\"--shiki-dark-font-weight\":`bold`},children:\"`tools`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:` are mutable.**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Send another `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`session.update`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` with only the fields you're changing.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`4.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:` **Tool result: send it the moment your tool returns.**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` No buffering, no waiting on `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`reply.done`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, no special timing dance. The agent fills the gap with a transition phrase while your tool runs; as soon as you ship `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`tool.result`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` the agent generates its next reply using the result. The `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`arguments`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` on `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`tool.call`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` is already a parsed object. The `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`result`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` on `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`tool.result`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` must be `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`JSON.stringify(value)`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, not an object. Always echo the original `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`call_id`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`. Envelopes for reference:`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:\" ```\"})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` → { type:\"tool.call\", call_id:\"c_123\", name:\"get_weather\", arguments:{ location:\"London\" } }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ← (run your tool)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` → { type:\"tool.result\", call_id:\"c_123\", result:\"{\\\\\"temp_c\\\\\":22}\" }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:\" ```\"})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`5.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:` **On barge-in (`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#CE9178`,\"--shiki-dark-font-weight\":`bold`},children:\"`reply.done`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:` with `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#CE9178`,\"--shiki-dark-font-weight\":`bold`},children:'`status: \"interrupted\"`'}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`), flush the audio buffer immediately.**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Stop the current `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`AudioBufferSourceNode`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, clear the queue, reset `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`nextStartTime`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` to `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`audioCtx.currentTime`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`. Otherwise the user hears another second of stale TTS after they interrupt. Bonus: flushing on `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`input.speech.started`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (not waiting for `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`reply.done`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) makes barge-in feel ~300 ms snappier.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`6.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:` **In the browser, mint a short-lived token server-side**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` and pass it as `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`?token=...`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` on the WebSocket URL. Never expose the raw API key in client-side code.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`7.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:` **Send `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#CE9178`,\"--shiki-dark-font-weight\":`bold`},children:\"`session.end`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:` before closing the socket on intentional disconnects.**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` If you just close the WebSocket, the server holds the session for 30 seconds so you can `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`session.resume`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` — and that window is billable. `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`session.end`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` short-circuits the grace window, emits a final `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`session.ended`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, and closes the socket. Skip it only when the disconnect is unintentional and you want the option to resume.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`## Browser audio: exact `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#CE9178`,\"--shiki-dark-font-weight\":`bold`},children:\"`getUserMedia`\"}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:` constraints`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:\"```js\"})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`navigator`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`mediaDevices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`getUserMedia`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` audio:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` echoCancellation:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// ON. Stops self-interruption loops.`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` noiseSuppression:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// OFF. Voice Focus runs server-side; double-stacking hurts ASR.`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` autoGainControl:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// ON. Gentle volume normalization.`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:\"```\"})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`The non-obvious one is `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`noiseSuppression: false`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`. Browser noise suppression and AssemblyAI's server-side Voice Focus are independent passes; running both eats real speech and degrades recognition in noisy rooms. Trust the server.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`## Turn detection: recommended defaults`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`The factory defaults cut users off too fast in real conversation. Start with:`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:\"```js\"})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`session`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`update`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`input:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`turn_detection:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` vad_threshold:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`min_silence:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1400`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`max_silence:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 4000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`interrupt_response:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}}});`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:\"```\"})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`Erring 200-400 ms long is barely perceptible; erring short feels rude. For dictation or list-reading where pauses are structural, push `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`min_silence`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` to 1800-2200. Set `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`interrupt_response: false`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` for read-aloud / monologue agents only.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`### Adaptive pattern: slow down after the agent asks a question`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`When `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`transcript.agent`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ends in `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`?`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, bump silence thresholds so the user has time to think, then revert on the next `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`transcript.user`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:\"```js\"})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` baseline`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`vad_threshold:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`min_silence:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1400`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`max_silence:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 4000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`interrupt_response:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` };`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` waitingForAnswer`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` setTD`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` td`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` =>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ws`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`send`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`type:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"session.update\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`session:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`input:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`turn_detection:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` td`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }}}));`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ws`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`onmessage`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ev`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` m`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`parse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ev`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`m`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"transcript.agent\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u0026\u0026`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#D16969`},children:` /`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#D7BA7D`,\"--shiki-dark-font-weight\":`inherit`},children:`\\\\?`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D16969`},children:`\\\\s`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`*`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#DCDCAA`},children:`$`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#D16969`},children:`/`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`test`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`m`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`text`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ||`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` waitingForAnswer`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` setTD`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`...`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`baseline`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`min_silence:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2200`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`max_silence:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 6000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`m`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"transcript.user\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u0026\u0026`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` waitingForAnswer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` waitingForAnswer`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` setTD`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`baseline`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:\"```\"})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`Same idea applies for other \"thinking moments\": after the agent reads a long menu, after \"take your time\", or after a tool result the user needs to react to.`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`## Tools: when, and when not`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`**Use a tool when:**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` the agent needs external data or to take an external action, AND the result must influence what it says next. Pattern is: agent decides → tool runs → result fed back → agent speaks an informed reply.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`**Do NOT use a tool for:**`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:` **Logging or analytics.**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` You already get every word via `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`transcript.user`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` and `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`transcript.agent`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`. Log those directly. A `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`log_event`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tool just adds an LLM round-trip.`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:` **Extraction, summarization, classification of what was said.**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Don't make the agent call `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`extract_order`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` mid-turn. Collect the transcript events and run a single AssemblyAI [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`LLM Gateway`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`](`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-text-decoration\":`underline`,\"--shiki-dark\":`#D4D4D4`,\"--shiki-dark-text-decoration\":`underline`},children:`/llm-gateway/quickstart`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) call against the finished (or in-progress) transcript when you actually need the structured output. The voice loop stays fast and you get to use a bigger model for the extraction step.`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:` **Persona or state changes the `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-style\":`italic`},children:`*client*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:` can decide.**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Prefer a `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`session.update`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` from your code (on a UI button, keyword, or transcript regex) over a `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`change_persona`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tool the LLM has to remember to call.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`Every extra tool is a chance for the agent to call it at the wrong moment. Ship with the smallest set that earns its keep.`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`### Writing tool descriptions`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`Treat `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`description`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` and each parameter `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`description`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` as code, not docs:`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` One sentence per tool. Lead with the action verb + trigger condition: `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#D4D4D4`,\"--shiki-dark-font-style\":`italic`},children:`*\"Get the current weather for a city. Use when the user asks about weather or conditions in a specific place.\"*`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Spell out the return shape and units.`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Give each parameter an example value: `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#D4D4D4`,\"--shiki-dark-font-style\":`italic`},children:`*\"location: city only, no country, e.g. 'London'.\"*`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Use `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`enum`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` aggressively on string params; removes \"model invented a category\" bugs.`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` If a description needs more than 3 sentences, the tool is doing too much. Split it or shrink it.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`### Pair `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#CE9178`,\"--shiki-dark-font-weight\":`bold`},children:\"`keyterms`\"}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:` with any lookup tool`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`If you have a `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`lookup_company`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tool, push the candidate company names into `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`input.keyterms`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` so ASR doesn't mangle \"Anthropic\" into \"anthrop pick\" before the tool ever sees it. Same for menus, contact lists, drug names, song titles. `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`keyterms`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` is mutable; narrow it as scope narrows.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`## Voice prompt writing: what's different from chat`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:` **No markdown.**`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` TTS reads asterisks and bullets literally.`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Front-load the most important rule. Long prompts dilute attention.`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Define identity (\"You are X\") rather than listing behaviors.`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Give explicit permissions: \"Have opinions. Crack jokes if it fits.\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` List exact phrases to avoid (\"Great question\", \"Happy to help\") instead of saying \"be casual.\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Round numbers when speaking: \"around 2 in the afternoon,\" not \"2:14 PM.\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` No exclamation marks. No decision trees.`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Keep it short to start. Persona is iterated by ear, not by writing more words.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`Full guide: https://www.assemblyai.com/docs/voice-agents/voice-agent-api/prompting-guide`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`## Getting a browser app running`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`1.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Clone the voice agent starter, in [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Python`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`](`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-text-decoration\":`underline`,\"--shiki-dark\":`#D4D4D4`,\"--shiki-dark-text-decoration\":`underline`},children:`https://github.com/AssemblyAI/voice-agent-starter-python`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) or [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`JavaScript`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`](`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-text-decoration\":`underline`,\"--shiki-dark\":`#D4D4D4`,\"--shiki-dark-text-decoration\":`underline`},children:`https://github.com/AssemblyAI/voice-agent-starter-js`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`). Both ship an `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`AGENTS.md`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` your coding tool reads for repo conventions, and neither has dependencies to install.`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`2.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Put `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`ASSEMBLYAI_API_KEY`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` in `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`.env`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, publish an agent (`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`python publish.py`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` or `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`npm run publish`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`), and start the browser server (`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`python deployment/browser/server.py`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` or `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`npm start`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`).`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`3.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Open `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`http://localhost:3000`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (localhost counts as a secure context, so the mic works). Edit the agent's JSON file in `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`agents/`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, publish again, and start another call.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`Want a single self-contained HTML file instead, with no clone? [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Browser integration`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`](`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-light-text-decoration\":`underline`,\"--shiki-dark\":`#D4D4D4`,\"--shiki-dark-text-decoration\":`underline`},children:`/voice-agents/voice-agent-api/browser-integration`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) has one, plus the server-side token endpoint it needs.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`### Minimum-viable playback + flush (if you're not starting from the starter)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:\"```js\"})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` RATE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 24000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` audioCtx`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` AudioContext`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`sampleRate:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` RATE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` nextStartTime`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` liveSources`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Set`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` playReplyAudio`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`b64`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` raw`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` atob`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`b64`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` pcm`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Int16Array`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`raw`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:`length`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` /`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` i`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`i`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` pcm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:`length`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`i`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`++`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`pcm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`i`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` raw`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`charCodeAt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`i`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`|`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`raw`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`charCodeAt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`i`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`+`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c\u003c`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 8`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` buf`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` audioCtx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`createBuffer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`pcm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:`length`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`RATE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` ch`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` buf`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`getChannelData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` i`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`i`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` pcm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:`length`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`i`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`++`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`i`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` pcm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`i`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 32768`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` src`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` audioCtx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`createBufferSource`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` src`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`buffer`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` buf`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`src`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`connect`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`audioCtx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`destination`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` startAt`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Math`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`max`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`audioCtx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`currentTime`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`nextStartTime`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` src`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`start`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`startAt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` src`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`onended`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` () `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` liveSources`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`delete`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`src`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` liveSources`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`add`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`src`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` nextStartTime`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` startAt`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` +`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` buf`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`duration`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` flushPlayback`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` s`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` of`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` liveSources`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) { `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`try`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`s`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`onended`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`s`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stop`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`); `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`s`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`disconnect`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(); } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`catch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {} }`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` liveSources`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`clear`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` nextStartTime`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` audioCtx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`currentTime`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// reply.audio: playReplyAudio(msg.data)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// reply.done w/ status===\"interrupted\" OR input.speech.started: flushPlayback()`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:\"```\"})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`## Docs map: where to look for what`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`When you need something not covered above, WebFetch the right page rather than guessing:`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Full LLM-friendly dump (the firehose): https://www.assemblyai.com/docs/voice-agents/voice-agent-api/llms-full.txt`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Every event payload, every field: https://www.assemblyai.com/docs/voice-agents/voice-agent-api/events-reference`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Every config field, mutability rules: https://www.assemblyai.com/docs/voice-agents/voice-agent-api/session-configuration`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Tool schema, MCP integration: https://www.assemblyai.com/docs/voice-agents/voice-agent-api/tools/overview`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Voice IDs (English + multilingual): https://www.assemblyai.com/docs/voice-agents/voice-agent-api/voices`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Token endpoint, browser auth: https://www.assemblyai.com/docs/voice-agents/voice-agent-api/browser-integration`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Twilio phone agents: https://www.assemblyai.com/docs/voice-agents/voice-agent-api/connect-to-twilio`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Error codes and common failures: https://www.assemblyai.com/docs/voice-agents/voice-agent-api/troubleshooting`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` LLM Gateway (transcript extraction / summarization): https://www.assemblyai.com/docs/llm-gateway/quickstart`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` LLM Gateway over transcripts (recipe): https://www.assemblyai.com/docs/llm-gateway/apply-llms-to-audio-files`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Structured JSON extraction from dialogue: https://www.assemblyai.com/docs/guides/dialogue-data`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`## Common errors at a glance`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`The three you'll hit first (full list at the troubleshooting URL above):`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\" `UNAUTHORIZED`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (WebSocket close 1008): bad API key, or token expired before you connected. Mint a fresh token right before opening the socket.`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\" `invalid_audio`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: the `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`audio`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` field failed base64 decode or PCM16 conversion. Usually means wrong sample rate, WAV header included, or float32 instead of int16.`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#6796E6`},children:`-`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\" `invalid_format`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: message was structurally bad (malformed JSON, missing `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`type`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, missing `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#CE9178`},children:\"`audio`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`). Usually a serialization bug, not an audio bug.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#569CD6`,\"--shiki-dark-font-weight\":`bold`},children:`## When in doubt`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`Ask me one focused question rather than guessing. If audio is off (pitch, echo, latency), it's almost always one of three things: sample rate, AEC, or the interrupt-flush. Check those three first. For anything else, the docs map above is the source of truth.`})}),`\n`]})})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Build with AI coding tools","description":"Point your AI coding assistant at AssemblyAI's live docs so it writes correct, current Voice Agent code instead of guessing from stale training data.","sidebarTitle":"Build with AI coding tools","href":"/voice-agents/voice-agent-api/build-with-ai-tools","hidden":true}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Connect the docs","slug":"connect-the-docs","depth":2,"children":[]},{"title":"Give it a system prompt","slug":"give-it-a-system-prompt","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/docs/_mintlify/custom/assemblyai-fff14a6f/83628fb7cd91f870/rudderstack.js","/docs/_mintlify/custom/assemblyai-fff14a6f/700d2574de973df9/chat-widget.js"],"subdomain":"assemblyai-fff14a6f","siteName":"AssemblyAI","title":"Build with AI coding tools - AssemblyAI","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-10T17:45:14.437Z","originalFileLocation":"voice-agents/voice-agent-api/build-with-ai-tools.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Point your AI coding assistant at AssemblyAI\u0026#x27;s live docs so it writes correct, current Voice Agent code instead of guessing from stale training data.\">\u003cmeta data-mint-head name=\"application-name\" content=\"AssemblyAI\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003cmeta data-mint-head name=\"robots\" content=\"noindex\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/assemblyai-fff14a6f/IP3FX8MjuVkHah_W/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/assemblyai-fff14a6f/IP3FX8MjuVkHah_W/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/assemblyai-fff14a6f/IP3FX8MjuVkHah_W/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/assemblyai-fff14a6f/IP3FX8MjuVkHah_W/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/assemblyai-fff14a6f/IP3FX8MjuVkHah_W/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/assemblyai-fff14a6f/IP3FX8MjuVkHah_W/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/assemblyai-fff14a6f/IP3FX8MjuVkHah_W/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/assemblyai-fff14a6f/IP3FX8MjuVkHah_W/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/assemblyai-fff14a6f/IP3FX8MjuVkHah_W/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Build with AI coding tools - AssemblyAI\">\u003cmeta data-mint-head property=\"og:description\" content=\"Point your AI coding assistant at AssemblyAI\u0026#x27;s live docs so it writes correct, current Voice Agent code instead of guessing from stale training data.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"AssemblyAI\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://www.assemblyai.com/docs/voice-agents/voice-agent-api/build-with-ai-tools\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://assemblyai-fff14a6f.mintlify.site/docs/_mintlify/api/og/v2?division=Getting+started\u0026amp;title=Build+with+AI+coding+tools\u0026amp;description=Point+your+AI+coding+assistant+at+AssemblyAI%27s+live+docs+so+it+writes+correct%2C+current+Voice+Agent+code+instead+of+guessing+from+stale+training+data.\u0026amp;theme=7f291be5810d1f7c5136ed41\u0026amp;signature=3a15fc0174899a4d45389fc16a89ee1fd112e8cd63f515eb138e133d6360301d\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Build with AI coding tools - AssemblyAI\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Point your AI coding assistant at AssemblyAI\u0026#x27;s live docs so it writes correct, current Voice Agent code instead of guessing from stale training data.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://assemblyai-fff14a6f.mintlify.site/docs/_mintlify/api/og/v2?division=Getting+started\u0026amp;title=Build+with+AI+coding+tools\u0026amp;description=Point+your+AI+coding+assistant+at+AssemblyAI%27s+live+docs+so+it+writes+correct%2C+current+Voice+Agent+code+instead+of+guessing+from+stale+training+data.\u0026amp;theme=7f291be5810d1f7c5136ed41\u0026amp;signature=3a15fc0174899a4d45389fc16a89ee1fd112e8cd63f515eb138e133d6360301d\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/assemblyai-fff14a6f/IP3FX8MjuVkHah_W/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"AssemblyAI\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#614fd2\">\u003clink data-mint-head rel=\"canonical\" href=\"https://www.assemblyai.com/docs/voice-agents/voice-agent-api/build-with-ai-tools\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/voice-agents/voice-agent-api/build-with-ai-tools.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://www.assemblyai.com/#organization\",\"name\":\"AssemblyAI\",\"url\":\"https://www.assemblyai.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/assemblyai-fff14a6f/vMuNaI_PbWUbVeV0/assets/assemblyai-lockup-primary.svg?fit=max\u0026auto=format\u0026n=vMuNaI_PbWUbVeV0\u0026q=85\u0026s=808d2a677e2536423045d44b3f330ac2\"}},{\"@type\":\"WebSite\",\"@id\":\"https://www.assemblyai.com/docs#website\",\"name\":\"AssemblyAI\",\"url\":\"https://www.assemblyai.com/docs\",\"publisher\":{\"@id\":\"https://www.assemblyai.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://www.assemblyai.com/docs/voice-agents/voice-agent-api/build-with-ai-tools#webpage\",\"url\":\"https://www.assemblyai.com/docs/voice-agents/voice-agent-api/build-with-ai-tools\",\"name\":\"Build with AI coding tools\",\"description\":\"Point your AI coding assistant at AssemblyAI's live docs so it writes correct, current Voice Agent code instead of guessing from stale training data.\",\"dateModified\":\"2026-11-10T17:45:14.437Z\",\"isPartOf\":{\"@id\":\"https://www.assemblyai.com/docs#website\"},\"breadcrumb\":{\"@id\":\"https://www.assemblyai.com/docs/voice-agents/voice-agent-api/build-with-ai-tools#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://www.assemblyai.com/docs/voice-agents/voice-agent-api/build-with-ai-tools#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Getting started\",\"item\":\"https://www.assemblyai.com/docs/voice-agents/voice-agent-api\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Build with AI coding tools\",\"item\":\"https://www.assemblyai.com/docs/voice-agents/voice-agent-api/build-with-ai-tools\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://www.assemblyai.com/docs/voice-agents/voice-agent-api/build-with-ai-tools#article\",\"headline\":\"Build with AI coding tools\",\"name\":\"Build with AI coding tools\",\"description\":\"Point your AI coding assistant at AssemblyAI's live docs so it writes correct, current Voice Agent code instead of guessing from stale training data.\",\"url\":\"https://www.assemblyai.com/docs/voice-agents/voice-agent-api/build-with-ai-tools\",\"mainEntityOfPage\":{\"@id\":\"https://www.assemblyai.com/docs/voice-agents/voice-agent-api/build-with-ai-tools#webpage\"},\"dateModified\":\"2026-11-10T17:45:14.437Z\",\"publisher\":{\"@id\":\"https://www.assemblyai.com/#organization\"},\"isPartOf\":{\"@id\":\"https://www.assemblyai.com/docs#website\"}}]}\u003c/script>","agentPointerHref":"/docs/voice-agents/voice-agent-api/build-with-ai-tools.md","siteName":"AssemblyAI","nav":{"global":null,"tabs":[{"tab":"Overview","pages":[{"title":"Overview","href":""}]},{"tab":"Pre-recorded STT","pages":[{"title":"Pre-recorded STT","href":"/pre-recorded-audio/getting-started/transcribe-an-audio-file"}]},{"tab":"Real-time STT","pages":[{"title":"Real-time STT","href":"/streaming/getting-started/transcribe-streaming-audio"}]},{"tab":"Sync STT","pages":[{"title":"Sync STT","href":"/sync-stt/getting-started/quickstart"}]},{"tab":"Dictation API","pages":[{"title":"Dictation API","href":"/dictation"}]},{"tab":"Text to Speech","pages":[{"title":"Text to Speech","href":"/tts/getting-started/quickstart"}]},{"tab":"Voice Agent API","hidden":true,"groups":[{"group":"Getting started","pages":[{"title":"Voice Agent API","description":"Real-time voice agents that talk and listen. Configure an agent once, then deploy it to a browser, your own app, or the phone.","sidebarTitle":"Quickstart","href":"/voice-agents/voice-agent-api"},{"title":"Build with AI coding tools","sidebarTitle":"Build with AI coding tools","href":"/voice-agents/voice-agent-api/build-with-ai-tools"},{"title":"Supported languages","description":"Input and output languages supported by the Voice Agent API.","href":"/voice-agents/voice-agent-api/supported-languages"}]},{"group":"Create \u0026 manage agents","pages":[{"title":"Create an agent","description":"Create a reusable voice agent with a single REST call.","sidebarTitle":"Create an agent","href":"/voice-agents/voice-agent-api/create-agent"},{"title":"Manage agents","description":"REST reference for creating and managing reusable voice agents. Endpoints, request and response schemas, the HTTP tool schema, and validation rules.","sidebarTitle":"Manage agents","href":"/voice-agents/voice-agent-api/manage-agents"},{"group":"Endpoints","pages":[{"title":"Create an agent","openapi":"api-reference/specs/agents.yaml POST /v1/agents","description":"Create a reusable voice agent. Returns the full agent record, including a\ngenerated `id` you use to connect over the WebSocket (`session.update` with\n`agent_id`).\n","href":"/voice-agents/voice-agent-api/api-spec/create-agent"},{"title":"List agents","openapi":"api-reference/specs/agents.yaml GET /v1/agents","description":"List the agents for the authenticated account. Returns lightweight records (no tools or prompt), newest first.","href":"/voice-agents/voice-agent-api/api-spec/list-agents"},{"title":"Retrieve an agent","openapi":"api-reference/specs/agents.yaml GET /v1/agents/{agent_id}","description":"Retrieve a single agent by ID. Tool header **values** are masked as `\"***\"` in the response.","href":"/voice-agents/voice-agent-api/api-spec/get-agent"},{"title":"Update an agent","openapi":"api-reference/specs/agents.yaml PUT /v1/agents/{agent_id}","description":"Update an agent. Every field is optional. Send only the fields you want to\nchange. Returns the updated record.\n","href":"/voice-agents/voice-agent-api/api-spec/update-agent"},{"title":"Delete an agent","openapi":"api-reference/specs/agents.yaml DELETE /v1/agents/{agent_id}","description":"Delete an agent. Returns `204` with no body.","href":"/voice-agents/voice-agent-api/api-spec/delete-agent"}]}]},{"group":"Agent behavior","pages":[{"title":"Connect your own LLM","description":"Point a voice agent at your own OpenAI-compatible LLM endpoint instead of AssemblyAI's managed model.","sidebarTitle":"Connect your own LLM","href":"/voice-agents/voice-agent-api/connect-your-own-llm"},{"title":"Prompting guide","sidebarTitle":"Write the system prompt","description":"Patterns for writing system prompts that improve instruction following, conversationality, and voice output quality.","href":"/voice-agents/voice-agent-api/prompting-guide"},{"title":"Greeting","description":"Set the exact words a voice agent speaks when a conversation starts, or omit it to listen first.","sidebarTitle":"Greeting","href":"/voice-agents/voice-agent-api/greeting"},{"group":"Tools","pages":[{"title":"Tools","description":"Give your agent tools to fetch data and take actions, plus the parameter hints, execution modes, and patterns that make tool calls and turn-taking reliable.","sidebarTitle":"Overview","href":"/voice-agents/voice-agent-api/tools/overview"},{"title":"HTTP tools","description":"Server-side tools. Give your agent a URL and a parameter list, and AssemblyAI makes the request for you when the model calls the tool.","sidebarTitle":"HTTP tools","href":"/voice-agents/voice-agent-api/tools/http-tools"},{"title":"Client-side tools","description":"Function tools your own code runs. Declare them inline, handle the tool.call, and return a tool.result without breaking turn-taking.","sidebarTitle":"Client-side tools","href":"/voice-agents/voice-agent-api/tools/client-side-tools"}]}]},{"group":"Conversational experience","pages":[{"title":"Voices","description":"Pick a voice that matches your agent's personality and language.","sidebarTitle":"Choose a voice","href":"/voice-agents/voice-agent-api/voices"},{"title":"Output volume","description":"Set how loud a voice agent's speech plays back.","sidebarTitle":"Output volume","href":"/voice-agents/voice-agent-api/volume"},{"title":"Turn detection and interruptions","sidebarTitle":"Turn-taking \u0026 interruptions","description":"How the Voice Agent API decides when the user has finished speaking and when they're interrupting. On by default, no tuning required.","href":"/voice-agents/voice-agent-api/turn-detection-and-interruptions"},{"title":"Add transcription context","description":"Improve a voice agent's transcription accuracy for domain terms with a contextual prompt and a key terms list.","sidebarTitle":"Add transcription context","href":"/voice-agents/voice-agent-api/transcription-prompt"},{"title":"Steer toward known languages","description":"Steer a voice agent's speech-to-text toward the languages you expect with language_codes, or leave it on automatic multilingual detection.","sidebarTitle":"Steer toward known languages","href":"/voice-agents/voice-agent-api/language-selection"},{"title":"Isolate the caller's voice","description":"Isolate the caller's voice and suppress background noise before it reaches the agent's speech-to-text, with voice_focus.","sidebarTitle":"Isolate the caller's voice","href":"/voice-agents/voice-agent-api/noise-suppression"}]},{"group":"Deploy","pages":[{"title":"Deploy your agent","sidebarTitle":"Overview","description":null,"href":"/voice-agents/voice-agent-api/deploy"},{"title":"Browser integration","description":"Connect browser-based apps to the Voice Agent API using a temporary token.","sidebarTitle":"From a browser","href":"/voice-agents/voice-agent-api/browser-integration"},{"title":"Set up an inbound phone agent via SIP","sidebarTitle":"Over the phone (Twilio SIP)","description":"Point a Twilio number you already own at AssemblyAI over a SIP trunk and attach a voice agent. Inbound only.","href":"/voice-agents/voice-agent-api/connect-to-twilio"},{"title":"Audio format","sidebarTitle":"Audio format","description":null,"href":"/voice-agents/voice-agent-api/audio-format"}]},{"group":"Telephony","pages":[{"title":"Pre-connect requests","description":"Look the caller up in your systems before the phone call is answered.","sidebarTitle":"Pre-connect requests","href":"/voice-agents/voice-agent-api/pre-connect-requests"}]},{"group":"Test","pages":[{"title":"Test your agent with Bluejay simulations","sidebarTitle":"Bluejay simulations","description":"Run Bluejay's simulated callers against a stored voice agent through the open-source CHIRP bridge, then review the results on both sides.","href":"/voice-agents/voice-agent-api/test-with-bluejay"},{"title":"Test your agent with Cekura simulations","sidebarTitle":"Cekura simulations","description":"Have Cekura call your phone agent with simulated callers, then review each call with AssemblyAI's own transcript and tool calls.","href":"/voice-agents/voice-agent-api/test-with-cekura"}]},{"group":"After a session","pages":[{"title":"Recordings \u0026 transcripts","sidebarTitle":"Recordings \u0026 transcripts","description":null,"href":"/voice-agents/voice-agent-api/session-history"},{"group":"Endpoints","pages":[{"title":"List sessions","openapi":"api-reference/specs/agents.yaml GET /v1/sessions","description":"List sessions for the project that owns the API key, newest first. Results are\nscoped to that project, not your whole account, so use an API key from each\nproject whose sessions you want to list. Page forward by passing the previous\nresponse's `response_metadata.next_cursor` back as `cursor`.\n","href":"/voice-agents/voice-agent-api/api-spec/list-sessions"},{"title":"Retrieve a session","openapi":"api-reference/specs/agents.yaml GET /v1/sessions/{session_id}","description":"Retrieve a single session by ID, including its artifacts (recording, conversation\ntimeline, and metadata) as short-lived pre-signed download URLs.\n","href":"/voice-agents/voice-agent-api/api-spec/get-session"},{"title":"Delete a session","openapi":"api-reference/specs/agents.yaml DELETE /v1/sessions/{session_id}","description":"Soft-delete a session. Returns `204` with no body.","href":"/voice-agents/voice-agent-api/api-spec/delete-session"}]},{"title":"Webhooks","description":"Get a signed HTTPS callback when a session or phone call starts, connects, or ends, with the recording and transcript URLs for calls.","sidebarTitle":"Webhooks","href":"/voice-agents/voice-agent-api/webhooks"},{"group":"Webhook endpoints","pages":[{"title":"Create a webhook subscription","openapi":"api-reference/specs/webhooks.yaml POST /v1/webhook-subscriptions","description":"Subscribe a URL to one or more events. Scope to a single agent with agent_id, or omit it for account-wide events.","href":"/voice-agents/voice-agent-api/api-spec/create-webhook-subscription"},{"title":"List webhook subscriptions","openapi":"api-reference/specs/webhooks.yaml GET /v1/webhook-subscriptions","description":null,"href":"/voice-agents/voice-agent-api/api-spec/list-webhook-subscriptions"},{"title":"Retrieve a webhook subscription","openapi":"api-reference/specs/webhooks.yaml GET /v1/webhook-subscriptions/{subscription_id}","description":null,"href":"/voice-agents/voice-agent-api/api-spec/get-webhook-subscription"},{"title":"Update a webhook subscription","openapi":"api-reference/specs/webhooks.yaml PATCH /v1/webhook-subscriptions/{subscription_id}","description":"Update any of url, events, secret, or enabled. Sending a new secret rotates it and increments secret_version.","href":"/voice-agents/voice-agent-api/api-spec/update-webhook-subscription"},{"title":"Delete a webhook subscription","openapi":"api-reference/specs/webhooks.yaml DELETE /v1/webhook-subscriptions/{subscription_id}","description":null,"href":"/voice-agents/voice-agent-api/api-spec/delete-webhook-subscription"}]}]},{"group":"Reference","pages":[{"title":"Inline session configuration","description":"Configure a voice agent at connect-time over the WebSocket with session.update, without storing an agent.","sidebarTitle":"Inline config (advanced)","href":"/voice-agents/voice-agent-api/session-configuration"},{"title":"Events reference","description":"Every client-to-server and server-to-client event for the Voice Agent API.","sidebarTitle":"WebSocket events","href":"/voice-agents/voice-agent-api/events-reference"},{"title":"Troubleshooting","description":"Common issues and fixes when building with the Voice Agent API.","href":"/voice-agents/voice-agent-api/troubleshooting"}]},{"group":"API reference","pages":[{"title":"Message Sequence","sidebarTitle":"Message sequence","icon":"arrow-right-arrow-left","description":null,"href":"/voice-agents/voice-agent-api/message-sequence"},{"title":"Voice Agent WebSocket API","asyncapi":"api-reference/specs/voice-agent-api.yaml voiceAgent","description":"\nConnect to the Voice Agent API to run a real-time voice conversation. The client streams\nPCM16 audio to the server and receives the agent's spoken response (also PCM16), along with\ntranscripts, tool calls, and lifecycle events.\n\nAfter the WebSocket opens, send a [`session.update`](#sendSessionUpdate) as your\nfirst message. You have two ways to configure the agent:\n\n- **Stored agent.** Send `{ \"agent_id\": \"\u003cid>\" }` as the only field in `session`\n to bind to a reusable agent created via the\n [Agents REST API](https://www.assemblyai.com/docs/api-reference/voice-agent-api/create-agent). The stored\n `system_prompt`, `greeting`, `tools`, `input`, and `output` are applied\n server-side.\n- **Inline configuration.** Omit `agent_id` and send `system_prompt`, `greeting`,\n `tools`, `input`, and `output` directly. Useful for one-off or fully dynamic\n agents.\n\nThe two modes are mutually exclusive. See\n[Deploy your agent](https://www.assemblyai.com/docs/voice-agents/voice-agent-api/deploy) and\n[Inline session configuration](https://www.assemblyai.com/docs/voice-agents/voice-agent-api/session-configuration)\nfor details, or jump to the [Voice Agent API overview](https://www.assemblyai.com/docs/voice-agents/voice-agent-api)\nfor the full event flow and a runnable quickstart.\n","href":"/voice-agents/voice-agent-api/api-spec/voice-agent-websocket"},{"title":"Generate voice agent token","openapi":"api-reference/specs/voice-agent-token.yaml POST /v1/token","description":"Generate a temporary authentication token for the Voice Agent API. Use this to\nconnect browser or other client-side applications to the Voice Agent API without\nexposing your permanent API key. See\n[Browser integration](/voice-agents/voice-agent-api/browser-integration)\nfor the full flow.\n\nEach token is one-time use and can only be used for a single session. All usage\nis attributed to the API key that generated the token.\n","href":"/voice-agents/voice-agent-api/api-spec/generate-voice-agent-token"}]}]},{"tab":"Speech Understanding","pages":[{"title":"Speech Understanding","href":"/speech-understanding/getting-started"}]},{"tab":"Guardrails","pages":[{"title":"Guardrails","href":"/guardrails/getting-started"}]},{"tab":"LLM Gateway","pages":[{"title":"LLM Gateway","href":"/llm-gateway/quickstart"}]},{"tab":"FAQ","pages":[{"title":"FAQ","href":"/faq"}]}]},"basePath":"","title":"Build with AI coding tools - AssemblyAI","buildId":"dpl_Aw98ji4XvBsgtZwL1VrkUF9ehFqz","deploymentId":"dpl_Aw98ji4XvBsgtZwL1VrkUF9ehFqz","dynamics":["10e4515597"],"chunks":["BannerMarkdown-L4KFxIos.js","dist-B0ZV6X5T.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","clsx-B6IZIRsp.js","html-void-elements-mCSPHezU.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js"]}