AI Engineer DojoAll lessons  Courses
Free lesson · The AI Evaluation Engineer · Lesson 8

Can You Rely on the Agent?

Your company wants an AI agent to handle airline support: looking up bookings, changing flights, cancelling and refunding. In the demo it handled every request well. Before it talks to real customers, you've been asked how often it will get things right, whether it gets the same request right every time, and what kind of mistakes it makes when it doesn't.

How this lesson works

You'll read two real runs of the same task and find where one went wrong, score repeated runs by hand, then measure hundreds of runs and decide where business rules should live. Plan on about an hour. The script needs only Python.

The data

τ-bench (tau-bench) is a public benchmark from Sierra. An AI agent talks with a simulated customer, played by another language model following a script, and uses tools to look up and change records in an airline or retail database. The agent gets a written policy it must follow. A run counts as a success only if the database ends up exactly as the task requires: the right changes, and no wrong ones. The published runs include GPT-4o (each task run 4 times) and Claude 3.5 Sonnet (each task run 8 times).

Source: Yao et al., 2024, "τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains." Runs from github.com/sierra-research/tau-bench, MIT license. Conversations shown are real runs, shortened only where a tool returned a long record.

Step 1

Two runs of the same request

Here is the part of the airline policy the agent was given about cancellations:

Policy excerpt

The current time in the simulation is . A customer, Anya Garcia, wants to cancel reservation 3RK2T9 and get a full refund. Below are two runs of GPT-4o handling this same customer. Read both.

Your call
Which run followed the policy?

In the other run, what exactly did the agent fail to do?

GPT-4o ran this task 4 times. How many runs do you think followed the policy? of 4

B followed the policy. It looked up the reservation, saw it was created on 2 May, 13 days before the current date, and refused the refund even when the customer insisted. It offered a human agent instead.

A never looked up the reservation. It asked the customer whether the booking was within 24 hours, accepted "yes," and cancelled with a full refund of $280. The customer was wrong, and the policy says the agent must check the rules itself.

Across its 4 runs, GPT-4o got this task right twice. The other failed run was different again: it did look up the reservation, then took the customer's word over the record and cancelled anyway. Same model, same customer, same policy: two correct refusals, two refunds that shouldn't have happened.

Data: τ-bench historical trajectories, Sierra, MIT license. Yao, S. et al. (2024). τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains. The "every run" metric is the paper's pass^k.