Understanding Agents
Agents provide a way to define voice assistants that can be reused across multiple calls, ensuring consistent behavior and capabilities. This enables you to maintain a cohesive user experience with minimal configuration overhead at call creation time. Each agent includes a call template that defines system prompts, voice settings, available tools, and more. Key benefits of using Agents: Reusable Configuration → Create a single agent definition and use it for multiple calls without repeating configuration settings. Consistent Experience → Ensure your voice experience maintains the same personality, capabilities, and behavior across all interactions. Version Control → Update an agent’s configuration in one place and have changes apply to all future calls. Simplified Deployment → Reduce the complexity of starting calls by referencing an existing agent instead of providing all configuration details.Time-Saving FeatureAgents are ideal for production applications where you want consistent behavior across multiple user interactions.
Creating and Managing Agents
To implement Agents in your Ultravox application, follow these steps:Plan Your Agent
Define the agent’s purpose, personality, and capabilities. Consider what system prompt, voice, and tools it should have.
Create the Agent
Use the Create Agent API to create a new agent with a name and call template that specifies:
- System prompt that defines the agent’s personality and knowledge
- Voice settings (voice ID, language, etc.)
- Available tools the agent can use
- Other call settings like timeout values, inactivity messages, etc.
Use the Agent for Calls
When starting a new call, use the Create Agent Call API and reference the agent ID instead of providing all call settings individually.You can optionally override specific settings for individual calls while keeping the agent’s base configuration.
Update as Needed
Modify your agent’s configuration over time using the Update Agent API as requirements change, ensuring all future calls use the updated settings.
Example Agent Creation
Here’s a basic example of how to create an agent using the Ultravox API:Example: Creating a New Customer Support Agent
Mono Prompts and Call Templates
When you start building your agent, we recommend you start with a simple mono prompt and then add complexity if and when needed. If mono prompting isn’t working for your use case (i.e. you are building something complicated), you may need to use what we call “inline instructions” which allow you to provide reminders to the model and help steer the agent in the right direction. Please see Guiding Agents. If you are building an application with completely distinct, unrelated stages where there is no overlap, please see the Call Stages guide.Starting a Call with an Agent
Once you’ve created an agent, you can start a call using the agent ID:Example: Starting a Call with an Agent
Overriding Agent Call Parameters
When starting a call with an agent, you can override specific settings from the agent’s call template. Here are the parameters you can include in the request body:| Parameter | Description | Type |
|---|---|---|
| templateContext | Context for filling any mustache templates for the call | Object |
| initialMessages | The conversation history to start from for this call | Array |
| metadata | Optional metadata key-value pairs to associate with the call | Object |
| medium | The overridden medium used for this call (WebRTC, Twilio, etc.) | Object |
| joinTimeout | The overridden timeout for joining this call | String (e.g., ”60s”) |
| maxDuration | The overridden maximum duration of this call | String (e.g., “1800s”) |
| recordingEnabled | The overridden setting for whether the call should be recorded | Boolean |
| initialOutputMedium | The overridden medium initially used by the agent (voice/text) | String |
| firstSpeakerSettings | The overridden settings for the initial conversation message | Object |
| experimentalSettings | Experimental settings for the call | Object |