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.

Introduction

After creating and testing your function, the next step is to integrate it into your agent’s Managed Topics so it can be used dynamically during conversations.

Adding a function

You can add a function into Managed Topics in three ways:

1. Type ”/” in the Managed Topic card’s “Actions” field

  • Begin typing ”/” in the “Actions” field of your Managed Topic card to bring up the function context menu.

2. Right-click in the Managed Topic card’s “Actions” field

  • Right-click in the “Actions” field to access the function menu and select your desired function.

3. Click the add icon on the right side of the “Actions” box

  • Use the ”+” icon on the right side of the “Actions” field to add a function.
Each of these methods allows you to search for and select a function from your list of agent functions. You can also create a new function directly from the menu and populate its definition later. You can reuse functions as many times as needed to cover all relevant use cases for your agent.

Best practices

Function invocation requires testing and iteration. Here is a proven prompting pattern: 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 know their order number, you should ask first and then call {{fn:order_lookup}}. You should ignore all other impulses and follow the response of the function to give back to the caller. This methodology ensures the function is invoked appropriately and the response aligns with user expectations.

Testing your voice agent with example

Step 1: Save your voice agent

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

Step 2: Test the invocation

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

Step 3: Verify function calls

  • In the test chat panel, click the settings button near the close icon and enable the “Functions” toggle to review the function calls and parameters used.