Automate inbound calls with AI Agents
This example shows how to listen to inbound calls to a phone number and have an AI Agent handle the call.
The following image shows a typical workflow for an inbound call.
It all starts with a trigger that listens to inbound calls to a phone number. You can find this event in Phone calls > Inbound to number.
The To number field in the configuration defines what phone number you want to listen to. You can manage your phone numbers in your organization’s numbers settings. You can get there if you click on the organization’s name at the top of the left sidebar. Then, click on “Organization settings” to open the settings. Once there, go to the Number’s section on the sidebar. You can Buy a new number, rename existing numbers, or delete numbers.
You can also get to the numbers settings by opening the “To number” dropdown and clicking on the “numbers page” blue link at the bottom of the dropdown.
You can learn more about the other configuration options in the Inbound to number trigger reference page.
Once configured, make a call to the number and refetch the testing records in the Test tab.
After we get a new call, we want to have an AI Agent handle it. You can add an AI Agent > Inbound Voice Agent action right after the trigger.
Configure the agent with a name, voice, and other options. Learn more about the options in the Inbound Voice Agent reference page.
Remember to test it before continuing.
Every agent consists of what we call modules. A module consists of a prompt and tools. The agents come with a root module, which is the first module that the agent will start at. Tools are the actions that the agent can perform, such as sending an email, sending a text, or transfering a call.
If you add a prompt as child to a tool, you’re creating a new module. This means the agent will transition to that prompt and set of tools.
If the agent transitioned, it no longer sees the prompts or tools of the previous modules.
Modules are a good way to structure your agents and keep the prompts short and concise. This helps the agent to focus on the sub-task at hand.
You can define keyterms to help the AI agent more accurately interpret important terms during a call. This is especially helpful for things like email addresses, domain names, or other specific phrases.
This feature is available for inbound AI agents only.
To add keyterms:
Adding keyterms can help improve parameter extraction accuracy in tools and reduce common misinterpretations.
You can edit the prompt for the module by clicking on the prompt node and editing the text. You can of course use variables to make your prompt more dynamic.
You can also congure the prompt to define it’s initial message or model. The initial message is the first message that the agent will say when the module starts.
Following is an example of a prompt:
Note that we’re using variables in the prompt as well. Consider putting those towards the end of the prompt, as it might make the agent faster to respond.
See the prompting section for more details.
You can add tools to the module by clicking on the plus button below the prompt node.
Every tool consists of a tool node and a list of actions. The tool node is always the first action in the tool sequence.
When configuring the tool function, you’ll need to provide:
After the tool node, you can add a sequence of actions. These actions will be executed in order and are configured in the same way as actions outside of the agent.
The execution of the run will block until the agent has finished. After that, anything below the agent node will continue it’s execution.
After the call we add an AI > Classify node to classify the call. This node requires a prompt, an input and a set of tags.
After the classification, we add an AI > Extract node to extract information from the call. This node requires a prompt, an input and a set of tags.
After the extraction, you might want to send the extracted information to your system. You can do this by adding a Webhook > POST node.
This node will send a POST request to the URL you provide. You can configure the request by adding a URL, Body and Headers.
You can send back any variable, such as the transcript, the classification, or the extracted information.
Join the HappyRobot Slack Community