Module 5 · Evaluation & observability

Trajectory-level and outcome-level evaluation

5 min read

"It seems to work" is not an evaluation method. A multi-agent system can produce a good note by luck, and a bad one after the next prompt change. Without systematic evaluation, every change is a gamble. This lesson presents the two evaluation axes of an agentic system: the trajectory (the path followed) and the outcome (what is produced).

Why the outcome isn't enough

Two runs can produce notes of equal quality, one in 8 model calls, the other in 23 after four revisions and some ping-pong between agents. Evaluating only the outcome hides:

  • hidden costs (the second run costs three times as much);
  • fragility (the second came close to failing);
  • behavioral regressions (one agent is no longer called, another is called too often).

Conversely, a perfect trajectory with a wrong outcome is worthless. You need both.

Trajectory evaluation

It checks rules about the path followed, independently of the content produced. Atlas records the steps of a run using LangGraph's updates streaming mode, which emits one update per executed node:

def run_until_review(graph, question: str) -> Trajectory:
    """Runs the graph up to human review, recording each step."""
    config = {"configurable": {"thread_id": uuid.uuid4().hex}, "recursion_limit": 50}
    steps: list[str] = []
    interrupted = False
    for update in graph.stream({"question": question, "revisions": 0}, config, stream_mode="updates"):
        for node in update:
            if node == "__interrupt__":
                interrupted = True
            else:
                steps.append(node)
    return Trajectory(steps=steps, interrupted=interrupted, state=graph.get_state(config).values)

Then explicit rules, each encoding a design expectation:

def check_trajectory(t: Trajectory, max_revisions: int = 2) -> list[str]:
    errors: list[str] = []
    if not t.steps or t.steps[0] != "planner":
        errors.append("The planner must run first.")
    if t.steps.count("researcher") != len(t.state.get("plan", [])):
        errors.append("There must be exactly one researcher per sub-question.")
    if t.steps.count("writer") > max_revisions + 1:
        errors.append("Too many writing iterations: the critique loop isn't converging.")
    if not t.interrupted:
        errors.append("The graph should have paused for human review.")
    return errors

What you can check on a trajectory

CategoryExample rules
OrderPlanner before researchers; never publish without approval
CardinalityOne researcher per sub-question; at most N revisions, N handoffs
ToolsThe search tool is called before any claim; no forbidden tool is used
ResourcesFewer than X LLM calls, less than $Y per run
SecurityA sensitive action is always preceded by an approval

These rules are deterministic: they cost nothing and are never wrong.

Testing orchestration without a model

The orchestration logic — routing, loops, reducers, interrupts — can be tested without calling any model. That's the purpose of Atlas's offline mode (ATLAS_FAKE_LLM=1): model calls return deterministic responses, and the graph actually runs.

def test_trajectory_and_review_loop():
    tracing.reset()
    t = run_until_review(build_graph(), "How do you orchestrate agents?")
    assert check_trajectory(t) == [], check_trajectory(t)
    # The fake critic requests one revision then approves: 2 passes through the writer
    assert t.steps.count("writer") == 2
    assert t.state["review"]["verdict"] == "approve"
    assert len(t.state["findings"]) == len(t.state["plan"]) == 3

These tests run in seconds, for free, on every change: they belong in your continuous integration. Fake responses also let you simulate hard cases (a critic that's never satisfied, an exceeded budget, a refusal) that you'd rarely get with a real model.

Outcome evaluation

It judges the quality of what is produced. Three families of methods, to combine:

1. Deterministic checks

Anything verifiable by code: existing citations (check_citations), length, mandatory sections, format. They apply to 100% of runs, in production as in testing.

2. Comparison with a reference

For questions whose correct answer is known: does the note contain the expected elements? Useful for facts; insufficient to judge writing quality.

3. Model-based judgment

For what requires understanding — faithfulness to sources, completeness, clarity — an LLM judge evaluates against a rubric. It's powerful, but a judge has its own biases: the next lesson is entirely dedicated to them.

Building an evaluation set

An evaluation set doesn't need to be large to be useful; it must be representative:

  1. Start small: 20 to 50 real questions, taken from usage or user feedback.
  2. Cover the hard cases: ambiguous questions, questions with no answer in the knowledge base, contradictory ones, very broad ones, ones containing an injection.
  3. Add every bug found in production as a test case: the set grows with experience.
  4. Separate a development set (which you iterate on) from a validation set (which you only look at when deciding), so you don't overfit your prompts.

Fitting evaluation into the development cycle

WhenWhatCost
On every changeOffline orchestration tests (trajectory, guardrails)None
Before going to productionFull evaluation set with the real model: trajectory + outcomeModerate
Continuously in productionDeterministic checks on 100%; LLM judge on a sampleControlled

Key takeaways

  • Evaluate the trajectory (path, cardinalities, resources, security) and the outcome (quality produced): either one alone is misleading.
  • Trajectory rules are deterministic; stream_mode="updates" gives you the executed steps.
  • Orchestration logic can be tested without a model, with fake responses, on every change.
  • A small but representative evaluation set, enriched with every bug, beats a large generic one.

Hands-on

  1. Run ATLAS_FAKE_LLM=1 python -m pytest tests/ and read each test.
  2. Add a trajectory rule: "no writer node runs before all researchers have finished".
  3. Write 10 evaluation questions for Atlas, including 3 hard cases, each with the elements expected in the note.

Resources