← All questions
AgentsMedium· Agents & Orchestration

How do you test an agent?

By separating what’s deterministic from what isn’t, and testing each appropriately:

  • Deterministic components — parsing, validation, the tool wrappers themselves — get ordinary unit tests.
  • Agent decision logic gets fixture-based replay: recorded model responses and tool outputs played back so you can test the agent’s decision-making without a live, non-deterministic model call on every test run.
  • Trajectory evaluation, not just final-answer evaluation. An agent that reaches a correct answer via a wrong path isn’t correct, it’s lucky, and it will fail differently on the next input. Check that it called the right tools in a sane order, not only that the final output matched.
  • A small live smoke suite on top of the fixtures, because fixtures drift from reality — the fixture was accurate the day it was recorded, and the real API or model behavior can move on without it.

Code playground (Python)