Make an agent a voice agent
In the agent builder, click the microphone on the Input card (it opens Settings → Voice → Listen) or on the Output card (Voice → Speak), and turn on Voice agent. The same Voice tab is in the Settings menu beside Runtime and Model, and one Save keeps all three.
Voice is set per agent version. Both deployments must be in the agent’s project and running;
the panel names the field it refuses, and warns (without refusing) when a deployment is not running
yet or its voice list cannot be read.
Connect
Use this agent on the agent’s page shows both addresses below for a version with voice on, with Python and browser snippets.OpenAI Realtime clients — /v1/realtime
Authorization header; a browser sends it as the WebSocket subprotocol
openai-insecure-api-key.<key> beside realtime. Audio is PCM16, 24 kHz, mono, both ways.
The session behaves like an OpenAI Realtime session: send input_audio_buffer.append; the gateway
detects the end of each turn and answers. You will see input_audio_buffer.speech_started /
speech_stopped, conversation.item.input_audio_transcription.completed, response.created,
response.output_audio.delta, response.output_audio_transcript.delta, and response.done.
A tool the agent calls appears as an mcp_call output item (response.mcp_call.in_progress →
completed / failed).
You may also type: conversation.item.create with an input_text message, then response.create.
Typed and spoken turns share one conversation.
Voice pipeline sessions — /ws
The voice pipeline WebSocket takes an agent in place of
conversation_config:
agent_response_started, agent_response_created,
assistant_transcript, agent_tool, agent_output (an agent with structured output),
agent_response_done, agent_truncated and agent_error (interaction mode
replaces them with task events). Send {"type": "agent_input", "text": "..."} to type a turn, and {"type": "truncate", "audio_end_ms": 1234} when your player stopped
early.
What the caller can change
The agent owns its prompt, tools, deployments and instructions. A session may change only what the agent’s author allowed under Callers may change, when it starts: in the firstsession.update
on /v1/realtime, sent as soon as the socket opens (a session that hears nothing starts with the
agent’s own settings 600 ms after connecting), or in the config message on /ws:
A setting the agent does not let callers change keeps the agent’s value.
/v1/realtime says so with
an event_not_allowed error naming the field (invalid_value for an unknown eagerness); /ws with a
config_warning (deployment_setting_not_applied) whose message names the setting. Eagerness applies to an agent with semantic turn taking: a manual or silence agent
keeps its own, and an agent never starts answering before the turn ends, whatever eager asks.
Everything else is refused with event_not_allowed and the session continues: instructions,
tools, response.instructions, another prompt id or version, an api_key or a model for either
leg.
Interruptions and history
When the caller talks over the agent, the gateway stops the speech at once, cancels the agent’s run, and remembers only what the caller heard: the next turn’s history holds the spoken part of the interrupted answer followed by[interrupted], never the unheard rest. A GA client that tracks its
own playback can make this exact with conversation.item.truncate (audio_end_ms); the gateway
answers conversation.item.truncated either way.
Interaction mode
In interaction mode the gateway keeps the conversation going while the agent works. When the caller finishes a request, they hear a short acknowledgement at once (“Sure, let me check.”), progress lines while a long run goes on, and then the agent’s answer, word for word: the gateway never rewords or adds to what the agent says. The gateway also answers small talk and clarifying questions itself, without starting an agent run, and tells a caller’s “mm-hm” from a real interruption, so a short backchannel does not cut the agent off. Turn it on in the agent’s Settings → Voice → Turn taking with Interaction mode. It is set per agent version, like the rest of the voice block. While it is on, the settings it replaces are hidden: fillers, the tool tone, the interruption word count and the silence hang-up. Your values are kept and come back when you turn it off. Where the platform cannot run the mode, the toggle is shown disabled with the reason. Callers cannot turn it on or off themselves. What changes for the caller and the client:- One run at a time. Each request becomes one run of the agent. A request made while a run works is queued, and a correction restarts the run.
- The answer starts before the run ends. On voice calls in this mode the agent is told to begin its final answer with a short marker line. The gateway speaks what follows it sentence by sentence while the agent is still writing, and never speaks the text before it (drafts written between tool calls). An answer without the marker is spoken whole when the run completes.
- Interruptions stop the speech, not the run. The agent’s next run is told how much of the answer the caller heard.
- Approvals. A tool call that needs a person’s approval is not made. The caller hears that it needs someone’s approval first.
- English only. A session in another language runs without the mode.
- When it can’t run. If the mode is on but the gateway can’t run it for this session, the session runs as a plain voice agent and the client gets one warning (below).
Events on /ws
When the mode is on, ready carries "protocol_version": "1.1" and an interaction object with the
session’s settings. Without it, protocol_version is "1.0". The task events replace
agent_response_started, agent_response_created, agent_tool, agent_output,
agent_response_done, agent_truncated and agent_error:
Every
task_* event carries task_id. assistant_transcript gains:
source:front(the gateway’s own line: an acknowledgement, a progress line),background(the agent’s answer) orgateway.kind: what the line is, such asack,answer,progressorquestion.task_id: the request the line belongs to, when it has one.
agent_input still types a turn. truncate does not apply: the gateway measures what the caller
heard.
Events on /v1/realtime
The same events arrive with bud.* names: bud.interaction.state once the session has started (the
interaction settings), bud.task.created, bud.task.progress, bud.task.question,
bud.task.output, bud.task.result, bud.task.cancelled, and bud.audio.stopped. Each line the
agent says is one response, and its metadata.bud_source, bud_kind and bud_task_id say who spoke
it and why.
Cut playback on bud.audio.stopped, not on every input_audio_buffer.speech_started. In this mode
the gateway decides when the caller has really interrupted. A cut line ends with response.done status
cancelled, after bud.audio.stopped and a conversation.item.truncated.
When the mode is not available
A session whose agent has the mode on, but where the gateway can’t run it right now, runs without it and gets one warning:config_warning on /ws, bud.warning on /v1/realtime, with code
interaction_refused and detail.reason:
Analytics
On the agent’s Logs page, a voice session in interaction mode shows its caller turns and how many were answered without the agent. It also shows two latencies, both medians from the end of the caller’s turn: acknowledgement (the first reply the caller hears) and answer (the first sentence of the agent’s answer). Spoken characters are split between the gateway’s own lines and the agent’s answers. Each turn’s record shows what was done with it (sent to the agent, small talk, a clarifying question …) and its latencies.Errors
Limits
- One agent turn at a time per session; a new turn interrupts the previous one.
- An agent that needs a human approval mid-turn speaks its approval message instead of acting (in interaction mode the caller hears that it needs someone’s approval first).
- Turns are traced: each is the root of its own trace, continued by the gateway and the agent run, and the speech legs are metered and priced as their deployments.