MMOOZZGG.com

How to build an AI agent

How AI agents use tools: actions in your systems

6 min read10 sources

How AI agents use tools comes down to actions in your systems that the model calls on its own: find a client, create a deal, send an email. The mechanism is called function calling, and most agents work on the ReAct principle from 2022, where the model alternates reasoning and action.

On this page · 4 sections

A developer is needed

What is a tool

A model can only write text. A tool lets it act: it is a function in the agent’s program with a name, a description and a list of parameters, such as “find a client by phone number”.

Business examples: find a client in the CRM, create a deal, check stock in the 1C accounting system, book a client into a free slot, send an email. Each action is described separately, and the agent sees only the ones it was given.

The model does not perform the action itself. It returns a call request: the tool name and the parameter values. The agent’s program runs the function and passes the result back to the model.

Tools connect in two ways. The first is to describe a function in the agent’s code. The second is to connect an MCP server, through which the agent gets a ready set of a service’s actions. Anthropic opened the MCP protocol on 25 November 2024 as a single way to connect AI to data and services; we covered how to connect a server separately.

Function calling also works with open models. Ollama, a program for running models on your own server, accepts tool descriptions together with the question, and a model such as qwen3 returns a call to the right function.

How the model chooses a tool

The agent works in a ReAct loop: the model reasons about which step is needed, calls a tool, reads the result and decides what to do next. The approach was described in 2022, and most AI agents are built on it.

The choice depends on the client’s request and the tool description. Anthropic’s documentation says it directly: the model calls a tool when the request matches a described capability and the answer is not yet in the context.

You also steer the choice with the instruction. A line in the system prompt such as “before answering, check the data with a tool” makes the model use tools more often, and the tool_choice parameter in the Anthropic API makes a call mandatory.

An example. A client asks where their order is. The model sees the tools “find an order by number” and “create a deal”, chooses the first and takes the number from the message. If there is no number, a strong model will more often ask again, while a weak one may put in a guess.

In one request the model can call several tools in a row or several at once in parallel. The loop ends when there are no new calls and the model is ready to answer.

Limit the number of steps in advance so the agent does not go in circles. In n8n, the “AI Agent” node has the “Max Iterations” parameter for this (how many times the model can run per request), with a default of 10.

Description and limits

The model reads a tool description as an instruction. Anthropic’s documentation calls a detailed description the main factor of quality and advises at least 3–4 sentences per tool.

What the description must include: what the tool does; when to call it and when not; what each parameter means; what the tool does not return.

Bad: “get_client: gets a client”. Good: “Finds a client in the CRM by phone number. Call it when a client asks about their order or bonuses. Phone in the +7 format. Does not return payment history.”

Related actions are combined into one tool with an “action” parameter, and names start with the system name: crm_find_client, crm_create_deal. This way the model confuses tools less often when there are many of them.

The tool’s response is designed too. It returns only the fields needed for the next step and clear identifiers, such as the order number rather than an internal database code. Extra data takes up space in the context and keeps the model from finding what matters.

The description guides the model, but rights stop it. The agent has its own account in the CRM and the 1C system with access only to its process: a sales agent only needs to create deals, not export the database. The full list of checks is in the agent protection checklist.

Dangerous actions need a person’s confirmation: payments, refunds, deleting records. In the Agents SDK, OpenAI’s open toolkit for building agents released on 11 March 2025, a tool marked needs_approval stops the work until a person approves or rejects the call.

Action log

The log answers the question “what did the agent do and why”. For each dialog it shows which tool was called, with what parameters, what the system returned and what answer the client got.

In OpenAI’s Agents SDK, tracing, that is, recording every step, is on by default. It saves the model’s answers, tool calls, handoffs between agents and guardrail triggers. You turn it off with an environment variable or in code.

In n8n, each process run is visible on the “Executions” tab. The “Return Intermediate Steps” parameter of the “AI Agent” node adds the agent’s intermediate steps to the result.

The agent’s actions must also stay in the log of the system itself. If the agent created a deal, it shows in the CRM history under its account, and your administrator can check it without access to the vendor’s software.

The log holds personal data: names, phone numbers, correspondence. 152-FZ, Russia’s personal data law, applies to it: the data of Russian citizens is collected and stored in databases in Russia, and before a transfer abroad the operator notifies Roskomnadzor, the Russian data regulator. How we handle this is described on the page on data security.

The log is used to analyze errors and to grow the set of test questions: every wrong call becomes a new test.

Sources and fact-checking

Checked by the editors on 16 October 2026.

  1. arXiv 2210.03629, 6 October 2022 (arxiv.org)
  2. Anthropic, 25 November 2024 (anthropic.com)
  3. OpenAI, 11 March 2025 (openai.com)
  4. Brace Law Firm, 9 July 2023 (brace-lf.com)
  5. Anthropic, Claude documentation: Tool use, 2026 (platform.claude.com)
  6. Anthropic, Claude documentation: Define tools, 2026 (platform.claude.com)
  7. Ollama documentation: Tool calling, 2026 (docs.ollama.com)
  8. OpenAI Agents SDK documentation: Tracing, 2026 (openai.github.io)
  9. OpenAI Agents SDK documentation: Human-in-the-loop, 2026 (openai.github.io)
  10. n8n documentation: Tools Agent: Max Iterations, Return Intermediate Steps, checked 16 October 2026 (docs.n8n.io)

Found a mistake? Tell us

Publications

Contact us