What are AI Agents?

Beginner3 min

Anthropic's line is who decides what happens next: your code, or the model. The five workflow patterns that sit between one call and an agent, and the three costs the loop brings with it.

#concepts

The distinction that decides your architecture

"Agent" gets applied to anything with a model in it. Anthropic draws a line worth keeping, because the two sides need different code:

Workflows are systems where LLMs and tools are orchestrated through predefined code paths.

Agents are systems where LLMs dynamically direct their own processes and tool usage, maintaining control over how they accomplish tasks.

The question is not how sophisticated the system is. It is who decides what happens next. If your code decides, it is a workflow however many model calls it makes. If the model decides, it is an agent even if it only has two tools.

The loop, in one paragraph

An agent is a loop. Send the conversation and the tool definitions; the model either answers or asks for a tool; if it asks, run the tool, append the result, and send it back. Repeat until it answers or you stop it.

That is the whole mechanism, and manual implementation writes it out in about forty lines. Cost, latency, failure recovery and what to keep in context are what make agents hard, and all of them come from the loop running an unknown number of times rather than from the loop being complicated.

Start below it

The strongest guidance in Anthropic's piece is about not building one:

you should consider adding complexity only when it demonstrably improves outcomes

and

start with simple prompts, optimize them with comprehensive evaluation, and add multi-step agentic systems only when simpler solutions fall short

They are explicit that for many applications "optimizing single LLM calls with retrieval and in-context examples is usually enough".

That is worth sitting with, because the gap between one call and an agent is large in every dimension that matters. One call has a predictable cost, a predictable latency, and one place to look when it goes wrong. An agent has none of those.

The five workflow patterns, which are usually the answer

Between one call and an agent sit the composable shapes. Anthropic names five:

PatternShape
Prompt chainingeach call's output feeds the next, in a fixed order
Routingclassify the input, then send it to a specialised path
Parallelizationrun several calls at once and combine the results
Orchestrator-workersone call plans subtasks, others execute them
Evaluator-optimizerone call produces, another critiques, repeat

Each is predictable code with model calls inside it. You can reason about the cost, test the branches, and see where a failure happened. Most problems people reach for agents to solve are one of these.

When an agent is the right shape

Anthropic's condition is specific: open-ended problems "where it's difficult or impossible to predict the required number of steps, and where you can't hardcode a fixed path."

The trade they state is the one to hold onto:

workflows offer predictability and consistency for well-defined tasks, whereas agents are the better option when flexibility and model-driven decision-making are needed at scale

So the test is not "is this task complex". It is "can I write down the steps". A complicated task with knowable steps is a workflow. A simple-sounding task whose step count depends on what it finds, like searching a codebase until it locates a bug, is an agent.

What you take on

Three costs arrive with the loop, and none are optional.

Unbounded spend. Each iteration resends the conversation, so cost grows faster than step count. A run that should take three steps and takes thirty costs more than ten times as much. Set an iteration limit and a token budget before the first run, not after the first bill.

Every tool called twice. Loops retry, and models re-request. Anything with a side effect has to be safe to call again, which is a design constraint on your tools rather than something a prompt can prevent. Tools and function calling covers it.

A context that fills. Tool results accumulate in the conversation, and the context window is finite. Deciding what survives is the subject of state and historical context.

Further reading

Knowledge check

Question 1 of 4

Your system makes six model calls in a fixed order that your code controls. Is it an agent?

Sign in to save your progress and pick up where you left off.

Open this article on its own page

Also in What are AI Agents?

1 article