on_connected. It is a custom lifecycle function, not a predefined function such as transfer, end, or booking.
Key points:
- A global On-Connected function runs once after the call connects.
- A capability- or node-scoped On-Connected function runs when that capability or node is entered.
- The runtime invokes it automatically. The voice agent does not select it, and no customer intent or function description triggers it.
- Its return value is ignored. Use it for side effects, not for information that the conversation needs to consume.
- It receives call metadata, including the same metadata variables available to the call.
Supported agent version types
On-Connected functions are supported by every voice-agent version type.
If the same behavior is needed globally and in a capability or node, create a separate function entry in each scope.
Basic vs Advanced On-Connected
The function mode is independent of the agent version type. For example, a Basic agent version can use an Advanced On-Connected function.Basic On-Connected
Use Basic mode for a direct HTTP request. Configure:- function name and description
- API URL
- method:
GET,POST,PUT, orDELETE - request parameters
- headers
Advanced On-Connected
Use Advanced mode for custom Python side effects, including logging, conditional logic, or multiple API operations. The function must use this signature:ctx.room, ctx.proc.userdata, or ctx.api when runtime context is required. ctx.session, ctx.userdata, and RunContext are not available. Use saved secret references such as x_secrets["crm-api-key"] instead of hardcoded credentials.