Skip to navigation

Build a Voice Agent

Build a conversational voice agent using Deepgram's Voice Agent WebSocket

HandshakeTry it

WSS
wss://agent.deepgram.com/v1/agent/converse

Authentication

AuthorizationToken

Use Authorization: Token <API_KEY> Example: Authorization: Token 12345abcdef

OR
AuthorizationBearer

Use Authorization: Bearer <JWT> Example: Authorization: Bearer eyJhbGciOiJ...

Headers

AuthorizationstringRequired

Use your API key or a temporary token for authentication via the Authorization header. In client-side environments where custom headers are not supported, use the Sec-WebSocket-Protocol header instead.

Example: Authorization: Token %DEEPGRAM_API_KEY% or Authorization: Bearer %DEEPGRAM_TOKEN%

Send

AgentV1SettingsobjectRequired
Configure the voice agent and sets the input and output audio formats
OR
AgentV1UpdateListenobjectRequired

Send a message to update the Listen configuration on the fly during a conversation. The payload uses the same shape as agent.listen in the Settings message — model, language, and the other tunable fields live under listen.provider.

OR
AgentV1UpdateThinkobjectRequired
Send a message to change the Think model in the middle of a conversation
OR
AgentV1UpdateThinkLiveobjectRequired

Change the Think Live model configuration in the middle of a conversation. Replaces the entire think_live.provider block, so include every parameter you want in effect; omitted parameters revert to their defaults. Does not affect the reasoning LLM (use UpdateThink for that). The server confirms with ThinkLiveUpdated

OR
AgentV1UpdateSpeakobjectRequired
Send a message to change the Speak model in the middle of a conversation
OR
AgentV1InjectUserMessageobjectRequired
Send a text based message to the agent
OR
AgentV1InjectAgentMessageobjectRequired
Immediately trigger an agent response during a conversation
OR
AgentV1InjectDynamicAgentMessageobjectRequired

Requires agent.think_live. Ask the Think Live model to generate a short filler line instead of speaking a fixed message. Each request produces one filler; another request during the same wait escalates the wording. If filler cannot be generated, nothing is spoken and the server sends a DYNAMIC_FILLER_UNAVAILABLE warning

OR
AgentV1SendFunctionCallResponseobjectRequired

Send a function call response from the client to the server after executing a client-side function call. This is used when the server requests execution of a function marked with client_side: true.

OR
AgentV1KeepAliveobjectRequired
Send a control message to the agent
OR
AgentV1UpdatePromptobjectRequired
Send a message to update the system prompt of the agent
OR
AgentV1ForceEndTurnobjectRequired

End the current user turn immediately, without waiting for end-of-turn detection. Requires a Deepgram V2 (Flux) listen provider; with any other listen provider the server sends a FORCE_END_TURN_UNSUPPORTED warning and the turn does not end.

OR
AgentV1CustomToThinkProviderobjectRequired

Experimental. Send an arbitrary JSON payload to your custom think provider. Deepgram does not validate the content and forwards it to the provider unchanged. Requires a wss:// custom Think endpoint in agent.think.endpoint.url. The provider’s response arrives as a __customFromThinkProvider message.

OR
AgentV1MediastringRequiredformat: "binary"
Raw binary audio data sent to the Voice Agent for processing

Receive

AgentV1ListenUpdatedobjectRequired
Confirms that an UpdateListen message from the client has been applied
OR
AgentV1ThinkUpdatedobjectRequired
Confirms that an UpdateThink message from the client has been applied
OR
AgentV1ThinkLiveUpdatedobjectRequired

Confirms that an UpdateThink_Live message from the client has been applied

OR
AgentV1FrustrationDetectedobjectRequired

Sent when the Think Live model detects frustration in a user turn (negative valence, high arousal, or frustrated intent). Treat escalated: true as the trigger for your own escalation workflow; Deepgram does not transfer the call. Not sent when agent.think_live.provider.frustration_max_count is 0

OR
AgentV1ReceiveFunctionCallResponseobjectRequired

Receive a function call response from the server after the server has executed a server-side function call internally. This occurs when functions are marked with client_side: false.

OR
AgentV1PromptUpdatedobjectRequired
Confirms that an UpdatePrompt message from the client has been applied
OR
AgentV1SpeakUpdatedobjectRequired
Confirms that an UpdateSpeak message from the client has been applied
OR
AgentV1InjectionRefusedobjectRequired
Receive injection refused message
OR
AgentV1WelcomeobjectRequired
Confirms that the WebSocket connection has been successfully opened
OR
AgentV1SettingsAppliedobjectRequired
Confirm the server has successfully received and applied the Settings message
OR
AgentV1ConversationTextobjectRequired

Facilitate real-time communication by relaying spoken statements from both the user and the assistant

OR
AgentV1UserStartedSpeakingobjectRequired
Notify the client that the user has begun speaking
OR
AgentV1AgentThinkingobjectRequired
Inform the client when the agent is processing information
OR
AgentV1LatencyReportobjectRequired
Detailed latency breakdown across the STT, LLM, and TTS pipeline, emitted by the server after a turn. All latency fields are floats in seconds and are optional, so they are omitted when not applicable to that turn.
OR
AgentV1FunctionCallRequestobjectRequired

Client-side or server-side function call request sent by the server

OR
AgentV1FunctionCallCancelledobjectRequired

Sent when a client-side function call the server already sent you is cancelled because the user started speaking again, either inside the speculative window (the turn resumed) or after the turn was confirmed (barge-in). Only calls the client already received are announced

OR
AgentV1AgentStartedSpeakingobjectRequired
Get notified when the server begins streaming an agent's audio response for playback. This message is only sent when the experimental flag is enabled
OR
AgentV1AgentAudioDoneobjectRequired
Get signals that the server has finished sending the final audio segment to the client
OR
AgentV1CustomFromThinkProviderobjectRequired

Experimental. Receive the response body from your custom think provider after sending a __customToThinkProvider message. Deepgram passes the response through unchanged. Requires a wss:// custom Think endpoint in agent.think.endpoint.url.

OR
AgentV1ErrorobjectRequired
Receive an error message from the server when an error occurs
OR
AgentV1WarningobjectRequired

Notifies the client of non-fatal errors or warnings

OR
AgentV1HistoryobjectRequired

Conversation history message emitted by the server during a session. Each message is either a conversation text message or a function call message. These messages can be supplied in settings of a subsequent Voice Agent session (via the agent.context.messages field) to allow the agent to maintain awareness of prior interactions.

OR
AgentV1AudiostringRequiredformat: "binary"
Raw binary audio data generated by the Voice Agent and sent to the client