GuidesAI agents

Tool use: how an AI acts in your systems

By the Banzai Labs teamUpdated on 2 min read

get_order(4521)The tool callYour systemThe resultThe model asks, your code executes
The model requests a tool, your code runs it and hands back the result.

The loop

The model asks, your code executes
  1. DescriptionName, role and parameters of each tool.
  2. RequestThe model returns a structured call.
  3. ExecutionYour code checks, then runs it.
  4. ResultSent back to the model, which answers or calls again.

An example

The user asks: “Where is my order 4521?”. The model does not know the order. It returns a get_order call with order_id: 4521. Your code reads the database, returns the status, and the model writes the answer.

Safety rules

  • Check parametersThe model proposes, the code validates: type, format, user permissions.
  • Separate read and writeTools that change data require a confirmation.
  • Cap the loopA maximum number of calls per request.
  • Log everythingWhich tool, which parameters, which result.

To share your tools across assistants, see the MCP server. For the step to agents, AI agents on real data.

Frequently asked questions

Are function calling and tool use the same thing?
Yes. Providers use one name or the other for the same mechanism.
Can the model call several tools?
Yes, one after another or in parallel. The application loops as long as it requests tools, with a capped number of steps.
How does it relate to MCP?
MCP standardises how tools are described and served, so one server works with several assistants. The calling mechanism stays the same.

Read next

All guides