AI Hub
ENES

CONCEPT · AGENTS

What is an AI agent?

An AI agent is a system where the language model itself decides what steps to take, in a loop, to reach a goal.

3 min read · updated 2026-08

BEFORE READING

What is it

An AI agent is a system that uses a language model to decide, on its own, what steps to take to reach a goal. Instead of answering once and stopping, the model runs a loop: it picks an action, runs it through a tool, observes the result, and decides the next step. It repeats until it considers the task done or a condition stops it.

What separates an agent from a chatbot is who controls the flow. In a chatbot, your code defines the flow: you ask, the model answers, done. In an agent, the model controls the flow: it decides how many steps are needed, which tool to use at each one, and when to stop.

Anthropic draws a distinction that often gets blurred:

  • Workflow: the model and tools are orchestrated through predefined code paths. You decide the sequence.
  • Agent: the model directs its own process and decides tool usage as it goes.

Many production "AI systems" are workflows, not agents, and that is usually the right call.

Mental model

Think of the difference between a recipe and a cook.

A recipe is a fixed list of steps: mix, bake for 20 minutes, take it out. Always the same. Predictable, cheap, easy to debug. That is a workflow.

A cook has a goal —"dinner is ready"— and decides as they go: taste, adjust the salt, lower the heat if it is burning, change the plan if an ingredient is missing. More flexible, but also more expensive, slower, and harder to predict. That is an agent.

flowchart LR A[Goal] --> B[Model picks an action] B --> C[Runs a tool] C --> D[Observes the result] D --> E{Done?} E -->|No| B E -->|Yes| F[Final answer]

The three ingredients of an agent:

  1. A model that reasons about what to do next.
  2. Tools that give it access to the world: search, read files, call an API, run code.
  3. A loop that repeats reason–act–observe until the goal is met.

Not every pass through the loop calls a tool: some steps are pure reasoning, and the loop ends when the model decides the goal is met.

On top of that base you add optional layers: persistent memory across sessions, explicit planning, human oversight, several coordinated agents.

How it's used

Building an agent, in practice, means:

  1. Defining the goal and the "done" criterion.
  2. Giving it a small, well-described set of tools.
  3. Writing a system prompt that spells out the role, the limits, and when to ask for help.
  4. Setting an iteration cap and a token budget so it does not run away.
  5. Evaluating its behavior on real cases before granting more autonomy.

Agents you may already use: coding agents that read your repo, edit files, and run tests in a loop; research agents that search, read, and synthesize; support agents that query internal systems before answering.

Anthropic's guidance: use the simplest pattern that passes your evals. Sometimes that is a single model call with good tools. Reserve agents for when you cannot hardcode the path but can still verify progress.

When to use it / when not to

Use an agent when:

  • The task has many possible paths and you cannot enumerate them upfront.
  • You can verify whether the result is correct (tests, validations, review).
  • The value of the task justifies the cost of several model steps.
  • You can tolerate some variability in how the result is reached.

Avoid an agent when:

  • The flow is fixed and known: a workflow is cheaper and more predictable.
  • You have no way to verify the result: an agent without verification amplifies errors.
  • Latency or cost matter a lot. Per Anthropic, an agent uses roughly 4x the tokens of a simple chat, and a multi-agent system around 15x.
  • A mistake has serious consequences and there is no human in the loop.

RELATED