# How do I catch a regression in a Claude Agent SDK agent?

There's no built-in regression feature; you assemble one from two things the SDK already gives you. A `PostToolUse` or `Stop` hook runs your own check at the end of a turn and can record a pass or fail without touching the agent's prompt, and a session can be resumed or forked, which means a fixed case can be replayed from the exact state it started in against a changed prompt, tool set, or model, rather than a fresh run that might diverge for unrelated reasons.

Keep a small set of cases as sessions worth re-forking, run each one through the hook before and after a change, and compare the pass rate rather than eyeballing individual transcripts. A drop names which case regressed, the same discipline [any agent needs to catch a regression](/answers/regression-detection/what-is-regression-testing-for-an-ai-agent), just built from the SDK's own hooks and forkable sessions instead of a separate harness.

---

Sources:
- Claude Docs: Agent SDK overview: https://code.claude.com/docs/en/agent-sdk/overview (fetched 2026-09-19)

Source: https://tessary.ai/answers/claude-agent-sdk-evals/how-do-i-catch-a-regression-in-a-claude-agent-sdk-agent
More on Claude agent sdk evals: https://tessary.ai/answers/claude-agent-sdk-evals
From Tessary, agent reliability for AI agents in production: https://tessary.ai
