An AI agent with tools: how it chooses what to look up and what it may send
Tools turn an AI agent from a talker into a worker. How linked blocks become tools, how the agent fills their settings, and why anything it sends waits for the run.
Part of the guide AI employees
An AI agent with tools is an AI that can do more than write: for each message it decides which of the actions you gave it to use, uses them, reads what comes back and then answers. In xMap Flows a tool is simply another block linked to the purple Tools dot under the AI agent: a data search, one of your tables, another flow, or an app such as Google Sheets. The agent calls a tool only when a message needs it, with the settings you chose, and the blocks that send something never send while it is still thinking.
This article explains how that works in practice, so you can decide which tools to give an agent, which settings to leave to it, and how to keep its sends under control. For the general idea of an agent, see the glossary entry on the AI agent.
What a tool is, in the editor
Drag from the Tools dot to any block and it becomes that agent's tool. A tool block has no other links in or out, and belongs to one agent. Its settings are set as usual: Nearby places with its types and distance, Traffic incidents with its search area, Weather forecast with its days. Name each tool block plainly, such as Tool: road closures or Tool: our depots, because the agent reads those names when it chooses.
The agent's Most tool calls caps how many tools it may use for one message before it must answer. A low number keeps replies quick; a higher one lets it look something up in two or three ways.
Letting the agent fill a setting
Most settings should stay fixed. The few that change with each question are written as {{agent}}, or better {{agent: what to put}}, which tells the agent what belongs there. Common ones:
- The point a search starts from: {{agent: the place the driver names}}. A place name is looked up for you, so the agent can pass Sandton rather than coordinates.
- Search words or a type of place, when people ask about many kinds.
- The days of a forecast, when people ask about a date.
Leave out {{agent}} anywhere you want a firm rule. If the distance must always be 2 km, write 2 km; the agent cannot change it.
Tools that send
Some tools act rather than read: an email, a row added to a sheet, a message in an app. These are never run during the agent's thinking. In a real run that sends, what the agent decided to send is queued and goes out with the run's other sends, once. In a test run the step says what would have been sent and sends nothing. An Approval linked after the agent holds those sends until a person says yes; the reply to the person who wrote is not held.
Two more rules keep things predictable. A Run another flow tool only runs a flow that sends nothing itself, so a quick question can never trigger another flow's emails. To have an agent hand work to AI employees that do send, use its Give work to setting instead, whose sends also wait until the agent has finished.
A worked example (made up)
A courier firm in Johannesburg wants its drivers to ask a chat is the M1 clear towards Sandton? and get a two-line answer. The flow:
- A Chat block, shared with the drivers as a link.
- An AI agent: You help our drivers. Answer in two lines with what matters for their next drop. Most tool calls: 3.
- Tool: Traffic incidents set to Around a point, its centre written as {{agent: the road or suburb the driver names}}.
- Tool: Weather forecast for today, its point filled by the agent.
- Tool: Nearby places for fuel stations, 2 km around {{agent: where the driver is}}.
- Reply with {{reply}}.
A driver asks about the M1. The agent calls the incidents tool with the road, finds a lane closure near an interchange, skips the weather because it was not asked, and replies with the closure and a suggestion to leave the highway one exit early. In the run, See how it answered shows the one tool call, what it was given and the closure it returned.
Mistakes to avoid
- Too many tools. Ten loosely named tools make choices slower and worse. Give each agent the three to five it really needs.
- {{agent}} everywhere. Every setting left open is a setting the AI can get wrong. Open only what changes per question.
- Vague instructions. Say when to use which tool: check closures before suggesting a route.
- Sending tools on a public page with no approval. Visitors can steer what an agent sends. Put an Approval after it.
- Expecting tools to set rules. What a tool returns is read as information, never as orders, so a page or a record cannot redirect the agent. Rules belong in the instructions.
Cost and limits
Each thinking step costs what an AI agent step costs, and each tool call costs what that block costs in any flow. The agent stops calling tools when the run's credits would not pay for more, and answers with what it has. The ready-made road and weather chat for drivers follows the shape above; chat about places near anyone is the simplest version with one tool.
Questions
Which blocks can be tools?
Almost any block: data searches, your tables and database, xMap AI blocks, apps and other flows. Triggers cannot, and Reply cannot be a tool.
Can the agent change a tool's settings?
Only the ones you wrote as {{agent}} or {{agent: what to put}}. Everything else stays as you set it.
Will a test run send the emails a tool would send?
No. A test run says what would have been sent. Only Run once and live runs that send for real send them, once, after the agent has finished.
How do I see which tools it used?
Open the run and press See how it answered beside the agent: each tool call is listed with what it was given and what came back.
Templates that do this
Read next
More on ai employees and automation · Every article · Templates