Creating Calls with Agents (Recommended)
For all new projects, use agents to create calls. This approach provides consistency, reusability, and easier maintenance.Basic Agent Call
Start a call using an existing agent and pass in any template variables:Example: Create a New Agent Call
Template Context and Variables
Provide dynamic data to your agent at call creation time:Example: Template Context Variables
Overriding Agent Settings
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 | Example |
---|---|---|---|
templateContext | Variables for template substitution | Object | { customerName: "John" } |
initialMessages | Conversation history to start from | Array | Previous chat context |
metadata | Key-value pairs for tracking | Object | { source: "website" } |
medium | Communication protocol | Object | { twilio: {} } . |
joinTimeout | Time limit for user to join | String | "60s" |
maxDuration | Maximum call length | String | "1800s" |
recordingEnabled . | Whether to record audio | Boolean | true / false |
initialOutputMedium | Start with voice or text | String | "voice" / "text" |
firstSpeakerSettings | Initial conversation behavior | Object | { agent: { text: "..." } } |
experimentalSettings | Experimental settings for the call | Object | Varies |
Example: Overriding Agent Settings
Direct Call Alternative
For legacy integration, testing, or very simple use cases, you can create calls directly without agents:Prior Call Inheritance
You can reuse the same properties (including message history) from a prior call by passing in a query param:Example: Using Prior Call ID
When using
priorCallId
, the new call inherits all properties from the prior call unless explicitly overridden. The prior call’s message history becomes the new call’s initialMessages
.