Concepts / Evaluating Agent Reliability

Evaluating Agent Reliability

An agent's environment is defined by its use case, such as a game, the internet, a kitchen, or a road system.

  • Programming

Two Questions About Any Agent

Suppose someone hands you an AI agent and asks what it is able to do. Two questions come up almost immediately. First, where does it operate: what world does it perceive and affect? Second, what can it actually do inside that world? These two questions are linked. The world an agent works in shapes the things it could possibly do, and the things it is equipped to do shape how much of that world it can reach.

This article follows that link. It then looks at how an agent works through a task one step at a time, and why long chains of steps are risky. By the end, you should be able to trace an agent's run from start to finish and explain why reliability gets harder as the number of steps grows.

Where an Agent Operates

Definition

An agent's environment is defined by its use case. The environment is the world the agent perceives and acts upon, and the use case determines what that world is.

The easiest way to identify an agent's environment is to ask what it is supposed to act upon. An agent built to play a game has that game as its environment. An agent that scrapes documents from the internet has the internet as its environment. A cooking robot works in a kitchen. A self-driving car works in the road system and the areas beside it. Each of these use cases names a different world, and each world contains different objects, states, and possible moves.

Once the environment is fixed, it determines which tools an agent could potentially use. A chess game is a useful case. The only possible actions for an agent inside a chess game are the legal chess moves. Nothing outside the rules of the game is available to it, so there is no point in giving it a tool for browsing the web while it plays.

How Tools Widen the Action Set

A model that only produces text has a small set of possible actions: it can produce text. Giving it tools adds to that set. Many generative AI applications people use every day are agents with access to tools, although many of those tools are simple. ChatGPT is one example. It can search the web, run Python code, and generate images. Each of these capabilities is an action that is unavailable to a model with no tools at all.

Retrieval-augmented generation (RAG) systems follow the same pattern. A RAG system can be viewed as an agent whose tools are a text retriever, an image retriever, and a SQL executor. Each tool is a specific capability the agent can call on, and each one extends what the agent can do with information it finds.

A coding agent called SWE-agent, built on top of GPT-4, shows both ideas together. Its environment is a computer with a terminal and a file system. Its set of actions includes navigating a repository, searching files, viewing files, and editing lines. The environment supplies the places where those actions apply, and the actions are what let the agent change that environment.

Environmentset by the use caseTool inventorytools the agent carriesAvailable actionsbase actions plus toolactionsReachable environmentthe part of the world theagent can affectdetermines which tools could be usedadds to the action setrestricts which environments it can work in
The environment fixes which tools are usable, and the tool inventory fixes which parts of the environment the agent can reach.

The relationship runs in both directions, and the diagram shows both. The environment limits the tools that make sense, and the tools limit the environments the agent can actually operate in. A robot whose only action is swimming is confined to a water environment, because on land it has nothing it can do. The tools fix the reachable world just as the world fixes the usable tools.

Tracing a Multi-Step Task

An agent is typically given a task by a user, and it does not simply return one answer. It processes the task together with feedback from its environment, plans a sequence of actions, and decides when the task is finished. The best way to see this is to follow a real run.

Take a RAG system working with tabular sales data. It has three actions: generating a response, generating a SQL query, and executing a SQL query. Given the request to project sales revenue for a product over the next three months, the agent carries out a sequence of moves. It reasons about what information it needs, writes a query, executes that query against the data, reads what comes back, and then decides whether it has enough to answer. If the first round of results is not sufficient, it writes and runs a second round of queries.

The sequence below follows the messages between the user, the agent, the SQL tool, and the sales data. Read it top to bottom. Each arrow is a choice the agent made based on what it had just learned, and the second round of queries exists only because the first round's output was judged insufficient.

Usergives the taskAgentplans and judges progressSQL executortoolSales datatabular environment1. project revenue for next three months2. execute first SQL query3. read matching rows4. first results returned5. judged insufficient, execute second query6. read more rows7. second results returned8. task judged complete, answer given
The agent queries the data, reads the results, decides they are insufficient, queries again, and only then answers the user.

Two details in this run matter. First, the agent judges its own progress. It decides when the information is enough and when the task is complete. That judgment is part of the loop, not an afterthought, and it is what allows the agent to stop. Second, the agent returns to reasoning after every tool call. The results of each action become input for the next decision.

Worked example

Naming the Moves in the Sales Run

Identify each point in the sales run where the agent makes a decision, and say what that decision depends on.

  1. 1
    Decide the first query

    After reading the task, the agent decides what data it needs and writes a SQL query. The decision depends only on the task request.

  2. 2
    Decide whether to continue

    After the first results come back, the agent judges whether they are enough. This decision depends on the observation from the environment.

  3. 3
    Decide the second query

    Because the first results were judged insufficient, the agent writes a new query. This decision depends on what was missing from the first round.

  4. 4
    Decide the task is complete

    After the second results arrive, the agent judges that it has enough information and gives the answer. This is the decision that lets the agent stop.

Result

Each move depends on the observation before it, and the run ends only when the agent itself judges the task complete.

Why Each Extra Step Adds Risk

The sales run above had seven reasoning-and-action moments. Each one is a place where the agent can go wrong. A query can be malformed, a result can be misread, or a plan can be poor. Because the agent needs many steps, its overall accuracy depends on how the individual steps combine, not only on how good any single step is. This is called the problem of compound mistakes.

The effect is easiest to see with numbers. If a model is 95% accurate per step, then over 10 steps the overall accuracy drops to about 60%. Over 100 steps it falls to about 0.6%. The timeline below lays out those three points so you can see how quickly the trend bends downward.

1 step95% overall10 stepsabout 60% overall100 stepsabout 0.6% overallmore steps compoundmore steps compound
Each added step multiplies the overall chance of success by another 0.95, so the chance of finishing the whole task shrinks quickly.
Formula, step by step
  1. 1
    Let n be the number of steps the task requires, and let 0.95 be the chance that any single step is correct.
  2. 2
    Multiply 0.95 by itself once for each step: $0.95^{10} \approx 0.60$ for ten steps.
  3. 3
    For one hundred steps, $0.95^{100} \approx 0.006$, which is about 0.6%.
  4. 4
    A small per-step error rate, repeated over many steps, adds up to a large chance that something has gone wrong somewhere along the way.
Worked example

A Lower Per-Step Accuracy

Suppose each step of an agent is correct 90% of the time, and the task needs 10 steps. What is the approximate chance that the whole run succeeds?

  1. 1
    Write the per-step chance

    Each step succeeds with probability 0.9, so the overall chance is $0.9^{10}$.

  2. 2
    Multiply repeatedly

    Multiplying 0.9 by itself ten times gives about 0.35.

  3. 3
    Interpret the result

    Even though each step is correct 90% of the time, the run as a whole succeeds only about one time in three.

Result

About 0.35, or roughly 35% overall success across 10 steps.

Why Agents Need Stronger Models

Compared with non-agent uses of a model, agents typically require more powerful models. There are two reasons. The first is the compound-mistake effect just described: a long chain of steps needs each step to be highly accurate. The second is that agents with access to tools can perform more impactful tasks, but any failure could carry more severe consequences. A text answer that is wrong can be ignored. An action that is wrong may have already changed something in the environment.

FeatureSingle-step text taskLong multi-step agentic task
Number of decisionsOneMany, each depending on earlier observations
Effect of one errorA wrong answer that can be ignoredA wrong action that may already have changed the environment
Accuracy over the whole taskRoughly the accuracy of the single answerShrinks as steps multiply, since errors compound
Model demandCan often be met by a simpler modelTends to need a more powerful model

How the demands on a model differ between a single answer and a long agentic run

Cost works in the other direction too. A task that requires many steps takes time and money to run. The source argues that this cost can still be worthwhile, because autonomous agents can save a great deal of human time. Whether an agent is worth deploying depends on weighing that saving against the expense of running many steps and the damage a failure could cause.

Mistakes When Judging Agent Reliability

  • Common mistake

    Judging an agent only by how good its single answer looks

    What it looks like

    An agent gives a convincing final projection, so it is assumed to be reliable.

    Why it fails

    The final answer depends on every intermediate query, read, and judgment. A polished last step can hide an early error.

    Do this instead

    Examine the chain of moves, not only the output, and ask where each step could have failed.

  • Common mistake

    Treating the tool list as separate from the environment

    What it looks like

    Assuming a web search tool is useful inside a chess game.

    Why it fails

    The environment determines which tools could potentially be used, so a tool with no matching environment gives the agent nothing to act on.

    Do this instead

    Start from the use case to define the environment, then check which tools make sense inside it.

  • Common mistake

    Assuming a small per-step error rate is harmless

    What it looks like

    Reasoning that 95% per step is excellent, so a 100-step task should also be nearly reliable.

    Why it fails

    Errors multiply across steps. At 95% per step, 100 steps leave only about 0.6% overall accuracy.

    Do this instead

    Count the steps in a task and compute the compounded success rate before deciding whether an agent is dependable.

  • Common mistake

    Believing an agent needs no judgment about when to stop

Predicting a Long Run

MEDIUM

An agent is 98% accurate on each step. A task requires 20 steps. Before calculating, estimate whether the overall chance of success is closer to 90%, 67%, or 30%. Then work out the approximate value using $0.98^{20}$.

Hints
  • Multiply 0.98 by itself once for each of the 20 steps.
  • Compare your result with the 95%-per-step example: even a small drop from 95% to 98% per step makes a large difference when steps are chained.
  • The answer should be well below 90% but above 30%.

What do you think happens?

What is the approximate overall chance that the 20-step run succeeds?

Reveal answer
Answer:

About 0.67, or roughly 67%.

Multiplying 0.98 by itself twenty times gives about 0.67. Each step looks reliable on its own, but the chance of completing all twenty correctly is noticeably lower.

Putting the Pieces Together

The environment, the tools, and the planner work as one system. The environment is set by the use case, the tools determine which actions are available inside that environment, and the planner decides which actions to take and when the task is done. Each extra step in the plan adds a chance of error, which is why accuracy falls over long tasks and why agents tend to need stronger models than simpler applications.

Key Takeaways

  • An agent's environment is defined by its use case, such as a game, the internet, a kitchen, or a road system.
  • Tools expand the set of actions an agent can perform, and the tool inventory limits which environments it can work in.
  • An agent completes a multi-step task by processing information, planning actions, and judging when the task is complete, returning to reasoning after each tool call.
  • Per-step errors compound: at 95% accuracy per step, overall accuracy falls to about 60% over 10 steps and about 0.6% over 100 steps.
  • Because of compound mistakes and the higher cost of wrong actions, agents typically need more powerful models than single-step applications.

Related concepts

More concepts starting with E