Agent Script Reference: Utils

Utils are utility functions that can be used as tools, for example transition to topics, run actions, or instruct the LLM to set variable values based on a customer's utterance.

Tells the agent to move to a different topic.

Transitions are one-way; there's no return of control to the calling topic. transition to executes immediately when encountered. The execution of the current directive block is halted, and control is passed to the new topic.

You can signal a hand off immediately after an action completes by including transition logic in the actions: block. However, this may not occur until all actions are run.

This code sample provides multiple transitions for order management, user verification, and answering common questions. Because these particular transitions are specified from within the reasoning actions, they can be executed by the reasoning engine when applicable. See Tools (Reasoning Actions).

You can also transition to a topic from your reasoning instructions. This sample transitions based on a variable state.

When the specified topic has completed, the flow of control doesn't return to the original topic, so you must explicitly create a transition back to the original topic if that's what you want. When transitioning back to a topic, the flow starts at the beginning of the topic, not where it last left off.

Tells the agent to define a variable based on the natural language description. The token instructs the LLM to set the value of the variable.

The description instructs the LLM on how to set the value of the variable.

Tells the agent to escalate to a human service rep. To use utils.escalate, you need an active Omni-Channel connection. This must be defined in a connection messaging block with outbound_route_type and outbound_route_name values. See Agent Script Connection Block and Transfer Conversations from an Agent with an Omni-Channel Flow. The escalate utility function can be used instead of an escalation topic.

escalate is a reserved keyword and can't be used for topic or action names.