This example shows how to use an AI Agent to listen to an incoming email and using tools to solve the task. If you’re not familiar with the concept of AI Agents, you can read our Inbound Call example to learn the basics of Agents, modules, AI nodes, etc.

In this case, we’re a car insurance company. We’ll be getting emails from customer that have had incidents in the road. The email will have the following tools available:

  • Send an email to the customer: Send an email to the customer.
  • Seach for repair shops: Search for repair shops in the area.
  • Make phone call: Make a phone call to the customer or the repair shop.

The agent will need to reason about the content of the email and follow a set of actions to solve the task.

Scenarios

Scenario 1: Missing information

If the email is missing information, the agent will need to send a reply asking for the missing information.

Scenario 2: Search and call

If the email contains all the information needed by the agent, the agent will proceed to (1) search for repair shops in the area, (2) call the shop to inform them of the incident and send a mobile technician to the scene and (3) send an email to the customer with the ETA of the technician.

About the workflow

The workflows listens for new emails. It will poll your gmail inbox every 15 minutes (configurable). It’ll then get the content of the email and start the reasoning process.

The agent’s prompt describes the task and the tools available. Note how we’re making an outbound call as part of the Make call tool call. This will block the execution of the tool sequence until the agent making the call is done, and the information is feed back to the reasoning agent for the next reasoning action.