Skip to content

AI Agents and Tool Use

What makes an LLM an agent, how the tool-use loop works, and when an agent is the right design.

Editorial team 2 min read

An AI agent is a language model that can take actions — search, call APIs, run code — and decide what to do next based on the results.

The Tool-Use Loop

  1. You describe available tools to the model: name, description and input schema.
  2. The model either answers or requests a tool call with arguments.
  3. Your code runs the tool and returns the result to the model.
  4. The loop repeats until the model produces a final answer.

The model never executes anything itself; your code stays in control.

Workflows Versus Agents

  • Workflows: your code fixes the steps and the LLM fills them in. Predictable, testable and cheaper.
  • Agents: the model chooses the steps. Flexible, but less predictable and more expensive per task.

Start with the simplest design. Many problems described as needing an agent are better solved with a single call or a fixed workflow.

When Agents Fit

Open-ended tasks where the path can't be known in advance — research, debugging, multi-step data gathering — especially when the agent can check its own progress (tests pass, searches return results).

Designing Good Tools

Clear names and descriptions, well-documented inputs, concise outputs, and actionable error messages. Most agent failures are tool-design failures.

Safety

Limit permissions, cap steps and spending, sandbox code execution, require human approval for irreversible actions, and treat anything the agent reads as untrusted data — it may contain instructions designed to hijack it.

More in Generative AI

All Generative AI guides →
Generative AI Guide · 2 min

Prompt Engineering Fundamentals

The building blocks of a good prompt — context, task, constraints and format — with before-and-after examples.

Generative AI 2 min read 24 Jul 2026

Generative AI Guide · 2 min

Few-Shot Prompting With Examples

Showing a model a few examples of the input and output you want is often clearer than describing it. How to choose good examples.

Generative AI 2 min read 23 Jul 2026

Generative AI Guide · 2 min

Getting Structured Output From LLMs

How to get JSON and other machine-readable output reliably from a language model, and how to validate it.

Generative AI 2 min read 22 Jul 2026

Generative AI Guide · 2 min

Why Language Models Hallucinate

What hallucination is, why it happens, and practical ways to reduce and catch it.

Generative AI 2 min read 21 Jul 2026