stepfork 0.2.0__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (332) hide show
  1. {stepfork-0.2.0 → stepfork-0.3.0}/CHANGELOG.md +116 -0
  2. stepfork-0.3.0/PKG-INFO +195 -0
  3. stepfork-0.3.0/README.md +164 -0
  4. {stepfork-0.2.0 → stepfork-0.3.0}/docs/architecture.md +21 -5
  5. stepfork-0.3.0/docs/assets/stepfork-workflow.png +0 -0
  6. stepfork-0.3.0/docs/baseline-example.md +101 -0
  7. stepfork-0.3.0/docs/baselines.md +105 -0
  8. stepfork-0.3.0/docs/cli.md +888 -0
  9. {stepfork-0.2.0 → stepfork-0.3.0}/docs/community/early-adopter-guide.md +31 -17
  10. {stepfork-0.2.0 → stepfork-0.3.0}/docs/concepts.md +13 -6
  11. {stepfork-0.2.0 → stepfork-0.3.0}/docs/development.md +3 -2
  12. stepfork-0.3.0/docs/diff.md +63 -0
  13. {stepfork-0.2.0 → stepfork-0.3.0}/docs/examples.md +16 -1
  14. {stepfork-0.2.0 → stepfork-0.3.0}/docs/fork.md +93 -23
  15. stepfork-0.3.0/docs/getting-started.md +135 -0
  16. stepfork-0.3.0/docs/index.md +94 -0
  17. {stepfork-0.2.0 → stepfork-0.3.0}/docs/integrations.md +20 -13
  18. {stepfork-0.2.0 → stepfork-0.3.0}/docs/langgraph.md +62 -3
  19. {stepfork-0.2.0 → stepfork-0.3.0}/docs/minimize.md +2 -2
  20. {stepfork-0.2.0 → stepfork-0.3.0}/docs/pypi-publishing.md +7 -6
  21. {stepfork-0.2.0 → stepfork-0.3.0}/docs/pytest-export.md +87 -0
  22. stepfork-0.3.0/docs/rag.md +147 -0
  23. {stepfork-0.2.0 → stepfork-0.3.0}/docs/real-llm-case-study.md +5 -0
  24. {stepfork-0.2.0 → stepfork-0.3.0}/docs/release-checklist.md +25 -17
  25. stepfork-0.3.0/docs/releases/v0.2.0.md +58 -0
  26. stepfork-0.3.0/docs/releases/v0.2.1.md +45 -0
  27. stepfork-0.3.0/docs/releases/v0.3.0.md +48 -0
  28. {stepfork-0.2.0 → stepfork-0.3.0}/docs/replay.md +49 -0
  29. stepfork-0.3.0/docs/trace-format.md +243 -0
  30. {stepfork-0.2.0 → stepfork-0.3.0}/docs/troubleshooting.md +5 -3
  31. stepfork-0.3.0/docs/tutorials/langgraph-triage.md +405 -0
  32. stepfork-0.3.0/examples/coverage/demo.py +84 -0
  33. stepfork-0.3.0/examples/quickstart/README.md +72 -0
  34. stepfork-0.3.0/examples/quickstart/baseline.sftrace/events.jsonl +4 -0
  35. stepfork-0.3.0/examples/quickstart/baseline.sftrace/integrity.json +9 -0
  36. stepfork-0.3.0/examples/quickstart/baseline.sftrace/manifest.json +21 -0
  37. stepfork-0.3.0/examples/quickstart/record_candidate.py +25 -0
  38. stepfork-0.3.0/mkdocs.yml +71 -0
  39. {stepfork-0.2.0 → stepfork-0.3.0}/pyproject.toml +2 -2
  40. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/__init__.py +20 -0
  41. stepfork-0.3.0/src/stepfork/baseline/__init__.py +27 -0
  42. stepfork-0.3.0/src/stepfork/baseline/manager.py +223 -0
  43. stepfork-0.3.0/src/stepfork/cli/baseline.py +206 -0
  44. stepfork-0.3.0/src/stepfork/cli/coverage.py +128 -0
  45. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/cli/diff.py +20 -4
  46. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/cli/export.py +3 -10
  47. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/cli/fork.py +17 -0
  48. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/cli/inspect.py +33 -0
  49. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/cli/main.py +8 -0
  50. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/cli/minimize.py +29 -10
  51. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/cli/replay.py +239 -20
  52. stepfork-0.3.0/src/stepfork/cli/run.py +141 -0
  53. stepfork-0.3.0/src/stepfork/cli/score.py +250 -0
  54. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/cli/validate.py +64 -1
  55. stepfork-0.3.0/src/stepfork/diff/engine.py +548 -0
  56. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/diff/models.py +6 -1
  57. stepfork-0.3.0/src/stepfork/export/__init__.py +44 -0
  58. stepfork-0.3.0/src/stepfork/export/mutants.py +296 -0
  59. stepfork-0.3.0/src/stepfork/export/receipt.py +394 -0
  60. stepfork-0.3.0/src/stepfork/export/scoring.py +226 -0
  61. stepfork-0.3.0/src/stepfork/export/testfile.py +178 -0
  62. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/fork/__init__.py +16 -0
  63. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/fork/engine.py +151 -2
  64. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/fork/models.py +18 -0
  65. stepfork-0.3.0/src/stepfork/fork/provenance.py +250 -0
  66. stepfork-0.3.0/src/stepfork/fork/staleness.py +75 -0
  67. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/inspect/__init__.py +2 -1
  68. stepfork-0.3.0/src/stepfork/inspect/coverage.py +132 -0
  69. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/inspect/inspector.py +88 -4
  70. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/inspect/models.py +21 -0
  71. stepfork-0.3.0/src/stepfork/integrations/langgraph.py +984 -0
  72. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/minimize/engine.py +31 -4
  73. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/minimize/models.py +5 -1
  74. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/minimize/signature.py +92 -5
  75. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/recorder/session.py +81 -2
  76. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/replay/__init__.py +2 -0
  77. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/replay/exceptions.py +4 -0
  78. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/replay/session.py +362 -13
  79. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/trace/__init__.py +62 -0
  80. stepfork-0.3.0/src/stepfork/trace/evidence.py +887 -0
  81. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/trace/integrity.py +73 -4
  82. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/trace/models.py +4 -0
  83. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/trace/storage.py +33 -1
  84. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/trace/validation.py +25 -4
  85. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/version.py +1 -1
  86. stepfork-0.3.0/tests/golden/agents/__init__.py +20 -0
  87. stepfork-0.3.0/tests/golden/agents/crash_agent.py +80 -0
  88. stepfork-0.3.0/tests/golden/agents/fake_llm.py +41 -0
  89. stepfork-0.3.0/tests/golden/agents/triage_agent.py +85 -0
  90. stepfork-0.3.0/tests/golden/successful_run.sftrace/redactions.json +4 -0
  91. stepfork-0.3.0/tests/integration/.gitkeep +0 -0
  92. stepfork-0.3.0/tests/integration/test_baseline_workflow.py +61 -0
  93. stepfork-0.3.0/tests/integration/test_docs_langgraph_tutorial.py +176 -0
  94. stepfork-0.3.0/tests/integration/test_evidence_integration.py +77 -0
  95. stepfork-0.3.0/tests/integration/test_export_pytest_agent_fixtures.py +284 -0
  96. stepfork-0.3.0/tests/property/.gitkeep +0 -0
  97. stepfork-0.3.0/tests/unit/test_baseline.py +211 -0
  98. stepfork-0.3.0/tests/unit/test_cli_baseline.py +244 -0
  99. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_cli_diff.py +3 -0
  100. stepfork-0.3.0/tests/unit/test_cli_error_handling.py +919 -0
  101. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_cli_export.py +32 -0
  102. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_cli_minimize.py +158 -1
  103. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_cli_replay.py +82 -0
  104. stepfork-0.3.0/tests/unit/test_cli_replay_stale.py +90 -0
  105. stepfork-0.3.0/tests/unit/test_cli_run.py +194 -0
  106. stepfork-0.3.0/tests/unit/test_cli_score.py +149 -0
  107. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_cli_validate.py +112 -0
  108. stepfork-0.3.0/tests/unit/test_coverage.py +153 -0
  109. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_diff.py +146 -1
  110. stepfork-0.3.0/tests/unit/test_evidence.py +278 -0
  111. stepfork-0.3.0/tests/unit/test_evidence_fork.py +119 -0
  112. stepfork-0.3.0/tests/unit/test_evidence_privacy.py +127 -0
  113. stepfork-0.3.0/tests/unit/test_evidence_reporting.py +138 -0
  114. stepfork-0.3.0/tests/unit/test_export_mutants.py +187 -0
  115. stepfork-0.3.0/tests/unit/test_export_scoring.py +194 -0
  116. stepfork-0.3.0/tests/unit/test_export_testfile.py +139 -0
  117. stepfork-0.3.0/tests/unit/test_fork_provenance.py +189 -0
  118. stepfork-0.3.0/tests/unit/test_fork_provenance_adversarial.py +401 -0
  119. stepfork-0.3.0/tests/unit/test_fork_staleness.py +147 -0
  120. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_integrity.py +38 -0
  121. stepfork-0.3.0/tests/unit/test_langgraph_evidence.py +440 -0
  122. stepfork-0.3.0/tests/unit/test_minimize_mode_validation.py +141 -0
  123. stepfork-0.3.0/tests/unit/test_minimize_unreached_call.py +211 -0
  124. stepfork-0.3.0/tests/unit/test_recorder_evidence.py +95 -0
  125. stepfork-0.3.0/tests/unit/test_redaction.py +387 -0
  126. stepfork-0.3.0/tests/unit/test_replay_contract.py +112 -0
  127. stepfork-0.3.0/tests/unit/test_replay_contract_changed_args.py +39 -0
  128. stepfork-0.3.0/tests/unit/test_replay_contract_extra_calls.py +47 -0
  129. stepfork-0.3.0/tests/unit/test_replay_fork_staleness.py +96 -0
  130. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_storage.py +99 -0
  131. stepfork-0.2.0/PKG-INFO +0 -481
  132. stepfork-0.2.0/README.md +0 -450
  133. stepfork-0.2.0/docs/assets/stepfork-workflow.png +0 -0
  134. stepfork-0.2.0/docs/cli.md +0 -445
  135. stepfork-0.2.0/docs/diff.md +0 -46
  136. stepfork-0.2.0/docs/getting-started.md +0 -143
  137. stepfork-0.2.0/docs/index.md +0 -76
  138. stepfork-0.2.0/docs/trace-format.md +0 -97
  139. stepfork-0.2.0/examples/quickstart/README.md +0 -57
  140. stepfork-0.2.0/mkdocs.yml +0 -57
  141. stepfork-0.2.0/src/stepfork/diff/engine.py +0 -279
  142. stepfork-0.2.0/src/stepfork/export/__init__.py +0 -20
  143. stepfork-0.2.0/src/stepfork/integrations/langgraph.py +0 -444
  144. stepfork-0.2.0/tests/unit/test_redaction.py +0 -127
  145. {stepfork-0.2.0 → stepfork-0.3.0}/.gitignore +0 -0
  146. {stepfork-0.2.0 → stepfork-0.3.0}/CODE_OF_CONDUCT.md +0 -0
  147. {stepfork-0.2.0 → stepfork-0.3.0}/CONTRIBUTING.md +0 -0
  148. {stepfork-0.2.0 → stepfork-0.3.0}/LICENSE +0 -0
  149. {stepfork-0.2.0 → stepfork-0.3.0}/SECURITY.md +0 -0
  150. {stepfork-0.2.0 → stepfork-0.3.0}/docs/.gitkeep +0 -0
  151. {stepfork-0.2.0 → stepfork-0.3.0}/docs/assets/stepfork-logo.png +0 -0
  152. {stepfork-0.2.0 → stepfork-0.3.0}/docs/hybrid.md +0 -0
  153. {stepfork-0.2.0 → stepfork-0.3.0}/docs/openai.md +0 -0
  154. {stepfork-0.2.0 → stepfork-0.3.0}/docs/recording.md +0 -0
  155. {stepfork-0.2.0 → stepfork-0.3.0}/docs/releases/v0.1.0a1.md +0 -0
  156. {stepfork-0.2.0 → stepfork-0.3.0}/docs/releases/v0.1.0a2.md +0 -0
  157. {stepfork-0.2.0 → stepfork-0.3.0}/docs/releases/v0.1.0a3.md +0 -0
  158. {stepfork-0.2.0 → stepfork-0.3.0}/docs/releases/v0.1.0a4.md +0 -0
  159. {stepfork-0.2.0 → stepfork-0.3.0}/docs/releases/v0.1.0a5.md +0 -0
  160. {stepfork-0.2.0 → stepfork-0.3.0}/docs/releases/v0.1.0a6.md +0 -0
  161. {stepfork-0.2.0 → stepfork-0.3.0}/docs/security.md +0 -0
  162. {stepfork-0.2.0 → stepfork-0.3.0}/examples/__init__.py +0 -0
  163. {stepfork-0.2.0 → stepfork-0.3.0}/examples/booking_agent/__init__.py +0 -0
  164. {stepfork-0.2.0 → stepfork-0.3.0}/examples/booking_agent/agent.py +0 -0
  165. {stepfork-0.2.0 → stepfork-0.3.0}/examples/booking_agent/demo.py +0 -0
  166. {stepfork-0.2.0 → stepfork-0.3.0}/examples/booking_agent/expected.json +0 -0
  167. {stepfork-0.2.0 → stepfork-0.3.0}/examples/langgraph_agent/README.md +0 -0
  168. {stepfork-0.2.0 → stepfork-0.3.0}/examples/langgraph_agent/__init__.py +0 -0
  169. {stepfork-0.2.0 → stepfork-0.3.0}/examples/langgraph_agent/agent.py +0 -0
  170. {stepfork-0.2.0 → stepfork-0.3.0}/examples/langgraph_agent/demo.py +0 -0
  171. {stepfork-0.2.0 → stepfork-0.3.0}/examples/langgraph_agent/expected.json +0 -0
  172. {stepfork-0.2.0 → stepfork-0.3.0}/examples/langgraph_agent/regression/langgraph_failure.sftrace/events.jsonl +0 -0
  173. {stepfork-0.2.0 → stepfork-0.3.0}/examples/langgraph_agent/regression/langgraph_failure.sftrace/integrity.json +0 -0
  174. {stepfork-0.2.0 → stepfork-0.3.0}/examples/langgraph_agent/regression/langgraph_failure.sftrace/manifest.json +0 -0
  175. {stepfork-0.2.0 → stepfork-0.3.0}/examples/langgraph_agent/regression/langgraph_failure.sftrace/redactions.json +0 -0
  176. {stepfork-0.2.0 → stepfork-0.3.0}/examples/langgraph_agent/regression/test_langgraph_regression.py +0 -0
  177. {stepfork-0.2.0 → stepfork-0.3.0}/examples/model_decision/README.md +0 -0
  178. {stepfork-0.2.0 → stepfork-0.3.0}/examples/model_decision/__init__.py +0 -0
  179. {stepfork-0.2.0 → stepfork-0.3.0}/examples/model_decision/agent.py +0 -0
  180. {stepfork-0.2.0 → stepfork-0.3.0}/examples/model_decision/demo.py +0 -0
  181. {stepfork-0.2.0 → stepfork-0.3.0}/examples/openai_chat/README.md +0 -0
  182. {stepfork-0.2.0 → stepfork-0.3.0}/examples/openai_chat/__init__.py +0 -0
  183. {stepfork-0.2.0 → stepfork-0.3.0}/examples/openai_chat/agent.py +0 -0
  184. {stepfork-0.2.0 → stepfork-0.3.0}/examples/openai_chat/demo.py +0 -0
  185. {stepfork-0.2.0 → stepfork-0.3.0}/examples/openai_chat/expected.json +0 -0
  186. {stepfork-0.2.0 → stepfork-0.3.0}/examples/quickstart/__init__.py +0 -0
  187. {stepfork-0.2.0 → stepfork-0.3.0}/examples/quickstart/agent.py +0 -0
  188. {stepfork-0.2.0/examples/real-llm-case-study/traces/incident-triage.sftrace → stepfork-0.3.0/examples/quickstart/baseline.sftrace}/redactions.json +0 -0
  189. {stepfork-0.2.0 → stepfork-0.3.0}/examples/quickstart/demo.py +0 -0
  190. {stepfork-0.2.0 → stepfork-0.3.0}/examples/quickstart/expected.json +0 -0
  191. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/.gitignore +0 -0
  192. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/.python-version +0 -0
  193. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/CASE_STUDY.md +0 -0
  194. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/README.md +0 -0
  195. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/RESULTS.md +0 -0
  196. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/agent.py +0 -0
  197. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/counters.py +0 -0
  198. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/evidence/README.md +0 -0
  199. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/evidence/clean_install_verification.txt +0 -0
  200. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/evidence/divergence.txt +0 -0
  201. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/evidence/fix.diff +0 -0
  202. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/evidence/frozen_replay.txt +0 -0
  203. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/evidence/full_suite.txt +0 -0
  204. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/evidence/green_pass.txt +0 -0
  205. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/evidence/hybrid_comparison.json +0 -0
  206. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/evidence/red_failure.txt +0 -0
  207. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/expected.json +0 -0
  208. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/fix.diff +0 -0
  209. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/fixtures/deployments.json +0 -0
  210. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/fixtures/runbooks.json +0 -0
  211. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/fixtures/services.json +0 -0
  212. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/provider.py +0 -0
  213. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/pyproject.toml +0 -0
  214. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/scenario_a.py +0 -0
  215. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/scenario_b.py +0 -0
  216. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/scripts/hybrid_prompt_comparison.py +0 -0
  217. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/scripts/record_incident.py +0 -0
  218. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/scripts/verify_frozen.py +0 -0
  219. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/snapshots/agent_buggy.py +0 -0
  220. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/snapshots/agent_fixed.py +0 -0
  221. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/tests/test_frozen_replay_guards.py +0 -0
  222. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/tests/test_incident_regression.py +0 -0
  223. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/tests/test_scenario_a_refactor.py +0 -0
  224. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/tests/test_scenario_b_divergence.py +0 -0
  225. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/traces/incident-triage.sftrace/events.jsonl +0 -0
  226. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/traces/incident-triage.sftrace/integrity.json +0 -0
  227. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/traces/incident-triage.sftrace/manifest.json +0 -0
  228. {stepfork-0.2.0/tests/golden/diff_baseline.sftrace → stepfork-0.3.0/examples/real-llm-case-study/traces/incident-triage.sftrace}/redactions.json +0 -0
  229. {stepfork-0.2.0 → stepfork-0.3.0}/examples/real-llm-case-study/uv.lock +0 -0
  230. {stepfork-0.2.0 → stepfork-0.3.0}/examples/refund_agent/__init__.py +0 -0
  231. {stepfork-0.2.0 → stepfork-0.3.0}/examples/refund_agent/agent.py +0 -0
  232. {stepfork-0.2.0 → stepfork-0.3.0}/examples/refund_agent/demo.py +0 -0
  233. {stepfork-0.2.0 → stepfork-0.3.0}/examples/refund_agent/expected.json +0 -0
  234. {stepfork-0.2.0 → stepfork-0.3.0}/scripts/terminal-demo/README.md +0 -0
  235. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/__main__.py +0 -0
  236. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/assertions.py +0 -0
  237. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/cli/__init__.py +0 -0
  238. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/diff/__init__.py +0 -0
  239. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/diff/compare.py +0 -0
  240. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/export/entrypoint.py +0 -0
  241. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/export/generator.py +0 -0
  242. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/export/runtime.py +0 -0
  243. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/fork/overrides.py +0 -0
  244. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/integrations/__init__.py +0 -0
  245. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/integrations/openai.py +0 -0
  246. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/minimize/__init__.py +0 -0
  247. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/minimize/delta_debug.py +0 -0
  248. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/py.typed +0 -0
  249. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/recorder/__init__.py +0 -0
  250. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/recorder/llm.py +0 -0
  251. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/recorder/tooling.py +0 -0
  252. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/replay/plan.py +0 -0
  253. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/trace/canonical.py +0 -0
  254. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/trace/hashing.py +0 -0
  255. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/trace/jsonable.py +0 -0
  256. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/trace/manifest.py +0 -0
  257. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/trace/redaction.py +0 -0
  258. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/trace/replay_policy.py +0 -0
  259. {stepfork-0.2.0 → stepfork-0.3.0}/src/stepfork/trace/schema.py +0 -0
  260. /stepfork-0.2.0/tests/golden/.gitkeep → /stepfork-0.3.0/tests/__init__.py +0 -0
  261. {stepfork-0.2.0/tests/integration → stepfork-0.3.0/tests/golden}/.gitkeep +0 -0
  262. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/README.md +0 -0
  263. /stepfork-0.2.0/tests/property/.gitkeep → /stepfork-0.3.0/tests/golden/__init__.py +0 -0
  264. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/build_fixtures.py +0 -0
  265. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/diff_baseline.sftrace/events.jsonl +0 -0
  266. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/diff_baseline.sftrace/integrity.json +0 -0
  267. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/diff_baseline.sftrace/manifest.json +0 -0
  268. {stepfork-0.2.0/tests/golden/diff_changed.sftrace → stepfork-0.3.0/tests/golden/diff_baseline.sftrace}/redactions.json +0 -0
  269. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/diff_changed.sftrace/events.jsonl +0 -0
  270. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/diff_changed.sftrace/integrity.json +0 -0
  271. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/diff_changed.sftrace/manifest.json +0 -0
  272. {stepfork-0.2.0/tests/golden/failed_llm_run.sftrace → stepfork-0.3.0/tests/golden/diff_changed.sftrace}/redactions.json +0 -0
  273. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/failed_llm_run.sftrace/events.jsonl +0 -0
  274. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/failed_llm_run.sftrace/integrity.json +0 -0
  275. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/failed_llm_run.sftrace/manifest.json +0 -0
  276. {stepfork-0.2.0/tests/golden/legacy_v01.sftrace → stepfork-0.3.0/tests/golden/failed_llm_run.sftrace}/redactions.json +0 -0
  277. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/failed_tool_run.sftrace/events.jsonl +0 -0
  278. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/failed_tool_run.sftrace/integrity.json +0 -0
  279. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/failed_tool_run.sftrace/manifest.json +0 -0
  280. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/failed_tool_run.sftrace/redactions.json +0 -0
  281. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/legacy_v01.sftrace/events.jsonl +0 -0
  282. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/legacy_v01.sftrace/manifest.json +0 -0
  283. {stepfork-0.2.0/tests/golden/partial_run.sftrace → stepfork-0.3.0/tests/golden/legacy_v01.sftrace}/redactions.json +0 -0
  284. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/partial_run.sftrace/events.jsonl +0 -0
  285. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/partial_run.sftrace/integrity.json +0 -0
  286. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/partial_run.sftrace/manifest.json +0 -0
  287. {stepfork-0.2.0/tests/golden/successful_run.sftrace → stepfork-0.3.0/tests/golden/partial_run.sftrace}/redactions.json +0 -0
  288. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/successful_run.sftrace/events.jsonl +0 -0
  289. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/successful_run.sftrace/integrity.json +0 -0
  290. {stepfork-0.2.0 → stepfork-0.3.0}/tests/golden/successful_run.sftrace/manifest.json +0 -0
  291. {stepfork-0.2.0 → stepfork-0.3.0}/tests/integration/test_docs_assets.py +0 -0
  292. {stepfork-0.2.0 → stepfork-0.3.0}/tests/integration/test_docs_langgraph_example.py +0 -0
  293. {stepfork-0.2.0 → stepfork-0.3.0}/tests/integration/test_failure_to_test.py +0 -0
  294. {stepfork-0.2.0 → stepfork-0.3.0}/tests/integration/test_fork_integration.py +0 -0
  295. {stepfork-0.2.0 → stepfork-0.3.0}/tests/integration/test_golden_fixtures.py +0 -0
  296. {stepfork-0.2.0 → stepfork-0.3.0}/tests/integration/test_langgraph_agent.py +0 -0
  297. {stepfork-0.2.0 → stepfork-0.3.0}/tests/integration/test_minimize_integration.py +0 -0
  298. {stepfork-0.2.0 → stepfork-0.3.0}/tests/integration/test_model_decision_demo.py +0 -0
  299. {stepfork-0.2.0 → stepfork-0.3.0}/tests/integration/test_quickstart_failure_to_test.py +0 -0
  300. {stepfork-0.2.0 → stepfork-0.3.0}/tests/integration/test_refund_failure_to_test.py +0 -0
  301. {stepfork-0.2.0 → stepfork-0.3.0}/tests/integration/test_secure_trace_roundtrip.py +0 -0
  302. {stepfork-0.2.0 → stepfork-0.3.0}/tests/integration/test_trace_infrastructure_flow.py +0 -0
  303. {stepfork-0.2.0 → stepfork-0.3.0}/tests/integration/test_trace_roundtrip.py +0 -0
  304. {stepfork-0.2.0 → stepfork-0.3.0}/tests/property/test_trace_properties.py +0 -0
  305. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_assertions.py +0 -0
  306. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_async_boundaries.py +0 -0
  307. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_canonical.py +0 -0
  308. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_cli.py +0 -0
  309. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_cli_inspect.py +0 -0
  310. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_export.py +0 -0
  311. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_fork_edge_cases.py +0 -0
  312. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_fork_engine.py +0 -0
  313. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_fork_overrides.py +0 -0
  314. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_hashing.py +0 -0
  315. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_hybrid_replay.py +0 -0
  316. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_inspector.py +0 -0
  317. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_invalid_bundles.py +0 -0
  318. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_jsonable.py +0 -0
  319. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_langgraph_integration.py +0 -0
  320. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_live_tool_authorization.py +0 -0
  321. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_llm_request.py +0 -0
  322. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_manifest.py +0 -0
  323. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_minimize_delta_debug.py +0 -0
  324. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_minimize_signature.py +0 -0
  325. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_openai_integration.py +0 -0
  326. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_recording_session.py +0 -0
  327. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_replay_plan.py +0 -0
  328. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_replay_tool.py +0 -0
  329. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_schema.py +0 -0
  330. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_trace_models.py +0 -0
  331. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_trace_tool.py +0 -0
  332. {stepfork-0.2.0 → stepfork-0.3.0}/tests/unit/test_validation.py +0 -0
@@ -4,6 +4,122 @@ All notable changes to Stepfork are recorded here. The format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/), and this project adheres to
5
5
  [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [0.3.0] - 2026-11-29
8
+
9
+ First published release with the LangGraph retrieval and node-context evidence
10
+ APIs from issue #31. The `.sftrace` v0.1 format is unchanged.
11
+
12
+ ### Added
13
+
14
+ - LangGraph `traced_node` records per-node digest, access, and status evidence
15
+ for instrumented nodes, including context digests and optional captured
16
+ values.
17
+ - LangGraph `capture_retrieval` records query, item, and results evidence with
18
+ configurable capture modes and best-effort redaction.
19
+ - LangGraph `record_assembled_context` associates context evidence with the
20
+ active node and can reference a recorded LLM request.
21
+ - Optional `evidence.json` sidecar persists retrieval and node-context records.
22
+ When read, evidence references and digests are validated against the trace.
23
+ Integrity-manifest verification is separate and runs only when
24
+ `verify_integrity` is enabled.
25
+
26
+ ### Fixed
27
+
28
+ - `record_assembled_context(event_id=...)` now checks the referenced event in
29
+ the active recording. It no longer mislabels tool calls or other event types
30
+ as `llm_request` evidence; unsupported event references and explicitly
31
+ supplied invalid IDs are rejected clearly. Omitting `event_id` is allowed and
32
+ produces `kind="unavailable"`.
33
+ - Documentation now describes the actual fork-provenance classification:
34
+ `unavailable` is reserved for unreadable provenance and parent-bundle digest
35
+ mismatches, not merely missing or legacy provenance.
36
+
37
+ ### Changed
38
+
39
+ - Package `Development Status` classifier moves from `2 - Pre-Alpha` to
40
+ `3 - Alpha`. The API and trace format remain experimental, but the recorder,
41
+ replay engine, CLI, and test export are now bounded enough for alpha use.
42
+ - Release-facing docs describe v0.3.0 as the current release instead of
43
+ separating published and current-`main` features.
44
+
45
+ ### Documentation
46
+
47
+ - Add a v0.3.0 release page and update the landing pages, quickstart,
48
+ early-adopter guide, trace-format bundle layout, and developer counts.
49
+ - Update the release checklist to use the committed trusted-publishing workflow
50
+ rather than recommending manual `uv publish`.
51
+ - Clarify that evidence and integrity metadata are historical observations and
52
+ not current-source or cryptographic authenticity claims.
53
+
54
+ ### Limitations
55
+
56
+ - LLM request attribution for assembled context remains limited to recorded
57
+ `llm_request` events; tool-call references remain in
58
+ `source_event_ids` rather than `assembled_context_source`.
59
+ - Streaming model calls are not supported by the adapters.
60
+ - Redaction is best-effort, integrity hashes are not signatures, and replay is
61
+ not a sandbox.
62
+
63
+ ## [0.2.1] - 2026-10-20
64
+
65
+ Minimization correctness fixes, tri-state regression verdicts, and expectation
66
+ scoring on top of v0.2.0. No `.sftrace` format change.
67
+
68
+ ### Added
69
+
70
+ - **`stepfork run`** executes an exported pytest regression test and writes a
71
+ machine-readable receipt. It reports a tri-state verdict (`passed`, `failed`,
72
+ or `could_not_execute`), so a check that never ran (for example, a missing
73
+ bundle) is not reported as a detected regression. Exit status is 0 for a
74
+ pass, 1 for a failure, and 2 for `could_not_execute`.
75
+ - **`stepfork score`** scores an exported expectation against a mutant battery
76
+ derived from both the recorded run and the claim, reporting whether the
77
+ expectation is claim-pinned (rejects the recorded run) or run-pinned.
78
+ - Claim-drawn mutant battery and expectation scoring internals
79
+ (`export/mutants.py`, `export/scoring.py`, `export/testfile.py`).
80
+ - Receipt writer owned by the runner (`export/receipt.py`) that records the
81
+ bundle digest, test hash, counts, and verdict outside the tree under test.
82
+ - Integration agent fixtures for the export-to-pytest path
83
+ (`tests/golden/agents/{triage_agent,crash_agent,fake_llm}.py`) plus 12
84
+ end-to-end tests covering changed-argument and extra-call divergence and
85
+ secret redaction.
86
+ - Regression test proving minimized failed traces retain `run_end` when
87
+ minimization keeps a non-contiguous event subset.
88
+
89
+ ### Fixed
90
+
91
+ - `minimize` now validates `--mode` up front and rejects invalid modes with
92
+ exit 2 instead of silently minimizing a failure that never existed.
93
+ - `minimize` refuses failure signatures produced by Stepfork's own errors
94
+ (for example `ReplayPolicyError`) and by a replay that never reached the
95
+ recorded call, rather than treating them as the failure under test.
96
+ - `minimize` no longer drops `run_end` from a minimized failed trace; the CLI
97
+ saves the events the engine actually kept instead of slicing the original
98
+ trace by index.
99
+ - `minimize` no longer prints `Minimal: No` beside an "already minimal"
100
+ warning; a successfully minimized trace reports `Minimal: Yes`.
101
+ - `replay` and `export` accept the `-e` short flag for `--entrypoint`, matching
102
+ `minimize`.
103
+
104
+ ### Changed
105
+
106
+ - Export scoring no longer reports a fix-side test as a claim-pinned oracle by
107
+ construction; the verdict describes where the bundle came from.
108
+ - Replay extra-call tests are pinned to `ReplayExhaustedError`.
109
+
110
+ ### Documentation
111
+
112
+ - State the frozen-replay export boundary in `docs/pytest-export.md` and add
113
+ divergence troubleshooting.
114
+ - Drop leftover `pip install --pre stepfork` instructions and note the
115
+ fix-side score verdict.
116
+ - Document `stepfork run` and its exit codes.
117
+
118
+ ### Limitations
119
+
120
+ - The minimization, fork, and verdict limitations listed under v0.2.0 still
121
+ apply.
122
+
7
123
  ## [0.2.0] - 2026-10-12
8
124
 
9
125
  Automatic failure minimization and fork-at-step debugging with optional overrides.
@@ -0,0 +1,195 @@
1
+ Metadata-Version: 2.5
2
+ Name: stepfork
3
+ Version: 0.3.0
4
+ Summary: Open-source behavioral regression testing for AI agents.
5
+ Project-URL: Homepage, https://github.com/utsab345/stepfork
6
+ Project-URL: Repository, https://github.com/utsab345/stepfork
7
+ Project-URL: Issues, https://github.com/utsab345/stepfork/issues
8
+ Project-URL: PyPI, https://pypi.org/project/stepfork/
9
+ Author: Utsab Dahal
10
+ License: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: agents,ai,debugging,llm,pytest,regression-testing,replay,testing
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Software Development :: Testing
21
+ Requires-Python: <3.14,>=3.11
22
+ Requires-Dist: pydantic>=2.0
23
+ Requires-Dist: rich>=13.0
24
+ Requires-Dist: typer>=0.12
25
+ Provides-Extra: langgraph
26
+ Requires-Dist: langchain-core>=1.0; extra == 'langgraph'
27
+ Requires-Dist: langgraph>=1.0; extra == 'langgraph'
28
+ Provides-Extra: openai
29
+ Requires-Dist: openai>=1.0; extra == 'openai'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # Stepfork
33
+
34
+ **Open-source behavioral regression testing for AI agents.**
35
+
36
+ Record failed AI agent executions locally, replay instrumented dependencies, compare behavior, and export reproducible pytest regression tests.
37
+
38
+ [PyPI](https://pypi.org/project/stepfork/) ·
39
+ [Documentation](https://utsab345.github.io/stepfork/) ·
40
+ [CI](https://github.com/utsab345/stepfork/actions/workflows/ci.yml) ·
41
+ [Issues](https://github.com/utsab345/stepfork/issues)
42
+
43
+ ## The problem
44
+
45
+ Unit tests often miss regressions in multi-step agent behavior. A recorded run
46
+ can show what the agent called and returned, but replaying against live tools or
47
+ models makes a regression test slow, costly, and nondeterministic.
48
+
49
+ Stepfork captures instrumented dependency calls in a local trace and replays
50
+ their recorded responses. You can compare runs and export a pytest test with an
51
+ explicit expectation for the corrected behavior.
52
+
53
+ ## How it works
54
+
55
+ Wrap the tool and LLM boundaries you want captured. Frozen replay strictly
56
+ matches those boundaries and substitutes recorded responses, so the wrapped
57
+ bodies are not run again. Calls outside instrumented boundaries are not
58
+ intercepted.
59
+
60
+ 1. **Record** a failed or completed run into a local `.sftrace` bundle.
61
+ 2. **Inspect** the events, integrity metadata, and failure details.
62
+ 3. **Replay** the entrypoint with instrumented dependencies frozen.
63
+ 4. **Diff** the recorded behavior against a corrected run.
64
+ 5. **Export** a pytest regression test with an explicit expectation.
65
+ 6. **Test** the buggy entrypoint and the fixed entrypoint with pytest.
66
+
67
+ ![Stepfork workflow](assets/stepfork-workflow.png)
68
+
69
+ ## Features
70
+
71
+ ### In v0.3.0
72
+
73
+ - Record completed and failed runs as local `.sftrace` bundles.
74
+ - Inspect and validate traces; check bundle integrity.
75
+ - Replay instrumented tool and LLM calls with recorded responses.
76
+ - Compare traces and inspect behavior-level differences.
77
+ - Report coverage of observed instrumented calls. Calls outside instrumented
78
+ boundaries are not measured.
79
+ - Save named local baselines and gate trace changes in CI
80
+ ([guide](docs/baselines.md), [runnable example](docs/baseline-example.md)).
81
+ - Export pytest regression tests with output and trajectory expectations.
82
+ - Minimize failing traces and fork traces at a selected step.
83
+ - Use optional OpenAI Python SDK and LangGraph adapters for supported
84
+ non-streaming boundaries.
85
+ - Capture optional retrieval evidence and per-node context through LangGraph
86
+ `traced_node`, `capture_retrieval`, and `record_assembled_context`; see
87
+ [RAG evidence](docs/rag.md).
88
+ - Best-effort redaction of common credential patterns when recording.
89
+
90
+ Streaming model calls are not supported by the adapters.
91
+
92
+ Stepfork is experimental. Redaction is not a guarantee against sensitive-data
93
+ leaks, integrity hashes are not signatures, and replay is not a sandbox. See
94
+ [security notes](docs/security.md).
95
+
96
+ ## Installation
97
+
98
+ Requires Python 3.11, 3.12, or 3.13.
99
+
100
+ Install the v0.3.0 release from PyPI:
101
+
102
+ ```bash
103
+ pip install "stepfork==0.3.0"
104
+ ```
105
+
106
+ For a contributor checkout or the latest development changes, install from
107
+ source:
108
+
109
+ ```bash
110
+ pip install "git+https://github.com/utsab345/stepfork.git@main"
111
+ ```
112
+
113
+ See the [development instructions](docs/development.md) for contributor setup.
114
+
115
+ Install an adapter only if needed:
116
+
117
+ ```bash
118
+ pip install "stepfork[openai]"
119
+ pip install "stepfork[langgraph]"
120
+ ```
121
+
122
+ ## Quick start
123
+
124
+ Save this as `quickstart.py`. The example records a shipped order that the
125
+ buggy agent fails to notify about.
126
+
127
+ ```python
128
+ from stepfork import record, trace_tool
129
+
130
+
131
+ @trace_tool
132
+ def order_status(order_id: str) -> dict[str, str]:
133
+ return {"order_id": order_id, "status": "shipped"}
134
+
135
+
136
+ def run_agent() -> dict[str, bool]:
137
+ order = order_status("ORD-1001")
138
+ return {"notify": order["status"] == "delivered"} # Bug: should notify on shipment
139
+
140
+
141
+ if __name__ == "__main__":
142
+ with record("order-agent", output="failure.sftrace") as session:
143
+ result = run_agent()
144
+ session.set_output(result)
145
+ print(result)
146
+ ```
147
+
148
+ Run the CLI commands from the directory containing `quickstart.py`. The CLI
149
+ resolves `--entrypoint` from the current working directory; use `PYTHONPATH` if
150
+ the module lives elsewhere.
151
+
152
+ ```bash
153
+ python -m pip install pytest
154
+ python quickstart.py
155
+ stepfork inspect failure.sftrace
156
+ stepfork replay failure.sftrace --entrypoint quickstart:run_agent --mode frozen
157
+ printf '{"notify": true}\n' > expected.json
158
+ stepfork export failure.sftrace \
159
+ --entrypoint quickstart:run_agent \
160
+ --expect-output expected.json \
161
+ --output test_order_regression.py
162
+ ```
163
+
164
+ Change the condition in `run_agent` to check for `"shipped"`, then run
165
+ `python -m pytest -q test_order_regression.py`. See the
166
+ [five-minute quickstart](docs/getting-started.md) for inspect, validate, diff,
167
+ and red-green pytest commands.
168
+
169
+ See the [terminal demo](scripts/terminal-demo/stepfork-demo.gif).
170
+
171
+ ## Integrations
172
+
173
+ The core API is framework-independent. Optional adapters currently support:
174
+
175
+ - **OpenAI Python SDK:** sync and async, non-streaming
176
+ `chat.completions.create`.
177
+ - **LangGraph / LangChain:** sync and async non-streaming chat-model generation
178
+ and wrapped function tools. v0.3.0 also adds optional node and retrieval
179
+ evidence. Streaming is not supported.
180
+
181
+ Offline GitHub Actions examples cover frozen replay and named baseline
182
+ comparisons without provider credentials. Stepfork does not currently provide
183
+ a reusable GitHub Action or an MCP adapter. See the
184
+ [integration details](docs/integrations.md).
185
+
186
+ ## Contributing
187
+
188
+ Contributions are welcome. Read the [contribution guide](CONTRIBUTING.md) and
189
+ [development instructions](docs/development.md), then open an issue or pull
190
+ request. Please do not include credentials or unreviewed trace data in issues,
191
+ tests, or commits.
192
+
193
+ ## License
194
+
195
+ Apache-2.0. See [LICENSE](LICENSE).
@@ -0,0 +1,164 @@
1
+ # Stepfork
2
+
3
+ **Open-source behavioral regression testing for AI agents.**
4
+
5
+ Record failed AI agent executions locally, replay instrumented dependencies, compare behavior, and export reproducible pytest regression tests.
6
+
7
+ [PyPI](https://pypi.org/project/stepfork/) ·
8
+ [Documentation](https://utsab345.github.io/stepfork/) ·
9
+ [CI](https://github.com/utsab345/stepfork/actions/workflows/ci.yml) ·
10
+ [Issues](https://github.com/utsab345/stepfork/issues)
11
+
12
+ ## The problem
13
+
14
+ Unit tests often miss regressions in multi-step agent behavior. A recorded run
15
+ can show what the agent called and returned, but replaying against live tools or
16
+ models makes a regression test slow, costly, and nondeterministic.
17
+
18
+ Stepfork captures instrumented dependency calls in a local trace and replays
19
+ their recorded responses. You can compare runs and export a pytest test with an
20
+ explicit expectation for the corrected behavior.
21
+
22
+ ## How it works
23
+
24
+ Wrap the tool and LLM boundaries you want captured. Frozen replay strictly
25
+ matches those boundaries and substitutes recorded responses, so the wrapped
26
+ bodies are not run again. Calls outside instrumented boundaries are not
27
+ intercepted.
28
+
29
+ 1. **Record** a failed or completed run into a local `.sftrace` bundle.
30
+ 2. **Inspect** the events, integrity metadata, and failure details.
31
+ 3. **Replay** the entrypoint with instrumented dependencies frozen.
32
+ 4. **Diff** the recorded behavior against a corrected run.
33
+ 5. **Export** a pytest regression test with an explicit expectation.
34
+ 6. **Test** the buggy entrypoint and the fixed entrypoint with pytest.
35
+
36
+ ![Stepfork workflow](assets/stepfork-workflow.png)
37
+
38
+ ## Features
39
+
40
+ ### In v0.3.0
41
+
42
+ - Record completed and failed runs as local `.sftrace` bundles.
43
+ - Inspect and validate traces; check bundle integrity.
44
+ - Replay instrumented tool and LLM calls with recorded responses.
45
+ - Compare traces and inspect behavior-level differences.
46
+ - Report coverage of observed instrumented calls. Calls outside instrumented
47
+ boundaries are not measured.
48
+ - Save named local baselines and gate trace changes in CI
49
+ ([guide](docs/baselines.md), [runnable example](docs/baseline-example.md)).
50
+ - Export pytest regression tests with output and trajectory expectations.
51
+ - Minimize failing traces and fork traces at a selected step.
52
+ - Use optional OpenAI Python SDK and LangGraph adapters for supported
53
+ non-streaming boundaries.
54
+ - Capture optional retrieval evidence and per-node context through LangGraph
55
+ `traced_node`, `capture_retrieval`, and `record_assembled_context`; see
56
+ [RAG evidence](docs/rag.md).
57
+ - Best-effort redaction of common credential patterns when recording.
58
+
59
+ Streaming model calls are not supported by the adapters.
60
+
61
+ Stepfork is experimental. Redaction is not a guarantee against sensitive-data
62
+ leaks, integrity hashes are not signatures, and replay is not a sandbox. See
63
+ [security notes](docs/security.md).
64
+
65
+ ## Installation
66
+
67
+ Requires Python 3.11, 3.12, or 3.13.
68
+
69
+ Install the v0.3.0 release from PyPI:
70
+
71
+ ```bash
72
+ pip install "stepfork==0.3.0"
73
+ ```
74
+
75
+ For a contributor checkout or the latest development changes, install from
76
+ source:
77
+
78
+ ```bash
79
+ pip install "git+https://github.com/utsab345/stepfork.git@main"
80
+ ```
81
+
82
+ See the [development instructions](docs/development.md) for contributor setup.
83
+
84
+ Install an adapter only if needed:
85
+
86
+ ```bash
87
+ pip install "stepfork[openai]"
88
+ pip install "stepfork[langgraph]"
89
+ ```
90
+
91
+ ## Quick start
92
+
93
+ Save this as `quickstart.py`. The example records a shipped order that the
94
+ buggy agent fails to notify about.
95
+
96
+ ```python
97
+ from stepfork import record, trace_tool
98
+
99
+
100
+ @trace_tool
101
+ def order_status(order_id: str) -> dict[str, str]:
102
+ return {"order_id": order_id, "status": "shipped"}
103
+
104
+
105
+ def run_agent() -> dict[str, bool]:
106
+ order = order_status("ORD-1001")
107
+ return {"notify": order["status"] == "delivered"} # Bug: should notify on shipment
108
+
109
+
110
+ if __name__ == "__main__":
111
+ with record("order-agent", output="failure.sftrace") as session:
112
+ result = run_agent()
113
+ session.set_output(result)
114
+ print(result)
115
+ ```
116
+
117
+ Run the CLI commands from the directory containing `quickstart.py`. The CLI
118
+ resolves `--entrypoint` from the current working directory; use `PYTHONPATH` if
119
+ the module lives elsewhere.
120
+
121
+ ```bash
122
+ python -m pip install pytest
123
+ python quickstart.py
124
+ stepfork inspect failure.sftrace
125
+ stepfork replay failure.sftrace --entrypoint quickstart:run_agent --mode frozen
126
+ printf '{"notify": true}\n' > expected.json
127
+ stepfork export failure.sftrace \
128
+ --entrypoint quickstart:run_agent \
129
+ --expect-output expected.json \
130
+ --output test_order_regression.py
131
+ ```
132
+
133
+ Change the condition in `run_agent` to check for `"shipped"`, then run
134
+ `python -m pytest -q test_order_regression.py`. See the
135
+ [five-minute quickstart](docs/getting-started.md) for inspect, validate, diff,
136
+ and red-green pytest commands.
137
+
138
+ See the [terminal demo](scripts/terminal-demo/stepfork-demo.gif).
139
+
140
+ ## Integrations
141
+
142
+ The core API is framework-independent. Optional adapters currently support:
143
+
144
+ - **OpenAI Python SDK:** sync and async, non-streaming
145
+ `chat.completions.create`.
146
+ - **LangGraph / LangChain:** sync and async non-streaming chat-model generation
147
+ and wrapped function tools. v0.3.0 also adds optional node and retrieval
148
+ evidence. Streaming is not supported.
149
+
150
+ Offline GitHub Actions examples cover frozen replay and named baseline
151
+ comparisons without provider credentials. Stepfork does not currently provide
152
+ a reusable GitHub Action or an MCP adapter. See the
153
+ [integration details](docs/integrations.md).
154
+
155
+ ## Contributing
156
+
157
+ Contributions are welcome. Read the [contribution guide](CONTRIBUTING.md) and
158
+ [development instructions](docs/development.md), then open an issue or pull
159
+ request. Please do not include credentials or unreviewed trace data in issues,
160
+ tests, or commits.
161
+
162
+ ## License
163
+
164
+ Apache-2.0. See [LICENSE](LICENSE).
@@ -14,9 +14,14 @@ failed agent run
14
14
  |
15
15
  behavioral diff src/stepfork/diff/
16
16
  |
17
+ minimize failure src/stepfork/minimize/
18
+ |
17
19
  pytest export src/stepfork/export/
18
20
  ```
19
21
 
22
+ `fork/` creates a trace from a selected step. `score/` assesses expectations
23
+ in exported tests; neither is required for the record-to-regression workflow.
24
+
20
25
  The `.sftrace` format and its storage, validation, redaction, and integrity
21
26
  logic all live under `src/stepfork/trace/` and are documented in
22
27
  [trace-format.md](trace-format.md).
@@ -60,6 +65,12 @@ Compares two traces as behavior. `engine.py` extracts ordered `BehaviorStep`
60
65
  entries and aligns them; `compare.py` computes structural field differences;
61
66
  `models.py` defines the machine-readable `DiffResult`.
62
67
 
68
+ ### `baseline/`
69
+
70
+ Stores named, integrity-verified `.sftrace` bundles under a local directory.
71
+ It validates trace compatibility and delegates behavioral comparisons to
72
+ `diff_traces`; it does not introduce another trace format.
73
+
63
74
  ### `export/`
64
75
 
65
76
  Generates the regression test.
@@ -78,8 +89,9 @@ Read-only summaries of a bundle for the `stepfork inspect` command.
78
89
 
79
90
  ### `cli/`
80
91
 
81
- Typer commands: `validate`, `inspect`, `replay`, `diff`, `export`, wired in
82
- `cli/main.py`. `src/stepfork/__main__.py` provides `python -m stepfork`.
92
+ Typer commands: `validate`, `inspect`, `replay`, `diff`, `export`, `minimize`,
93
+ `fork`, `score`, `run`, and `baseline`, wired in `cli/main.py`.
94
+ `src/stepfork/__main__.py` provides `python -m stepfork`.
83
95
 
84
96
  ## Security boundaries
85
97
 
@@ -90,7 +102,11 @@ Typer commands: `validate`, `inspect`, `replay`, `diff`, `export`, wired in
90
102
  - Integrity metadata is a checksum, not a signature; see
91
103
  [security.md](security.md).
92
104
 
93
- ## Reserved packages
105
+ ## Trace operations
94
106
 
95
- `fork/` and `minimize/` are placeholders for v0.2 (fork-at-step and failure
96
- minimization) and contain no v0.1 behavior.
107
+ - `fork/` builds a new trace from a selected step and supports event-output
108
+ overrides through the Python API.
109
+ - `minimize/` reduces a trace while checking whether the selected failure
110
+ continues to reproduce.
111
+ - `score/` is part of `export/`; it evaluates exported expectations without
112
+ executing the entrypoint.
@@ -0,0 +1,101 @@
1
+ # Baseline comparison example
2
+
3
+ This standalone example saves a reviewed trace as a baseline, compares a matching
4
+ candidate, then records a buggy candidate and detects the regression. It uses
5
+ the offline `examples/quickstart` agent and adds no dependencies.
6
+
7
+ Run it from a checkout of this repository. The shell commands use a
8
+ POSIX-compatible shell. On Windows, use WSL, Git Bash, or PowerShell equivalents
9
+ for `rm -rf` and heredoc redirection:
10
+
11
+ ```bash
12
+ git clone https://github.com/utsab345/stepfork.git
13
+ cd stepfork
14
+ uv sync
15
+ ```
16
+
17
+ ## 1. Save a reviewed baseline
18
+
19
+ `stepfork baseline save` never replaces an existing name. Remove the example
20
+ store first so this walkthrough is repeatable:
21
+
22
+ ```bash
23
+ rm -rf .stepfork/example-baselines
24
+
25
+ uv run stepfork baseline save quickstart-order \
26
+ examples/quickstart/baseline.sftrace \
27
+ --directory .stepfork/example-baselines
28
+
29
+ uv run stepfork baseline list --directory .stepfork/example-baselines
30
+ ```
31
+
32
+ The reviewed trace is copied under `.stepfork/example-baselines/`. It stays a
33
+ normal `.sftrace` bundle.
34
+
35
+ ## 2. Compare a matching candidate
36
+
37
+ `record_candidate.py` records the corrected deterministic agent:
38
+
39
+ ```bash
40
+ uv run python -m examples.quickstart.record_candidate --output baseline-candidate.sftrace
41
+
42
+ uv run stepfork baseline compare quickstart-order baseline-candidate.sftrace \
43
+ --directory .stepfork/example-baselines
44
+
45
+ echo "match exit code: $?"
46
+ ```
47
+
48
+ Expected result: `Result: BASELINE MATCH` and exit code `0`.
49
+
50
+ ## 3. Compare a regressed candidate
51
+
52
+ Create a small recording script for the buggy entrypoint. This is a local file
53
+ created by the example; it is not a new project dependency:
54
+
55
+ ```bash
56
+ cat > record_regression_candidate.py <<'PY'
57
+ from examples.quickstart import run_agent
58
+ from stepfork import record
59
+
60
+ with record("order-agent", output="regression-candidate.sftrace") as session:
61
+ result = run_agent()
62
+ session.set_output(result)
63
+
64
+ print(result)
65
+ PY
66
+
67
+ uv run python record_regression_candidate.py
68
+
69
+ uv run stepfork baseline compare quickstart-order regression-candidate.sftrace \
70
+ --directory .stepfork/example-baselines
71
+
72
+ echo "regression exit code: $?"
73
+ ```
74
+
75
+ Expected result: `Result: REGRESSION`, `Behavior steps changed: 1 (allowed: 0)`,
76
+ and exit code `1`.
77
+
78
+ ## Exit status
79
+
80
+ `stepfork baseline compare` uses these exit codes:
81
+
82
+ - `0`: changes are within `--max-changes` (default `0`).
83
+ - `1`: the behavioral threshold was exceeded.
84
+ - `2`: a baseline or candidate is missing, corrupt, incompatible, or unreadable.
85
+
86
+ Use the default threshold for a CI gate. `--max-changes N` allows up to N
87
+ changed, added, removed, or reordered behavior steps; it is a step count, not a
88
+ quality score. Comparison reads traces only and does not execute agent or tool
89
+ code. Recording a candidate does execute your agent.
90
+
91
+ ## CI
92
+
93
+ The repository includes two offline workflow examples:
94
+
95
+ - [Baseline regression workflow](https://github.com/utsab345/stepfork/blob/main/.github/workflows/baseline-regression.yml)
96
+ saves a reviewed baseline and gates a recorded candidate.
97
+ - [Agent regression workflow](https://github.com/utsab345/stepfork/blob/main/.github/workflows/agent-regression.yml)
98
+ runs exported frozen pytest replay tests.
99
+
100
+ See [Behavioral baselines](baselines.md) for naming rules, compatibility, and
101
+ security limits.