Skip to content

AI Agents and Tool Use

A language model in a loop: it decides on a step, calls a tool (search, code, an API), reads the result and repeats until the task is done.

Also agents · tool use · function calling · ReAct · agentic AI

Fig. / How it works
ThinkThinkUse a toolUse a toolObserveObserve
Role · kind
Using and applyingTechnique
Level
Intermediate

Yao et al. (ReAct), 2022; Schick et al. (Toolformer), 2023

Instead of answering from memory, the assistant can use a calculator, look things up and click buttons, checking each result before deciding what to do next.

Where it fits

+All relationships as a list

See it on the full map

How it works

On its own, a large language model only writes text. Give it tools and a loop, and that text can turn into actions:

  1. The system describes available tools to the model: “search(query)”, “run_python(code)”, “send_email(to, body)”.
  2. The model writes a structured tool call instead of a final answer.
  3. Ordinary software runs the tool and pastes the result back into the context.
  4. The model reads the result and decides: call another tool, or answer.

This think, act, observe cycle (popularized as ReAct) turns a model into an agent that can research, code and operate software. RAG can be seen as the simplest case: one retrieval tool, called once.

Two cautions. Mistakes compound over long chains, so agents need checks, and every tool that reads untrusted content or takes real actions is an opening for prompt injection. Good agent design limits permissions and asks a human before anything irreversible.

Everyday use cases

  • Case 01

    Coding assistants

    Read files, run tests, fix the failure, run the tests again.

  • Case 02

    Research and analysis

    Search several sources, run a calculation, and write up the result with citations.

  • Case 03

    Booking and admin tasks

    Fill forms or update records across tools, ideally with a human confirming the final step.

Famous examples

Strengths, weaknesses and when to use it

Strengths

  • Real, current information and exact computation instead of guesses.
  • Can complete long multi-step tasks.

Weaknesses

  • Errors compound over many steps.
  • Taking actions raises security risks such as prompt injection.

When to use itWhen a task needs fresh data, exact computation or actions in other systems.

Compare with

Check yourself

  1. Q01

    What happens after an agent calls a tool?

    Show answer

    A: The tool's result is added to the model's context, and the model decides the next step

Go deeper

Learn first