Endpoint
Request Body
The phone number to call in E.164 format (e.g.,
+1234567890).Custom system instruction for the AI agent. If not provided, uses the default prompt from
config.yaml or a fallback prompt.Default: "You are a helpful AI assistant making a phone call."Base URL for webhook callbacks (e.g.,
https://your-ngrok-url.ngrok.io). If not provided, uses the AGENTICAI_WEBHOOK_URL or NGROK_URL environment variable.The server will append /twilio/voice and /twilio/status to this base URL for Twilio webhooks.Optional metadata object to store with the call session. Can include any custom fields for tracking or context.Default:
{}Response
Indicates whether the call was successfully initiated.
Unique identifier for the call. Use this ID with other API endpoints to manage the call.
The phone number that was called (echoed from request).
The webhook base URL used for this call.
Error message if
success is false.Examples
Basic Call
Call with Custom Prompt
Call with Metadata
Error Responses
Missing Phone Number
Missing Webhook URL
Twilio Error
Implementation Details
The endpoint performs the following steps:- Validates the
tophone number is provided - Resolves the
webhook_urlfrom request body or environment variables - Uses the custom
promptor falls back to the default from config - Generates a unique
call_id(UUID v4) - Creates a
CallSessionto track the call state - Initiates the call via Twilio REST API
- Stores the session in the
CallManager - Returns the call details to the caller
The call is initiated asynchronously. The endpoint returns immediately after Twilio accepts the call request. Use the List Calls endpoint to monitor the call status.
Source Code Reference
Implementation:src/agenticai/server/app.py:176-234
Next Steps
List Active Calls
Monitor the call you just initiated
End a Call
Programmatically end the call