Lesson 19.1 · 1 of 4 · 4 min read · Reviewed 24 Nov 2026
Outcome vs trajectory evals
By the end, you can
- Compare outcome and trajectory evals for agents.
- Decide when each matters.
AgentsAgent: A system where a model decides its own next steps, calling tools in a loop until the task is done. take many steps. You can judge the destination, the route, or both.
input --> step 1 --> step 2 --> ... --> step n --> end state
\________ trajectory ________/ outcome
Outcome evals
Check the result in the environment:
- Ticket state is “resolved” and the refund record exists with the right amount
- The code change passes the test suite
- The report contains the required sections and correct figures
Outcome is what users care about. Agents can often reach a good outcome by several valid routes, so don’t punish a different route that works.
Trajectory evals
Check the steps:
- Required steps happened (identity check before refund)
- Forbidden steps didn’t (no delete calls, no external email)
- Tool arguments were valid (19.2)
- Step count and cost stayed within budget (19.4)
Using both
| Situation | Weight |
|---|---|
| Many valid routes, low risk | Mostly outcome |
| Policy or safety steps required | Outcome plus required-step checks |
| Cost sensitive | Outcome plus step and token budgets |
| Debugging a regression | Trajectory diff between versions |
Key points
- Outcome evals check the end state: was the ticket resolved, is the file correct, did the test suite pass?
- Trajectory evals check the path: which tools, in what order, with which arguments, and how many steps.
- Use outcome as the main score; add trajectory checks for safety, cost and required steps.
Score agent runs by outcome and path
Score each agent run twice: once on the end state it left behind, once on the rules its path must follow.
You will have: An outcome check, a trajectory rule check and a results table for three recorded runs.
Steps
- Read the three recorded runs: each has a trace of tool calls and the sandbox's end state.
- Write outcome_ok(): the ticket is resolved and a refund of the expected amount exists.
- Write path_problems(): verify_identity before issue_refund, and never delete_account.
- Print a row per run and decide which runs should count as passes.
Done when
- run-1 passes both checks.
- run-2 has a correct outcome but fails the path rule.
- run-3 takes a different valid route and still passes.
Open in the Playground No API key needed.
Starter code (Python)
RUNS = [
{"id": "run-1", "trace": ["lookup_order", "verify_identity", "issue_refund", "close_ticket"],
"state": {"ticket": "resolved", "refund": 45}},
{"id": "run-2", "trace": ["lookup_order", "issue_refund", "close_ticket"],
"state": {"ticket": "resolved", "refund": 45}},
{"id": "run-3", "trace": ["verify_identity", "lookup_order", "lookup_order", "issue_refund", "close_ticket"],
"state": {"ticket": "resolved", "refund": 45}},
]
EXPECTED_REFUND = 45
def outcome_ok(state):
# TODO: ticket is "resolved" and refund equals EXPECTED_REFUND
return False
def path_problems(trace):
problems = []
# TODO: if verify_identity is missing, or comes after issue_refund, add "refund before verify"
# TODO: if delete_account appears, add "forbidden delete_account"
return problems
for run in RUNS:
probs = path_problems(run["trace"])
ok = outcome_ok(run["state"])
print(run["id"], "outcome", "PASS" if ok else "FAIL", "| path", "PASS" if not probs else "FAIL " + ", ".join(probs))
Show a solution
RUNS = [
{"id": "run-1", "trace": ["lookup_order", "verify_identity", "issue_refund", "close_ticket"],
"state": {"ticket": "resolved", "refund": 45}},
{"id": "run-2", "trace": ["lookup_order", "issue_refund", "close_ticket"],
"state": {"ticket": "resolved", "refund": 45}},
{"id": "run-3", "trace": ["verify_identity", "lookup_order", "lookup_order", "issue_refund", "close_ticket"],
"state": {"ticket": "resolved", "refund": 45}},
]
EXPECTED_REFUND = 45
def outcome_ok(state):
return state.get("ticket") == "resolved" and state.get("refund") == EXPECTED_REFUND
def path_problems(trace):
problems = []
if "issue_refund" in trace:
if "verify_identity" not in trace or trace.index("verify_identity") > trace.index("issue_refund"):
problems.append("refund before verify")
if "delete_account" in trace:
problems.append("forbidden delete_account")
return problems
passes = 0
for run in RUNS:
probs = path_problems(run["trace"])
ok = outcome_ok(run["state"])
passes += ok and not probs
print(run["id"], "outcome", "PASS" if ok else "FAIL", "| path", "PASS" if not probs else "FAIL " + ", ".join(probs))
print(f"counted as passes: {passes} of {len(RUNS)}")