Skip to main content
Functions let your agent call APIs, look up data, or perform logic when a Managed Topic matches. This page shows how to add a function to a topic and test it.

Adding a function

After creating and testing your function, integrate it into your agent’s Managed Topics so it can be invoked during conversations. You can add a function in three ways:
  1. Type / in the Actions field of a Managed Topic card to open the function menu.
  2. Right-click in the Actions field to access the function menu.
  3. Click the + icon on the right side of the Actions field.
Each method lets you search for and select a function, or create a new one to populate later. You can reuse the same function across multiple topics and actions.
Function references like {"{{fn:order_lookup}}"} are only valid in the Actions field of a Managed Topic. Placing them in the Content field will not trigger the function, and no error is shown. Always add function references in Actions.
The {"{{fn:...}}"} syntax references global functions, which can be used across topics, flows, and rules. This is different from transition functions ({"{{ft:...}}"} syntax), which are scoped to a single flow. See Transition functions for details.

Best practices

Function invocation requires testing and iteration. Here is a recommended prompting pattern for the Actions field:
When the user asks "where is my order," do not respond until you have called {{fn:order_lookup}} with an order number. If you don't have the order number, ask for it first, then call {{fn:order_lookup}}. Use the function's response to answer the caller.
This ensures the agent always invokes the function before responding, and grounds its answer in the function’s output. To control what the agent says or does after a function runs, use return values. For example, you can return an exact utterance for the agent to speak, trigger a handoff, or end the call with hangup.

Testing

1

Save your agent

Save your agent and click Play in the header to open the test chat panel.
2

Test the invocation

Ask a test question like “Where is my order?” and observe how the agent handles the interaction.
3

Verify function calls

In the test chat panel, enable the tool calls toggle in settings to inspect which functions were called and what parameters were passed. This is useful for confirming whether the function was actually triggered and whether the correct arguments were sent — especially when the agent is not behaving as expected.
Last modified on March 24, 2026