Looking for testers and feedback on StepFork: Behavioral regression testing for AI agents

Hey everyone!

I’ve been building StepFork, an open-source, local-first tool for behavioral regression testing of AI agents.

The idea is simple: when your agent fails, turn that failure into a reproducible test.

StepFork captures agent execution traces in .sftrace files, lets you replay and evaluate them, and helps identify behavioral regressions as you change your agent or its underlying models.

:link: GitHub: GitHub - utsab345/stepfork: Open-source Python toolkit to record and replay AI agent executions, detect regressions, and turn failures into reproducible pytest tests. · GitHub

I’m looking for people working on LLM applications, AI agents, RAG systems, or agentic workflows to try it out and share honest feedback.

I’d especially appreciate feedback on:

  • Getting started: Is the installation and workflow straightforward?

  • Usability: Does the CLI feel intuitive? What’s confusing or missing?

  • Real-world usefulness: Would this help you catch regressions in your own agents?

  • Bugs and edge cases: What breaks when you try it with your own workflows?

  • Feature direction: What would make you actually use a tool like this?

You don’t need to contribute code. Even a quick review, a small experiment, or a GitHub issue describing your experience would be incredibly helpful.

I’m building this in the open and would rather get honest criticism now than build features nobody needs.

If you’re interested, give it a try and let me know what you think!

Thanks for your time and feedback.

#AI #LLM #Agents #OpenSource #MachineLearning

Nice scope. Turning a failure into a pytest is the step most agent tooling skips. Some feedback from working on the same problem from the engine side:

Frozen replay answers "does my code still handle this exact transcript?". The harder question comes right after a fix that changes the prompt, a tool result or the model: now the LLM has to be called again, and on most local servers the new answer differs for reasons unrelated to your change. Concurrent requests, the prompt cache and speculative decoding all shift the logits slightly, and greedy decoding flips at near ties. A regression test that re-queries the model then fails or passes by luck.

Two ideas that might fit Stepfork:
- Store the engine identity in the `.sftrace` (engine, build, model file hash, concurrency, cache settings). When a live re-run diverges, that is the first thing to check.
- If the engine can return a per-step fingerprint of the logits, store it too. Then "the model answered differently" can be told apart from "the model got a different request".

Disclosure: I build a local engine where live re-runs are exact (GeulPU; same bits under concurrency, cache and speculative decoding), and its debugger also forks a recorded run at a chosen token, close to the "step fork" idea in your name. OpenAI-compatible API, so it could sit behind your `llm_request` wrapper unchanged. Happy to help test that combination: https://github.com/wwoosshh/GeulPUv2

For now, based on what I found from trying it in a CPU-only Colab environment:


What I tested, and the main result

I tried the PyPI release stepfork==0.2.1 in a Linux, CPU-only Google Colab runtime (Python 3.13.16, pytest 8.4.2) using the project’s official synthetic quickstart. This did not require a GPU, an LLM API key, or access to a real external service. I pinned the example to the v0.2.1 commit and checked that the two example files used in the experiment, agent.py and expected.json, matched that revision by SHA-256. This checks the example inputs, not wheel-to-repository equivalence.

The central result: the same recorded failing trace produced a red/green regression test. I recorded the buggy execution, kept its original .sftrace bundle unchanged, and tested the original and corrected Python entrypoints against the same separately supplied desired output. The original failed pytest; the corrected implementation passed. The instrumented tool response was replayed without running the tool body again.

In this synthetic example, order_status reports that ORD-1001 shipped with FedEx. Buggy code notifies only on delivered orders (should_notify: false); corrected code notifies on shipped (true). The tool response stays constant. No live model or carrier was involved.

Same failing trace; different entrypoint/expectation Observed pytest result Interpretation
Buggy code, with the desired output (should_notify: true) FAIL (exit 1) Detected the wrong decision.
Fixed code, with the same desired output PASS (exit 0) Accepted the intended repair under identical recorded dependency conditions.
Buggy code, with its recorded wrong output used as the expectation PASS (exit 0) Confirmed replay fidelity, not the application’s correctness.

That third row was a deliberate negative control, not a StepFork bug. The pytest-export guide already warns about this distinction. Seeing the three results side by side made the practical meaning of --expect-output much clearer to me.

Here, “desired” means independent of the failing trace’s observed result: I used the expected JSON from the project’s stated quickstart scenario. It was not independently validated against a real customer’s requirements. In a real application, a human reviewer, specification, or suitable domain-level acceptance rule would still need to establish the correct outcome.

I did not encounter an unexpected StepFork bug in this small test. I did confirm a few useful boundaries: changing a recorded tool argument raised ReplayMismatchError; a behavioral diff reported the corrected field as changed; and the runner distinguished a failed assertion from a check that could not execute. I would describe this as a positive, reproducible report for a limited offline regression use case, not a general reliability claim about all agent architectures.

Feedback on the areas you asked about

1. Getting started. Exact-version installation and the official quickstart worked in this Colab environment. The ability to try the record/replay/assertion workflow on synthetic data before configuring a provider is useful. This establishes nothing about other runtimes.

2. CLI usability. I exercised validate --verify-integrity, diff --json, export --pytest --expect-output, and run --receipt --json, alongside a small Python record/replay harness. The trace, behavioral diff, generated pytest and structured receipts complemented one another. One point worth making prominent for newcomers is that exit code 1 has different meanings in different commands: a behavioral diff can correctly detect a change while a pytest exit 1 means an assertion failed. The receipt’s verdict is useful for keeping those concepts apart.

3. Usefulness in an actual agent workflow. The strongest case demonstrated here is testing Python application logic around instrumented dependencies: routing, parsing, escalation, notification, or similar decisions whose inputs can be replayed. A captured tool/LLM response can make such a failure reproducible while the application logic changes. This is promising for regression suites, but I have not measured debugging-time savings on a deployed agent or evaluated live-model variability.

4. Bugs and edge cases. I found no unexpected failure in the official synthetic path. Intentionally changing the instrumented order_status argument from ORD-1001 to ORD-UNRECORDED resulted in ReplayMismatchError rather than silent reuse of the old result. A missing trace bundle produced a could_not_execute receipt with reason bundle_missing rather than a reported behavioral regression. Other error paths remain untested.

5. Feature direction. I do not have a new must-have feature request based on this one experiment. The most useful learning-path guidance, in my view, is to put two questions very near the initial example: “Who approved the expected outcome?” and “Which external calls are actually frozen?” The guide and your earlier forum explanation already discuss both: this is feedback about the learning path, not a new feature request.

A useful default workflow

For the failure class I tested, this seems like a practical path for a new user:

  1. Instrument the specific tool or model calls whose recorded responses should be held constant.
  2. Record a failure as a .sftrace directory bundle and preserve that original fixture.
  3. Validate it, including integrity verification when appropriate, and inspect its contents before sharing it.
  4. Specify the correct intended output in a separate, reviewed expectation; do not silently approve the wrong recorded result.
  5. Export a pytest test using that expectation and keep the referenced trace bundle alongside the generated test.
  6. Check the original and fixed application code against the same fixture and same expectation. An intentionally failing original test is part of the evidence, not a setup failure.
  7. If the fix changes instrumented call inputs, call order, prompts, or external state, select an appropriate different test instead of interpreting every strict replay divergence as a defect.

This is a user workflow, not a proposed feature list. I tested the main path; the last step reflects a documented boundary.

What I would and would not infer from this run

In frozen replay, I cleared the quickstart’s TOOL_EXECUTIONS list before testing both entrypoints. Each replay matched the one recorded instrumented dependency call, yet that list remained []. This is direct evidence that the instrumented tool body was not executed in this case. It is not evidence that arbitrary HTTP requests, file writes, subprocesses, or other uninstrumented side effects would be intercepted or sandboxed.

Comparing two recorded runs with stepfork diff --json reported equivalent: false and changed path output.should_notify (false versus true). That is a meaningful behavior change, but the separate pytest expectation is what makes it a desired change. Similarly, a frozen replay mismatch identifies an incompatible call sequence or input relative to the fixture; it does not independently grade a legitimate code repair.

The harness reported 18/18 expected checks, including an intentional pytest FAIL and an intentional unexecutable case. This is not 18 production features or a statistical success rate; the three-way comparison is the important evidence.

Below are the details I would keep available for anyone trying to reproduce the observation or apply it to a different type of agent.

Reproduction details: environment, fixtures, commands, and direct observations

Environment and source

The Colab run took place on October 23, 2026 (UTC), on CPU-only Linux/x86-64 with Python 3.13.16, PyPI stepfork==0.2.1, and pytest 8.4.2. The synthetic inputs did not contain API credentials or personal customer records. The checked source revision was 1ab132a93ee3dbe781884df0e8bf05f128150482, with relevant files under examples/quickstart.

The example’s desired output:

{
  "order_id": "ORD-1001",
  "should_notify": true,
  "carrier": "FedEx"
}

This desired JSON was not copied from the failing run. It represents the example’s stated behavior, not a real customer requirement.

Recording and replaying

The basic record/replay logic used the public API. The following is a compact, path-normalized equivalent of the Colab scripts (assuming the pinned example module is available):

from pathlib import Path
from stepfork import record, ReplaySession
from examples.quickstart import agent

out = Path("artifacts")
out.mkdir(exist_ok=True)

for label, entrypoint in (
    ("buggy", agent.run_agent),
    ("fixed", agent.run_agent_fixed),
):
    with record(f"quickstart-{label}", output=out / f"quickstart_{label}.sftrace") as session:
        result = entrypoint()
        session.set_output(result)
    print(label, result)

failure = out / "quickstart_buggy.sftrace"
agent.TOOL_EXECUTIONS.clear()

with ReplaySession.from_trace(failure, mode="frozen") as replay:
    buggy = agent.run_agent()
    replay.verify_complete()

with ReplaySession.from_trace(failure, mode="frozen") as replay:
    fixed = agent.run_agent_fixed()
    replay.verify_complete()

print(buggy, fixed)
print(agent.TOOL_EXECUTIONS)  # Observed: []

Each recording executed order_status once. Both traces validated; each frozen replay matched one call while skipping its body. The Python decisions still differed.

I then changed the input to the wrapped tool through agent.run_agent("ORD-UNRECORDED") while replaying the original failure. The observed exception was:

ReplayMismatchError
call #1: tool 'order_status' input diverged from the recording
  recorded: {"order_id":"ORD-1001"}
  actual:   {"order_id":"ORD-UNRECORDED"}

This abbreviated extract omits the logged input fingerprints. The changed request should not silently receive the old recorded answer.

CLI checks and exports

These are path-normalized commands, assuming an importable examples.quickstart, local example files and the two recorded bundles in artifacts/. Generated tests resolve the trace relative to their paths.

python -m pip install "stepfork==0.2.1" "pytest>=8,<10"

python -m stepfork validate artifacts/quickstart_buggy.sftrace --verify-integrity
python -m stepfork validate artifacts/quickstart_fixed.sftrace --verify-integrity
python -m stepfork diff artifacts/quickstart_buggy.sftrace artifacts/quickstart_fixed.sftrace --json

Both validations exited 0. The diff exited 1 because it successfully detected a change; its JSON reported equivalent: false and output.should_notify as the changed field. An exit code here is an operation-specific signal, not a universal test verdict.

The three exported tests were generated with these combinations:

# The desired outcome rejects the original bug.
python -m stepfork export artifacts/quickstart_buggy.sftrace \
  --pytest --entrypoint examples.quickstart:run_agent \
  --expect-output examples/quickstart/expected.json \
  --output artifacts/test_buggy_oracle.py --overwrite

# Same failing trace and same desired outcome, corrected entrypoint.
python -m stepfork export artifacts/quickstart_buggy.sftrace \
  --pytest --entrypoint examples.quickstart:run_agent_fixed \
  --expect-output examples/quickstart/expected.json \
  --output artifacts/test_fixed_oracle.py --overwrite

# Negative control: without a separate expectation, the recorded wrong
# output becomes the assertion for replay-fidelity checking.
python -m stepfork export artifacts/quickstart_buggy.sftrace \
  --pytest --entrypoint examples.quickstart:run_agent \
  --output artifacts/test_buggy_record_pinned.py --overwrite

All exports exited 0. Running each file with python -m pytest -q -p no:cacheprovider <test-file> produced:

test_buggy_oracle.py          FAIL   pytest exit 1
test_fixed_oracle.py          PASS   pytest exit 0
test_buggy_record_pinned.py   PASS   pytest exit 0

The first was a behavior assertion failure, not collection failure. The second used the same failure bundle and expectation with a corrected entrypoint. The third passed because its expectation was the wrong recorded result. See the export guide.

The experiment kept a second, fixed-run trace for the diff comparison. The pytest red/green comparison did not swap to that fixed trace. This is important: otherwise the example would not demonstrate that the original recorded failure remains useful when application logic changes.

What is needed to reproduce it in another environment

Reproduction requires the pinned example, expected.json, StepFork/pytest, an importable entrypoint and the .sftrace bundle referenced by TRACE_PATH. Generated tests do not embed the bundle; keep the relative path valid in CI.

The Colab logs, generated tests, trace bundles, receipts and checksums were retained locally but are not publicly linked here. The pinned upstream example and commands above are the reproducible public inputs. A newer release needs its own verification.

How to read the results: regression failure, replay mismatch, diff, and could-not-execute

Several different events can look like “failure”:

Question Mechanism Observed example Meaning
Do instrumented calls still match this recording? Frozen replay Original input matched; changed order_id raised ReplayMismatchError A call-pattern compatibility check, not a correctness oracle.
Did two recorded executions behave differently? stepfork diff --json Exit 1, equivalent: false, changed output.should_notify A behavioral difference, which may be the intentional repair.
Does an entrypoint satisfy the approved result? Exported pytest Original FAIL, fixed PASS with the same trace A behavioral regression assertion.
Could the check run at all? stepfork run receipt Absent bundle reported could_not_execute Missing test evidence or setup, not proof of a code regression.

These were three separate receipts, summarized here (not a literal single receipt):

{
  "buggy_with_oracle": {"verdict": "failed", "exit_code": 1},
  "fixed_with_oracle": {"verdict": "passed", "exit_code": 0},
  "missing_trace_bundle": {
    "verdict": "could_not_execute",
    "reason": "bundle_missing",
    "exit_code": 2
  }
}

In CI, a missing bundle, an intentional diff, and a violated assertion should remain separate. I checked only one could_not_execute case, not all import, dependency or process failures.

It is also helpful to distinguish a green replay from a correct outcome. If the old code repeats its wrong decision faithfully, a replay-fidelity test can pass while the underlying requirement is still violated. Conversely, a red diff can be the expected evidence of a fix. Both are useful signals so long as the consumer knows what they mean.

The documentation also describes stepfork score, which analyzes whether an expectation is associated with a known failing run’s output or a separately specified claim. I reviewed the corresponding documentation/source during the research, but did not execute stepfork score in this Colab probe. The three pytest controls establish the oracle distinction directly; I would not present an unexecuted scoring command as another measured result.

If the fix changes the instrumented call sequence, the guide recommends recording the fixed run and exporting from it. Such a test can reject buggy code via divergence, but that is a different fixture setup from my same-failing-trace check. An intentionally fixed-run, “run-pinned” expectation is not automatically a worthless test; its purpose must be understood.

Choosing a test for different kinds of agent changes

The quickstart demonstrates one lane of testing. The next choice depends on the change:

A. Application logic changes, but the same instrumented calls remain. This is the measured case. Keep the failing trace and a separately reviewed desired output, and rerun the local Python logic with frozen dependency responses. It tests the repair under matching recorded inputs with minimal external variance.

B. Tool arguments, call count, or call order intentionally change. The old trace may no longer satisfy the new call pattern. A strict mismatch is useful information but not automatically a failed repair. The pytest-export guide recommends recording a corrected execution and exporting from that trace when necessary. Another option is to test the changed tool-selection logic directly with an appropriately controlled unit or trajectory test. In either case, verify the intended output rather than declaring victory merely because new calls were made.

C. The prompt, model, provider, or model’s decision quality changes. Frozen replay substitutes recorded LLM responses and strictly checks recorded inputs. It therefore cannot, on its own, prove that a new prompt or model produces better live judgments. The replay documentation documents the relevant policies, including hybrid/live options with explicit restrictions. For model-quality questions, keep a separate live or controlled evaluation on representative examples, with repeated trials when variability matters. Such results should not be described as outcomes of this Colab test.

D. RAG content, a retrieval index, or a persistent database changes. Frozen replay of an instrumented retrieval function can establish what downstream logic does with a historical retrieved response. It cannot by itself establish that the current index returns the same documents, that retrieved citations are still valid, or that persistent data is fresh. Those questions need explicit data/version evidence and, where appropriate, state-based acceptance criteria. The project’s Issue #31 already addresses retrieval evidence and per-node context, so this is better framed as a relevant boundary than as a newly discovered defect.

E. Concurrency, multi-agent workflows, or external side effects matter. The replay guide explains that matching uses a strict dependency-call cursor; async task scheduling is not frozen. Calls that arrive in a different order can diverge even if they represent a legitimate concurrent execution. Additionally, code outside instrumentation can still run. A synthetic fixture, mocked service, or isolated environment may be needed for side-effectful operations. I did not exercise concurrency, multi-agent coordination, or production transactions here.

A compact choice of test intent might look like this:

Primary question Good starting evidence Important limitation
Did a Python post-tool bug return? Original failing trace + approved output + frozen replay Corrected code must still match the captured dependency calls.
Is the new tool trajectory acceptable? Reviewed call/argument/order assertions and suitable fixtures Final output alone may not describe unwanted actions.
Does a model or prompt perform better? Controlled examples and live evaluations Frozen responses cannot test an improved live response distribution.
Does a stateful task complete correctly? Final-state checks and relevant versioned evidence A single saved response may omit the effects of state changes.
Can a test be executed reliably in CI? Importable entrypoint, stable fixture paths, structured receipts Setup failures should not be called behavioral regressions.

These approaches complement rather than rank StepFork. Choose the smallest test that addresses the failure.

Trace hygiene and safe interpretation of replay guarantees

A .sftrace is a saved data artifact, and saved agent interactions may contain things that should not leave the local environment. StepFork has trace-format and security documentation that are worth consulting before sharing a real trace.

A few distinctions matter:

  • Trace data is not executable code. StepFork does not execute code from inside the trace, but replay does execute the trusted local Python entrypoint supplied by the user. That entrypoint may perform operations beyond the recorded wrappers; replay should not be described as a general sandbox.
  • Redaction is best-effort. Credential-like values may be removed in recognized forms, but that does not guarantee every secret, identifier, free-form text fragment, or domain-specific sensitive value is safe to publish. The synthetic example avoided real secrets, so it was not a test of redaction effectiveness. Issue #29 already covers additional redaction regression tests.
  • Integrity checking is not authenticity. A bundle’s SHA-256 integrity metadata can detect changes relative to a trusted record, but not prove that a third party could not replace both payloads and hashes. Use validate --verify-integrity as appropriate, and examine traces before relying on externally supplied bundles.
  • Trusted inputs and resource limits still matter. The security guide notes risks from symlinks and oversized bundles, and stresses review of untrusted artifacts. Frozen replay should not be interpreted as a guarantee that all uninstrumented work is inert.
  • Live-tool authorization requires care. The replay guide describes explicitly allowing named live tools; the allowlist does not sandbox those tools or make their side effects safe. I did not invoke live tools in this experiment.

For collaborative debugging, I would share the smallest reviewed synthetic trace that reproduces the decision, state the StepFork version, describe exactly what was instrumented, and keep the approved expectation next to the fixture. Those details make the evidence more useful and reduce the risk of accidentally treating a historical response as a current external fact.

Existing project discussions and a few complementary references

The following is context, not reproduced issues:

StepFork materials. The project repository, the pinned quickstart, the pytest-export guide, the replay guide, and the CLI reference are the best starting points for matching the observations to documented behavior. The earlier HF Forum thread also describes a real-model synthetic case study. I did not repeat that live-model experiment; my additional evidence concerns the public CPU quickstart and its negative control.

Known issues rather than new requests. #30, instrumentation coverage concerns visibility into the captured boundaries; #31, retrieval provenance concerns RAG evidence and per-node context; #33, downstream validity after a fork concerns stale responses retained after an upstream override; and #29, redaction coverage concerns sensitive-data regression cases. These were open when checked on October 23, 2026. I have not reproduced any of them, and their status may change. They are useful reference points if the project expands its tests in those directions.

Related but non-identical testing patterns. The OpenAI Agents SDK testing guide and Pydantic AI testing guidance describe controlled or replaceable model behavior. agentverify illustrates explicit assertions about tool interactions and trajectories. LangGraph time travel deals with checkpointing and resuming graph execution, which is distinct from frozen substitution of every instrumented dependency response. These can help a reader choose what to test, but I did not benchmark them against StepFork.

For a broader evaluation perspective, ToolSandbox studies interactions with stateful tools, and tau-bench uses task-level state criteria and repeated trials. These are relevant when someone wants to measure task success beyond a single frozen trace. They do not establish how StepFork performs on those benchmarks, and there is no such benchmark result in my probe.

If I extended the CPU experiment by just one cheap branch, I would probably test could_not_execute for an unimportable entrypoint while the trace bundle itself exists. That would distinguish the already-observed missing-bundle case from a different setup failure. It is optional, not a prerequisite for feedback on the successful red/green path; I have not run it yet.

Bottom line

For the concrete case I tried, StepFork’s offline path worked as documented: I recorded a synthetic failure, verified the trace, replayed an instrumented tool response without executing its body, and generated a test that failed on the original Python decision and passed after its correction with the same failing fixture. The negative control showed why an expectation copied from the recorded mistake is a replay-fidelity check rather than a regression oracle. The CLI’s diff and receipt outputs also made the different result categories inspectable.

My main feedback is therefore about a reproducible useful case and the boundaries that make it meaningful, rather than a new bug report: keep the desired assertion independent of the wrong trace output, make the frozen/instrumented boundary clear, and use a different evaluation route when the change affects tool calls, live-model decisions, or external state. I would not extrapolate this one CPU-only synthetic run into claims about production reliability, but it was a useful first test of the core idea.

Thank you for taking the time to test StepFork so thoroughly and document the results. The three-way comparison is especially useful, and I agree that separating replay fidelity from correctness by using an independently reviewed expected output is essential. Your feedback on making instrumentation boundaries and replay limitations clear is valuable. I really appreciate the reproducible report and detailed suggestions!