AI agents are not always deterministic. A seemingly small change in a prompt, tool, model, or agent implementation can produce different behavior.

This creates an important testing challenge: how do we detect behavioral regressions?

I built Stepfork, an open-source Python project designed to help developers record agent behavior and turn it into repeatable regression tests.

What does Stepfork do?

Stepfork provides four core capabilities:

  1. Record: Capture instrumented agent executions into local trace bundles.
  2. Replay: Reproduce executions using frozen model and tool results.
  3. Diff: Compare executions and identify behavioral changes.
  4. Test: Export pytest regression tests from recorded behavior.

A working LangGraph example

I created a demonstration with two implementations of an agent:

  • A buggy implementation returning approved: false.
  • A corrected implementation returning approved: true.

Stepfork records both executions, validates the trace bundles, and replays the buggy execution without executing the original model or tool bodies again.

It then compares the executions and exports a pytest regression test.

The result:

  • Buggy implementation: FAIL
  • Corrected implementation: PASS

This demonstrates how recorded agent behavior can become a repeatable regression check.

Try it

GitHub: https://github.com/utsab345/stepfork

PyPI: https://pypi.org/project/stepfork/

pip install stepfork 

Looking for feedback

Stepfork is an evolving open-source project, and I'd love feedback from developers building LLM applications and autonomous agents.

If you try it, I'd appreciate:

  • Your experience integrating it into an agent.
  • Issues you encounter.
  • Features you would like to see.
  • Contributions and suggestions.

I'm particularly interested in hearing from developers working with LangGraph and tool-using agents.

Let's make AI agent behavior easier to test and reproduce.