Configure the Voice Agent
Learn about the voice agent configuration options for the agent, and both input and output audio.
You will need to migrate to the new Voice Agent API V1 to continue to use the Voice Agent API. Please refer to the Voice Agent API Migration Guide for more information.
To configure your Voice Agent, you’ll need to send a Settings message immediately after connection. This message configures the agent’s behavior, input/output audio formats, and various provider settings.
For more information on the Settings
message, see the Voice Agent API Reference
Settings Overview
The Settings
message is a JSON object that contains the following fields:
Settings
Audio
Agent
agent.language
- Choose your language setting based on your use case:
- If you know your input language, specify it directly for the best recognition accuracy.
- If you expect multiple languages or are unsure, use
multi
for flexible language support. - Currently
multi
is only supported with Eleven Labs TTS. - Refer to our supported languages to ensure you’re using the correct model (Nova-2 or Nova-3) for your selected language.
agent.think.context_length
- Using
max
will set the context length to the maximum allowed based on the LLM provider you use. If the total context exceeds the model’s maximum, truncation is handled by the LLM provider. - Increasing the context length may help preserve multi-turn conversation history, especially when verbose function calls inflate the total context.
- All characters sent to the LLM count toward the context limit, including fully serialized JSON messages, function call arguments, and responses. System messages are excluded and managed separately via
agent.think.prompt
. - The default context length set by Deepgram is optimized for cost and latency. It is not recommended to change this setting unless there’s a clear need.
agent.context
- The
agent.context
object allows you to provide conversation history to the agent when starting a new session. This is useful for continuing conversations or providing background context. - The
agent.context.messages
array contains conversation history entries, which can be either conversational messages or function calls. - Conversational messages have the format:
{"type": "History", "role": "user" | "assistant", "content": "message text"}
- Function call messages have the format:
{"type": "History", "function_calls": [{"id": "unique_id", "name": "function_name", "client_side": true/false, "arguments": "json_string", "response": "response_text"}]}
- Use this feature to maintain conversation continuity across sessions or to provide the agent with relevant background information.
- To disable function call history, set
settings.flags.history
tofalse
in theSettings
message.
Full Example
Below is an in-depth example showing all the available fields for Settings
with all the optional fields for individual provider specific settings.
JSON