String return
You can return a simple string, which will be used as the system prompt for the virtual agent:Dictionary return
Alternatively, you can return a dictionary to specify more detailed and deterministic instructions. The following fields can be used individually or in combination:content
Equivalent to returning a string, this field specifies the system prompt:
utterance
Specifies the exact phrase the virtual agent will deliver after executing the function (spoken for voice, displayed for webchat):
content and utterance are returned:
- The agent will stream the
utteranceto the user and end the turn. - The
contentrules will apply to the next turn.
handoff
Initiates a call handoff after the function executes. This follows the format of a handoff object:
invite
Hands the call off using a SIP INVITE. Configuration fields depend on project telephony integration requirements:
hangup
Ends the conversation after the function executes. For voice, this disconnects the call; for webchat, this closes the session:
listen Return Object
Configures the agent to listen on the next turn.
ASR timeout doesn’t apply to DTMF-only input. If using both channels, make sure you include an
utterance so the ASR settings take effect.
