agentloop-profiler 0.2.1__tar.gz → 0.2.3__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 (331) hide show
  1. {agentloop_profiler-0.2.1/agentloop_profiler.egg-info → agentloop_profiler-0.2.3}/PKG-INFO +2 -2
  2. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/README.md +1 -1
  3. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/cli.py +27 -0
  4. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/improvement.py +324 -79
  5. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/improvement_cli.py +44 -9
  6. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/improvement_report.py +60 -2
  7. agentloop_profiler-0.2.3/agentloop/repetitions.py +254 -0
  8. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/version.py +1 -1
  9. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3/agentloop_profiler.egg-info}/PKG-INFO +2 -2
  10. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop_profiler.egg-info/SOURCES.txt +3 -0
  11. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/pyproject.toml +2 -2
  12. agentloop_profiler-0.2.3/tests/test_codex_exec_runner.py +240 -0
  13. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_improvement.py +297 -0
  14. agentloop_profiler-0.2.3/tests/test_repetitions.py +220 -0
  15. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/LICENSE +0 -0
  16. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/THIRD_PARTY_LICENSES.md +0 -0
  17. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/__init__.py +0 -0
  18. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/ablation_protocol.py +0 -0
  19. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/ablations.py +0 -0
  20. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/aggregate_cli.py +0 -0
  21. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/aggregate_stats.py +0 -0
  22. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/aggregates.py +0 -0
  23. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/audit.py +0 -0
  24. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/autoinstrument.py +0 -0
  25. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/batch_experiments.py +0 -0
  26. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/batching.py +0 -0
  27. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/budget_types.py +0 -0
  28. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/budgets.py +0 -0
  29. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/calibration.py +0 -0
  30. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/checkpoint_state.py +0 -0
  31. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/checkpoint_store.py +0 -0
  32. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/ci.py +0 -0
  33. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/cli_paths.py +0 -0
  34. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/client.py +0 -0
  35. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/completion.py +0 -0
  36. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/completion_types.py +0 -0
  37. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/config.py +0 -0
  38. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/context_controls.py +0 -0
  39. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/context_experiments.py +0 -0
  40. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/context_types.py +0 -0
  41. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/costs.py +0 -0
  42. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/cursor_validation.py +0 -0
  43. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/decorators.py +0 -0
  44. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/demo.py +0 -0
  45. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/doctor.py +0 -0
  46. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/drift.py +0 -0
  47. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/drift_cli.py +0 -0
  48. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/drift_types.py +0 -0
  49. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/drift_windows.py +0 -0
  50. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/entrypoint.py +0 -0
  51. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/estimates.py +0 -0
  52. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/events.py +0 -0
  53. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/experiment_artifacts.py +0 -0
  54. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/experiment_observations.py +0 -0
  55. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/experiment_reports.py +0 -0
  56. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/experiment_types.py +0 -0
  57. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/experiments.py +0 -0
  58. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/exporters.py +0 -0
  59. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/finding_benchmark_types.py +0 -0
  60. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/finding_benchmarks.py +0 -0
  61. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/findings.py +0 -0
  62. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/graph.py +0 -0
  63. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/harness.py +0 -0
  64. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/harness_bench/__init__.py +0 -0
  65. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/harness_bench/cli.py +0 -0
  66. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/harness_bench/drivers.py +0 -0
  67. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/harness_bench/offline.py +0 -0
  68. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/harness_evidence.py +0 -0
  69. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/harness_usage.py +0 -0
  70. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/html_report.py +0 -0
  71. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/improvement_init.py +0 -0
  72. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/__init__.py +0 -0
  73. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/crewai.py +0 -0
  74. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/harbor/__init__.py +0 -0
  75. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/harbor/atif.py +0 -0
  76. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/harbor/atif_validation.py +0 -0
  77. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/harbor/cli.py +0 -0
  78. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/harbor/manifest.py +0 -0
  79. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/harbor/trial_evidence.py +0 -0
  80. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/harbor/trials.py +0 -0
  81. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/harbor/verifier.py +0 -0
  82. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/hermes.py +0 -0
  83. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/hermes_cli.py +0 -0
  84. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/hermes_recorder.py +0 -0
  85. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/langgraph.py +0 -0
  86. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/langgraph_harness.py +0 -0
  87. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/langgraph_recovery.py +0 -0
  88. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/omnigent/__init__.py +0 -0
  89. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/omnigent/cli.py +0 -0
  90. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/omnigent/evidence.py +0 -0
  91. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/omnigent/telemetry.py +0 -0
  92. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/openai.py +0 -0
  93. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/openai_agents.py +0 -0
  94. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/sdk.py +0 -0
  95. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/integrations/vercel_ai.py +0 -0
  96. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/interoperability/__init__.py +0 -0
  97. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/interoperability/artifacts.py +0 -0
  98. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/interoperability/cli.py +0 -0
  99. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/interoperability/cohort_evidence.py +0 -0
  100. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/interoperability/cohorts.py +0 -0
  101. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/interoperability/contracts.py +0 -0
  102. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/interoperability/coordination.py +0 -0
  103. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/interoperability/evidence.py +0 -0
  104. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/interoperability/otlp_jsonl.py +0 -0
  105. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/interoperability/otlp_validation.py +0 -0
  106. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/interoperability/registry.py +0 -0
  107. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/interoperability/validation.py +0 -0
  108. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/intervention_service.py +0 -0
  109. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/intervention_store.py +0 -0
  110. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/interventions.py +0 -0
  111. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/issues.py +0 -0
  112. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/judgment_adapters.py +0 -0
  113. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/judgment_benchmark_types.py +0 -0
  114. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/judgment_benchmarks.py +0 -0
  115. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/judgment_types.py +0 -0
  116. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/judgment_views.py +0 -0
  117. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/judgments.py +0 -0
  118. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/loop_guards.py +0 -0
  119. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/loop_types.py +0 -0
  120. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/markdown.py +0 -0
  121. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/metrics.py +0 -0
  122. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/migrations.py +0 -0
  123. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/model_routing.py +0 -0
  124. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/onboarding.py +0 -0
  125. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/operations.py +0 -0
  126. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/optimizer.py +0 -0
  127. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/otel.py +0 -0
  128. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/otel_ids.py +0 -0
  129. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/otel_semantics.py +0 -0
  130. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/parallelism.py +0 -0
  131. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/patches.py +0 -0
  132. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/plan_export.py +0 -0
  133. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/policy_promotion.py +0 -0
  134. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/promotion_evidence.py +0 -0
  135. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/promotion_types.py +0 -0
  136. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/quality.py +0 -0
  137. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/ranking.py +0 -0
  138. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/recovery_evidence.py +0 -0
  139. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/replay.py +0 -0
  140. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/retention.py +0 -0
  141. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/retention_types.py +0 -0
  142. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/reuse_experiments.py +0 -0
  143. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/routing_checks.py +0 -0
  144. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/routing_types.py +0 -0
  145. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/rules.py +0 -0
  146. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/runtime.py +0 -0
  147. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/savings.py +0 -0
  148. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/scheduling_plan.py +0 -0
  149. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/scheduling_types.py +0 -0
  150. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/schema.py +0 -0
  151. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/semantic_rules.py +0 -0
  152. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/semantic_waste.py +0 -0
  153. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/semantic_waste_types.py +0 -0
  154. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/server.py +0 -0
  155. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/store.py +0 -0
  156. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/structural_experiments.py +0 -0
  157. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/structural_types.py +0 -0
  158. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/structured_quality.py +0 -0
  159. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/studies.py +0 -0
  160. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/study_statistics.py +0 -0
  161. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/substitution_evidence.py +0 -0
  162. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/substitution_export.py +0 -0
  163. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/substitution_reports.py +0 -0
  164. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/substitution_types.py +0 -0
  165. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/substitutions.py +0 -0
  166. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/timing.py +0 -0
  167. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/tokens.py +0 -0
  168. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/tool_scheduling.py +0 -0
  169. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/trace_sources.py +0 -0
  170. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/tracer.py +0 -0
  171. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/value.py +0 -0
  172. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/workflow_types.py +0 -0
  173. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop/workflows.py +0 -0
  174. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop_profiler.egg-info/dependency_links.txt +0 -0
  175. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop_profiler.egg-info/entry_points.txt +0 -0
  176. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop_profiler.egg-info/requires.txt +0 -0
  177. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/agentloop_profiler.egg-info/top_level.txt +0 -0
  178. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/dashboard/__init__.py +0 -0
  179. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/dashboard/app.py +0 -0
  180. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/dashboard/streamlit_compat.py +0 -0
  181. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/dashboard/trace_upload.py +0 -0
  182. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/dashboard/value_view.py +0 -0
  183. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/setup.cfg +0 -0
  184. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_ablations.py +0 -0
  185. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_aggregates.py +0 -0
  186. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_api_versioning.py +0 -0
  187. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_batch_data_pipeline.py +0 -0
  188. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_budgets.py +0 -0
  189. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_bump_version.py +0 -0
  190. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_calibration.py +0 -0
  191. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_capability_registry.py +0 -0
  192. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_checkpoint_recovery.py +0 -0
  193. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_ci_command.py +0 -0
  194. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_ci_evidence.py +0 -0
  195. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_cli_output_paths.py +0 -0
  196. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_cli_store_commands.py +0 -0
  197. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_cli_trace_inputs.py +0 -0
  198. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_client.py +0 -0
  199. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_client_transport.py +0 -0
  200. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_completion.py +0 -0
  201. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_context_controls.py +0 -0
  202. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_context_reuse_experiments.py +0 -0
  203. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_context_study.py +0 -0
  204. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_costs.py +0 -0
  205. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_crewai_integration.py +0 -0
  206. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_cursor_server.py +0 -0
  207. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_cursor_shape_validation.py +0 -0
  208. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_dashboard_input_validation.py +0 -0
  209. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_dashboard_quality.py +0 -0
  210. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_dashboard_semantic_waste.py +0 -0
  211. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_dashboard_structured_quality.py +0 -0
  212. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_dashboard_trace_upload.py +0 -0
  213. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_dashboard_value_view.py +0 -0
  214. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_dashboard_workflows.py +0 -0
  215. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_decorators.py +0 -0
  216. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_demo_cli.py +0 -0
  217. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_dependabot_config.py +0 -0
  218. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_diagnosis_api.py +0 -0
  219. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_distribution_metadata.py +0 -0
  220. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_docs_site.py +0 -0
  221. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_doctor_autoinstrument.py +0 -0
  222. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_drift.py +0 -0
  223. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_email_workflow.py +0 -0
  224. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_empirical_calibration.py +0 -0
  225. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_enforcement_conformance.py +0 -0
  226. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_estimates.py +0 -0
  227. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_evidence_workflow.py +0 -0
  228. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_experiments.py +0 -0
  229. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_exporters.py +0 -0
  230. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_external_cohorts.py +0 -0
  231. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_finding_benchmarks.py +0 -0
  232. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_finding_identity.py +0 -0
  233. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_finding_rules.py +0 -0
  234. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_first_use_cli.py +0 -0
  235. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_graph.py +0 -0
  236. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_guided_validation.py +0 -0
  237. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_harbor_atif.py +0 -0
  238. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_harbor_trials.py +0 -0
  239. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_harness.py +0 -0
  240. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_harness_bench.py +0 -0
  241. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_harness_error_usage.py +0 -0
  242. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_harness_evidence.py +0 -0
  243. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_hermes_integration.py +0 -0
  244. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_hermes_replay_capture.py +0 -0
  245. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_hermes_repository_example.py +0 -0
  246. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_hermes_runtime_evidence.py +0 -0
  247. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_html_report.py +0 -0
  248. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_improvement_init.py +0 -0
  249. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_incident_triage.py +0 -0
  250. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_instrumentation_measurement.py +0 -0
  251. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_integration_conformance.py +0 -0
  252. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_interoperability_contracts.py +0 -0
  253. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_interventions.py +0 -0
  254. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_issues.py +0 -0
  255. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_judgment_adapters.py +0 -0
  256. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_judgment_benchmarks.py +0 -0
  257. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_judgment_evidence.py +0 -0
  258. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_judgment_provider_optional.py +0 -0
  259. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_judgments.py +0 -0
  260. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_langgraph_conformance.py +0 -0
  261. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_langgraph_harness.py +0 -0
  262. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_langgraph_integration.py +0 -0
  263. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_langgraph_recovery.py +0 -0
  264. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_loop_guards.py +0 -0
  265. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_markdown.py +0 -0
  266. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_markdown_exporters.py +0 -0
  267. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_marketplace_workflow.py +0 -0
  268. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_metrics.py +0 -0
  269. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_migrations.py +0 -0
  270. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_model_batching.py +0 -0
  271. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_model_routing.py +0 -0
  272. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_multiagent_coordination.py +0 -0
  273. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_non_agent_study.py +0 -0
  274. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_omnigent_telemetry.py +0 -0
  275. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_onboarding.py +0 -0
  276. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_openai_agents_integration.py +0 -0
  277. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_openai_integration.py +0 -0
  278. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_operations.py +0 -0
  279. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_optimizer.py +0 -0
  280. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_otel_ids.py +0 -0
  281. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_otel_interop.py +0 -0
  282. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_otlp_jsonl.py +0 -0
  283. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_parallelization_evidence.py +0 -0
  284. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_patch_plan.py +0 -0
  285. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_patch_source_scope.py +0 -0
  286. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_payment_review.py +0 -0
  287. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_policy_promotion.py +0 -0
  288. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_published_readme.py +0 -0
  289. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_python_support.py +0 -0
  290. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_quality.py +0 -0
  291. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_ranking.py +0 -0
  292. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_real_agent_study.py +0 -0
  293. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_real_calibration_study.py +0 -0
  294. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_real_harness_study.py +0 -0
  295. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_release_workflows.py +0 -0
  296. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_remote_cli_credentials.py +0 -0
  297. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_replay.py +0 -0
  298. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_repository_policy_traversal.py +0 -0
  299. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_research_example.py +0 -0
  300. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_retention.py +0 -0
  301. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_retry_recommendations.py +0 -0
  302. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_routing_study.py +0 -0
  303. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_rule_error_privacy.py +0 -0
  304. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_runtime.py +0 -0
  305. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_savings_aggregation.py +0 -0
  306. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_scheduling_study.py +0 -0
  307. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_semantic_findings.py +0 -0
  308. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_semantic_waste.py +0 -0
  309. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_server.py +0 -0
  310. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_standalone_notices.py +0 -0
  311. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_store.py +0 -0
  312. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_store_contract.py +0 -0
  313. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_streaming_inventory.py +0 -0
  314. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_streamlit_compat.py +0 -0
  315. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_structural_experiments.py +0 -0
  316. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_structured_quality.py +0 -0
  317. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_structured_quality_evidence.py +0 -0
  318. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_studies.py +0 -0
  319. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_substitutions.py +0 -0
  320. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_telemetry_conformance.py +0 -0
  321. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_timing.py +0 -0
  322. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_token_provenance.py +0 -0
  323. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_tool_scheduling.py +0 -0
  324. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_trace_context.py +0 -0
  325. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_trace_failure_recording.py +0 -0
  326. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_trace_schema.py +0 -0
  327. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_usefulness_benchmark.py +0 -0
  328. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_value.py +0 -0
  329. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_vercel_ai_integration.py +0 -0
  330. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_workflow_storage.py +0 -0
  331. {agentloop_profiler-0.2.1 → agentloop_profiler-0.2.3}/tests/test_workflows.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentloop-profiler
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: Profiler and optimization layer for AI agent execution graphs
5
5
  Author: Dipesh Tharu Mahato
6
6
  License-Expression: Apache-2.0
@@ -97,7 +97,7 @@ storage are available as optional components.
97
97
 
98
98
  For Node.js and browser applications, the source checkout includes a
99
99
  [TypeScript SDK](https://github.com/dipeshbabu/agentloop/blob/main/sdk/typescript/README.md) with native tracing and an API v1 client.
100
- It has no runtime dependencies and has not yet been published to npm.
100
+ It has no runtime dependencies and installs with `npm install agentloop-profiler`.
101
101
 
102
102
  ## Quickstart
103
103
 
@@ -39,7 +39,7 @@ storage are available as optional components.
39
39
 
40
40
  For Node.js and browser applications, the source checkout includes a
41
41
  [TypeScript SDK](https://github.com/dipeshbabu/agentloop/blob/main/sdk/typescript/README.md) with native tracing and an API v1 client.
42
- It has no runtime dependencies and has not yet been published to npm.
42
+ It has no runtime dependencies and installs with `npm install agentloop-profiler`.
43
43
 
44
44
  ## Quickstart
45
45
 
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import json
4
4
  import os
5
+ import sys
5
6
  from pathlib import Path
6
7
 
7
8
  import typer
@@ -66,6 +67,32 @@ from agentloop.value import build_value_report
66
67
 
67
68
  app = typer.Typer(help="AgentLoop profiler CLI")
68
69
  console = Console()
70
+
71
+
72
+ def _utf8_output() -> None:
73
+ """Write UTF-8 when output is redirected on a legacy code page.
74
+
75
+ On Windows, piped or redirected output uses the ANSI code page (for example
76
+ cp1252). Task IDs, trace names and other user text outside that code page
77
+ then raise UnicodeEncodeError mid-command and hide the real result.
78
+ Interactive consoles already use UTF-8 and are left unchanged.
79
+ """
80
+ for stream in (sys.stdout, sys.stderr):
81
+ encoding = (getattr(stream, "encoding", None) or "").lower().replace("-", "")
82
+ if encoding in {"utf8", "utf_8"} or not hasattr(stream, "reconfigure"):
83
+ continue
84
+ try:
85
+ stream.reconfigure(encoding="utf-8", errors="replace")
86
+ except (OSError, ValueError):
87
+ continue
88
+
89
+
90
+ @app.callback()
91
+ def _main() -> None:
92
+ """AgentLoop profiler CLI"""
93
+ _utf8_output()
94
+
95
+
69
96
  study_app = typer.Typer(help="Summarize offline studies and preserved intervention evidence.")
70
97
  app.add_typer(study_app, name="study")
71
98
  app.add_typer(aggregate_app, name="aggregate")
@@ -7,6 +7,7 @@ import json
7
7
  import math
8
8
  import os
9
9
  import signal
10
+ import statistics
10
11
  import subprocess # nosec B404 - execution requires explicit CLI argv
11
12
  from dataclasses import asdict
12
13
  from datetime import datetime, timezone
@@ -17,11 +18,20 @@ from agentloop.experiment_types import fingerprint
17
18
  from agentloop.findings import build_diagnosis
18
19
  from agentloop.interventions import build_intervention
19
20
  from agentloop.quality import build_quality_report, validate_quality_fixtures
21
+ from agentloop.repetitions import add_repetition_findings
20
22
  from agentloop.replay import ReplayGates, build_replay_report
21
23
  from agentloop.replay import _summary as replay_summary
22
24
  from agentloop.tracer import AgentTrace
23
25
 
24
26
  VERSION = "1.0"
27
+ DECISIONS = {"per_pair", "aggregate"}
28
+ # Speed and cost gates; an aggregate decision judges these across all pairs.
29
+ PERFORMANCE_GATES = {
30
+ "latency_regression",
31
+ "latency_improvement",
32
+ "cost_regression",
33
+ "cost_improvement",
34
+ }
25
35
  SCORERS = {"exact_match", "contains", "json_subset", "required_fields", "glob"}
26
36
 
27
37
 
@@ -185,33 +195,21 @@ def _invoke(command, request, timeout, *, show_output=False):
185
195
  raise
186
196
 
187
197
 
188
- def capture(workload_path, root, command, *, timeout=180, show_output=False):
189
- workload = read_workload(workload_path)
190
- require(
191
- command and all(isinstance(arg, str) and arg for arg in command),
192
- "Supply an explicit runner command after --",
193
- )
194
- require(
195
- type(timeout) in (int, float) and math.isfinite(timeout) and 0 < timeout <= 3600,
196
- "Task timeout must be positive and at most 3600 seconds",
197
- )
198
- root = Path(root).resolve()
199
- root.mkdir(parents=True, exist_ok=False)
200
- write_once(root, "workload.json", workload)
198
+ CONTROL_CAPTURE = "control/capture.json"
199
+
200
+
201
+ def _new_manifest(workload, command):
201
202
  scripts = [
202
203
  {"argument_index": index, "sha256": hashlib.sha256(Path(argument).read_bytes()).hexdigest()}
203
204
  for index, argument in enumerate(command)
204
205
  if Path(argument).suffix in {".py", ".js", ".mjs", ".ts"} and Path(argument).is_file()
205
206
  ]
206
- manifest = {
207
+ return {
207
208
  "schema_version": VERSION,
208
209
  "created_at": now(),
209
210
  "workload_hash": fingerprint(workload),
210
211
  "runner_hash": fingerprint({"argv": command, "scripts": scripts}),
211
- "runs": [],
212
- }
213
- for index, (task, repetition) in enumerate(slots(workload)):
214
- manifest["runs"].append(
212
+ "runs": [
215
213
  {
216
214
  "task_id": task["id"],
217
215
  "repetition": repetition,
@@ -220,46 +218,104 @@ def capture(workload_path, root, command, *, timeout=180, show_output=False):
220
218
  "trace": None,
221
219
  "trace_sha256": None,
222
220
  }
223
- )
221
+ for task, repetition in slots(workload)
222
+ ],
223
+ }
224
+
225
+
226
+ def _attempt(root, index, row, task, command, timeout, show_output):
227
+ relative = f"traces/{index:04d}.json"
228
+ path = local_path(root, relative)
229
+ path.parent.mkdir(exist_ok=True)
230
+ request = {
231
+ "task_id": row["task_id"],
232
+ "repetition": row["repetition"],
233
+ "input": task["input"],
234
+ "trace_path": str(path),
235
+ }
236
+ row["started_at"] = now()
237
+ try:
238
+ row.update(_invoke(command, request, timeout, show_output=show_output))
239
+ except KeyboardInterrupt:
240
+ row["status"] = "cancelled"
241
+ raise
242
+ finally:
243
+ row["ended_at"] = now()
244
+ if path.exists():
245
+ try:
246
+ _, digest = trace_receipt(root, relative)
247
+ row.update(trace=relative, trace_sha256=digest)
248
+ except (ValueError, OSError, TypeError, KeyError, AttributeError) as error:
249
+ # Keep the more specific failed, timed-out or cancelled outcome.
250
+ if row["status"] == "completed":
251
+ row["status"] = "invalid_trace"
252
+ row["diagnostic"] = (
253
+ (row.get("diagnostic") or "")
254
+ + f" Trace {relative} is invalid: {error}. Export a finalized native trace to request['trace_path']."
255
+ )
256
+ elif row["status"] == "completed":
257
+ row["status"] = "missing_trace"
258
+ row["diagnostic"] = (
259
+ "Runner exited successfully without a trace. Export the finalized trace to request['trace_path']."
260
+ )
261
+ write_once(root, f"receipts/{index:04d}.json", row)
262
+
263
+
264
+ def capture(workload_path, root, command, *, timeout=180, show_output=False, control=None):
265
+ """Run every planned attempt, optionally alternating with an unchanged control.
266
+
267
+ With ``control``, each task attempt runs both the control and the candidate
268
+ back to back, and the condition that goes first alternates between attempts.
269
+ Cache warm-up, host load and other drift then affect both conditions instead
270
+ of favouring whichever condition ran later.
271
+ """
272
+ workload = read_workload(workload_path)
273
+ require(
274
+ command and all(isinstance(arg, str) and arg for arg in command),
275
+ "Supply an explicit runner command after --",
276
+ )
277
+ require(
278
+ control is None or (control and all(isinstance(arg, str) and arg for arg in control)),
279
+ "Supply the unchanged control runner as repeated --control-arg values",
280
+ )
281
+ require(
282
+ type(timeout) in (int, float) and math.isfinite(timeout) and 0 < timeout <= 3600,
283
+ "Task timeout must be positive and at most 3600 seconds",
284
+ )
285
+ root = Path(root).resolve()
286
+ root.mkdir(parents=True, exist_ok=False)
287
+ write_once(root, "workload.json", workload)
288
+ manifest = _new_manifest(workload, command)
289
+ conditions = [(root, manifest, command)]
290
+ control_manifest = None
291
+ if control is not None:
292
+ control_root = local_path(root, "control")
293
+ control_root.mkdir()
294
+ write_once(control_root, "workload.json", workload)
295
+ control_manifest = _new_manifest(workload, control)
296
+ control_manifest["schedule"] = {"mode": "interleaved", "role": "control"}
297
+ manifest["schedule"] = {
298
+ "mode": "interleaved",
299
+ "role": "candidate",
300
+ "pattern": "Control runs first on even attempt indexes and second on odd ones",
301
+ }
302
+ conditions.append((control_root, control_manifest, control))
224
303
  try:
225
304
  for index, row in enumerate(manifest["runs"]):
226
305
  task = next(task for task in workload["tasks"] if task["id"] == row["task_id"])
227
- relative = f"traces/{index:04d}.json"
228
- path = local_path(root, relative)
229
- path.parent.mkdir(exist_ok=True)
230
- request = {
231
- "task_id": row["task_id"],
232
- "repetition": row["repetition"],
233
- "input": task["input"],
234
- "trace_path": str(path),
235
- }
236
- row["started_at"] = now()
237
- try:
238
- row.update(_invoke(command, request, timeout, show_output=show_output))
239
- except KeyboardInterrupt:
240
- row["status"] = "cancelled"
241
- raise
242
- finally:
243
- row["ended_at"] = now()
244
- if path.exists():
245
- try:
246
- _, digest = trace_receipt(root, relative)
247
- row.update(trace=relative, trace_sha256=digest)
248
- except (ValueError, OSError, TypeError, KeyError, AttributeError) as error:
249
- # Keep the more specific failed, timed-out or cancelled outcome.
250
- if row["status"] == "completed":
251
- row["status"] = "invalid_trace"
252
- row["diagnostic"] = (
253
- (row.get("diagnostic") or "")
254
- + f" Trace {relative} is invalid: {error}. Export a finalized native trace to request['trace_path']."
255
- )
256
- elif row["status"] == "completed":
257
- row["status"] = "missing_trace"
258
- row["diagnostic"] = (
259
- "Runner exited successfully without a trace. Export the finalized trace to request['trace_path']."
260
- )
261
- write_once(root, f"receipts/{index:04d}.json", row)
306
+ order = conditions if index % 2 else conditions[::-1]
307
+ for position, (condition_root, condition, argv) in enumerate(order):
308
+ attempt = condition["runs"][index]
309
+ if control is not None:
310
+ attempt["order"] = position
311
+ _attempt(condition_root, index, attempt, task, argv, timeout, show_output)
262
312
  finally:
313
+ if control_manifest is not None:
314
+ write_once(root, CONTROL_CAPTURE, control_manifest)
315
+ manifest["control"] = {
316
+ "capture": CONTROL_CAPTURE,
317
+ "manifest_hash": fingerprint(control_manifest),
318
+ }
263
319
  write_once(root, "capture.json", manifest)
264
320
  return manifest
265
321
 
@@ -318,6 +374,16 @@ def read_capture(path, workload):
318
374
  return manifest, traces
319
375
 
320
376
 
377
+ def _completed(manifest, traces):
378
+ """Traces of attempts that completed, for comparisons between repetitions."""
379
+ done = {
380
+ (row["task_id"], row["repetition"])
381
+ for row in manifest["runs"]
382
+ if row["status"] == "completed"
383
+ }
384
+ return {key: trace for key, trace in traces.items() if key in done}
385
+
386
+
321
387
  def _quality(task, baseline, candidate):
322
388
  return build_quality_report(
323
389
  [
@@ -334,18 +400,30 @@ def _quality(task, baseline, candidate):
334
400
 
335
401
 
336
402
  def start(
337
- workload_path, baseline_path, root, *, focus=None, objective="latency", minimum_improvement=0
403
+ workload_path,
404
+ baseline_path,
405
+ root,
406
+ *,
407
+ focus=None,
408
+ objective="latency",
409
+ minimum_improvement=0,
410
+ decision="per_pair",
338
411
  ):
339
412
  workload = read_workload(workload_path)
340
413
  manifest, traces = read_capture(baseline_path, workload)
341
414
  require(objective in {"latency", "cost"}, "Objective must be latency or cost")
415
+ decision = decision.replace("-", "_") if isinstance(decision, str) else decision
416
+ require(decision in DECISIONS, "Decision must be per-pair or aggregate")
342
417
  require(
343
418
  type(minimum_improvement) in (int, float)
344
419
  and math.isfinite(minimum_improvement)
345
420
  and minimum_improvement >= 0,
346
421
  "Minimum improvement must be finite and nonnegative",
347
422
  )
348
- diagnoses = {key: build_diagnosis(trace) for key, trace in traces.items()}
423
+ diagnoses = add_repetition_findings(
424
+ {key: build_diagnosis(trace) for key, trace in traces.items()},
425
+ _completed(manifest, traces),
426
+ )
349
427
  findings = [finding for diagnosis in diagnoses.values() for finding in diagnosis["findings"]]
350
428
  if focus is None and findings:
351
429
  focus = findings[0]["type"]
@@ -396,6 +474,7 @@ def start(
396
474
  "workload": workload,
397
475
  "focus": focus,
398
476
  "objective": objective,
477
+ "decision": decision,
399
478
  "gates": asdict(gates),
400
479
  "cases": cases,
401
480
  "baseline_capture": manifest,
@@ -427,6 +506,83 @@ def _trace_usable(trace):
427
506
  return not any(event.parent_id is None and event.status == "error" for event in trace.events)
428
507
 
429
508
 
509
+ def _sign_test_p_value(improved, regressed):
510
+ """One-sided exact sign test: chance of at least this many improvements."""
511
+ trials = improved + regressed
512
+ if trials == 0:
513
+ return None
514
+ return sum(math.comb(trials, k) for k in range(improved, trials + 1)) / 2**trials
515
+
516
+
517
+ def _aggregate_decision(rows, objective, gates):
518
+ """Judge speed or cost across all planned pairs.
519
+
520
+ Correctness, completion and non-performance gates were already enforced on
521
+ every pair. Here the median paired improvement in the selected objective
522
+ must be positive and meet the frozen minimum, and more pairs must improve
523
+ than regress. The other metric's median regression must stay within its
524
+ allowed regression when every pair can measure it.
525
+ """
526
+ secondary = "cost" if objective == "latency" else "latency"
527
+ required = (
528
+ gates.min_latency_improvement_pct
529
+ if objective == "latency"
530
+ else gates.min_cost_improvement_pct
531
+ )
532
+ allowed = (
533
+ gates.max_cost_regression_pct if secondary == "cost" else gates.max_latency_regression_pct
534
+ )
535
+ gains = [row.get("objective_gain_pct") for row in rows]
536
+ regressions = [
537
+ (row["replay"] or {}).get("deltas", {}).get(f"{secondary}_regression_pct")
538
+ if row.get("replay")
539
+ else None
540
+ for row in rows
541
+ ]
542
+ reasons = []
543
+ measured = [gain for gain in gains if gain is not None]
544
+ improved = sum(gain > 0 for gain in measured)
545
+ regressed = sum(gain < 0 for gain in measured)
546
+ median = statistics.median(measured) if measured else None
547
+ if len(measured) != len(rows):
548
+ reasons.append(
549
+ f"{len(rows) - len(measured)} of {len(rows)} pairs have no measured {objective} improvement"
550
+ )
551
+ if median is None or median <= 0 or median < required:
552
+ detail = "unavailable" if median is None else f"{median:.2f}%"
553
+ reasons.append(
554
+ f"Median {objective} improvement {detail} must be positive and at least {required:.2f}%"
555
+ )
556
+ if improved <= regressed:
557
+ reasons.append(
558
+ f"{improved} pairs improved and {regressed} regressed; more pairs must improve than regress"
559
+ )
560
+ secondary_median = None
561
+ if all(value is not None for value in regressions):
562
+ secondary_median = statistics.median(regressions)
563
+ if secondary_median > allowed:
564
+ reasons.append(
565
+ f"Median {secondary} regression {secondary_median:.2f}% exceeds {allowed:.2f}% allowed"
566
+ )
567
+ return {
568
+ "mode": "aggregate",
569
+ "objective": objective,
570
+ "pairs": len(rows),
571
+ "median_improvement_pct": median,
572
+ "required_improvement_pct": required,
573
+ "improved_pairs": improved,
574
+ "regressed_pairs": regressed,
575
+ "unchanged_pairs": len(measured) - improved - regressed,
576
+ "sign_test_p_value": _sign_test_p_value(improved, regressed),
577
+ "secondary_metric": secondary,
578
+ "secondary_median_regression_pct": secondary_median,
579
+ "secondary_allowed_regression_pct": allowed,
580
+ "secondary_judged": secondary_median is not None,
581
+ "passed": not reasons,
582
+ "reasons": reasons,
583
+ }
584
+
585
+
430
586
  def finish(session_path, candidate_path, root, *, change):
431
587
  session_path = Path(session_path).resolve()
432
588
  saved = load_json(session_path)
@@ -438,6 +594,9 @@ def finish(session_path, candidate_path, root, *, change):
438
594
  require(specification.get("schema_version") == VERSION, "Unsupported frozen session version")
439
595
  workload = validate_workload(specification["workload"])
440
596
  require(specification.get("objective") in {"latency", "cost"}, "Unsupported frozen objective")
597
+ # Sessions frozen before 0.2.3 have no decision field and keep per-pair judgment.
598
+ decision = specification.get("decision", "per_pair")
599
+ require(decision in DECISIONS, "Unsupported frozen decision")
441
600
  planned = {(task["id"], repetition) for task, repetition in slots(workload)}
442
601
  cases = specification.get("cases")
443
602
  require(
@@ -472,10 +631,42 @@ def finish(session_path, candidate_path, root, *, change):
472
631
  )
473
632
  baseline_ids.add(trace.run_id)
474
633
  baselines[key] = trace
634
+ candidate_ids = {trace.run_id for trace in candidates.values()}
475
635
  require(
476
- not baseline_ids.intersection(trace.run_id for trace in candidates.values()),
636
+ not baseline_ids.intersection(candidate_ids),
477
637
  "Baseline and candidate must have distinct run IDs",
478
638
  )
639
+ controls = control_manifest = None
640
+ if "control" in candidate_manifest:
641
+ reference = candidate_manifest["control"]
642
+ require(
643
+ isinstance(reference, dict) and reference.get("capture") == CONTROL_CAPTURE,
644
+ "Invalid interleaved control reference",
645
+ )
646
+ control_manifest, controls = read_capture(
647
+ Path(candidate_path).resolve().parent / CONTROL_CAPTURE, workload
648
+ )
649
+ require(
650
+ fingerprint(control_manifest) == reference.get("manifest_hash"),
651
+ "Interleaved control capture changed",
652
+ )
653
+ require(
654
+ datetime.fromisoformat(control_manifest["created_at"])
655
+ >= datetime.fromisoformat(specification["frozen_at"]),
656
+ "Capture the interleaved control after freezing baseline findings",
657
+ )
658
+ require(
659
+ not (baseline_ids | candidate_ids).intersection(
660
+ trace.run_id for trace in controls.values()
661
+ ),
662
+ "Control, baseline and candidate must have distinct run IDs",
663
+ )
664
+ # Diagnose controls like the original baseline, including comparisons
665
+ # between their repetitions, so focus findings can be linked.
666
+ control_diagnoses = add_repetition_findings(
667
+ {key: build_diagnosis(trace) for key, trace in controls.items()},
668
+ _completed(control_manifest, controls),
669
+ )
479
670
  gates = ReplayGates(**specification["gates"])
480
671
  root = Path(root).resolve()
481
672
  root.mkdir(parents=True, exist_ok=False)
@@ -483,14 +674,40 @@ def finish(session_path, candidate_path, root, *, change):
483
674
  for index, case in enumerate(specification["cases"]):
484
675
  key = (case["task_id"], case["repetition"])
485
676
  task = next(task for task in workload["tasks"] if task["id"] == key[0])
486
- baseline, candidate = baselines.get(key), candidates.get(key)
677
+ candidate = candidates.get(key)
487
678
  candidate_row = next(
488
679
  row for row in candidate_manifest["runs"] if (row["task_id"], row["repetition"]) == key
489
680
  )
681
+ if controls is None:
682
+ label, baseline = "Baseline", baselines.get(key)
683
+ baseline_status = case["capture_status"]
684
+ baseline_diagnostic = case.get("capture_diagnostic")
685
+ diagnosis, finding_ids = case["diagnosis"], case["finding_ids"]
686
+ else:
687
+ # Findings stay frozen from the original baseline. Measurements compare
688
+ # the candidate with the unchanged control run alongside it.
689
+ label, baseline = "Control", controls.get(key)
690
+ control_row = next(
691
+ row
692
+ for row in control_manifest["runs"]
693
+ if (row["task_id"], row["repetition"]) == key
694
+ )
695
+ baseline_status = control_row["status"]
696
+ baseline_diagnostic = control_row.get("diagnostic")
697
+ diagnosis = control_diagnoses.get(key)
698
+ finding_ids = (
699
+ [
700
+ finding["finding_id"]
701
+ for finding in diagnosis["findings"]
702
+ if finding["type"] == specification["focus"]
703
+ ]
704
+ if diagnosis and case["finding_ids"]
705
+ else []
706
+ )
490
707
  row = {
491
708
  "task_id": key[0],
492
709
  "repetition": key[1],
493
- "baseline_status": case["capture_status"],
710
+ "baseline_status": baseline_status,
494
711
  "candidate_status": candidate_row["status"],
495
712
  "passed": False,
496
713
  "reasons": [],
@@ -498,10 +715,15 @@ def finish(session_path, candidate_path, root, *, change):
498
715
  "replay": None,
499
716
  "intervention": None,
500
717
  }
718
+ if controls is not None:
719
+ row.update(
720
+ frozen_baseline_status=case["capture_status"],
721
+ control_ran_first=control_row.get("order") == 0,
722
+ )
501
723
  if baseline is None or candidate is None:
502
- row["reasons"].append("A planned baseline or candidate trace is unavailable")
724
+ row["reasons"].append(f"A planned {label.lower()} or candidate trace is unavailable")
503
725
  for side, status, diagnostic in (
504
- ("Baseline", case["capture_status"], case.get("capture_diagnostic")),
726
+ (label, baseline_status, baseline_diagnostic),
505
727
  ("Candidate", candidate_row["status"], candidate_row.get("diagnostic")),
506
728
  ):
507
729
  if status != "completed":
@@ -512,7 +734,7 @@ def finish(session_path, candidate_path, root, *, change):
512
734
  quality = _quality(task, baseline, candidate)
513
735
  replay = build_replay_report(baseline, candidate, gates=gates, quality_report=quality)
514
736
  if (
515
- case["capture_status"] != "completed"
737
+ baseline_status != "completed"
516
738
  or candidate_row["status"] != "completed"
517
739
  or not all(_trace_usable(trace) for trace in (baseline, candidate))
518
740
  ):
@@ -523,22 +745,26 @@ def finish(session_path, candidate_path, root, *, change):
523
745
  for side in ("baseline", "candidate")
524
746
  ):
525
747
  row["reasons"].append(
526
- "Baseline and candidate must both pass the declared quality checks"
748
+ f"{label} and candidate must both pass the declared quality checks"
527
749
  )
528
750
  for result in quality["cases"]:
529
751
  for side in ("baseline", "candidate"):
530
752
  if not result[side]["passed"]:
531
753
  row["reasons"].append(
532
- f"{side.title()} answer failed the declared {task.get('scorer', {}).get('type', 'exact_match')} criterion: {result[side]['detail']}"
754
+ f"{label if side == 'baseline' else 'Candidate'} answer failed the declared {task.get('scorer', {}).get('type', 'exact_match')} criterion: {result[side]['detail']}"
533
755
  )
534
- if not replay["gates"]["passed"]:
756
+ # Aggregate decisions judge speed and cost across all pairs after
757
+ # this loop; every other gate still applies to each pair.
758
+ judged = [
759
+ gate
760
+ for gate in replay["gates"]["results"]
761
+ if not gate["passed"]
762
+ and (decision == "per_pair" or gate["name"] not in PERFORMANCE_GATES)
763
+ ]
764
+ if judged:
535
765
  row["reasons"].append("Native replay gates failed")
536
- row["reasons"].extend(
537
- f"{gate['name']}: {gate['detail']}"
538
- for gate in replay["gates"]["results"]
539
- if not gate["passed"]
540
- )
541
- if not case["diagnosis"].get("analysis_complete", True) or not candidate.report().get(
766
+ row["reasons"].extend(f"{gate['name']}: {gate['detail']}" for gate in judged)
767
+ if not diagnosis.get("analysis_complete", True) or not candidate.report().get(
542
768
  "analysis_complete", True
543
769
  ):
544
770
  row["reasons"].append("Finding analysis is incomplete")
@@ -547,14 +773,20 @@ def finish(session_path, candidate_path, root, *, change):
547
773
  if specification["objective"] == "latency"
548
774
  else "cost_improvement_pct"
549
775
  ]
550
- if gain is None or gain <= 0:
776
+ if decision == "per_pair" and (gain is None or gain <= 0):
551
777
  row["reasons"].append("The selected objective has no measured improvement")
552
- row.update(quality=quality, replay=replay, passed=not row["reasons"])
778
+ row.update(
779
+ quality=quality, replay=replay, passed=not row["reasons"], objective_gain_pct=gain
780
+ )
553
781
  replay["gates"]["results"].append(
554
782
  {
555
783
  "name": "guided_evidence",
556
784
  "passed": row["passed"],
557
- "detail": "All guided execution, quality and measured-objective checks passed"
785
+ "detail": (
786
+ "All guided execution, quality and measured-objective checks passed"
787
+ if decision == "per_pair"
788
+ else "All guided execution and quality checks passed; performance is judged across all pairs"
789
+ )
558
790
  if row["passed"]
559
791
  else " ".join(row["reasons"]),
560
792
  "indeterminate": False,
@@ -567,14 +799,14 @@ def finish(session_path, candidate_path, root, *, change):
567
799
  cost_evaluable=replay["gates"]["cost_evaluable"],
568
800
  pricing_known=replay["gates"]["pricing_known"],
569
801
  )
570
- if case["finding_ids"]:
802
+ if finding_ids:
571
803
  record = build_intervention(
572
804
  baseline,
573
805
  candidate,
574
- target_finding_ids=case["finding_ids"],
806
+ target_finding_ids=finding_ids,
575
807
  intervention_type=specification["focus"],
576
808
  configuration={"change": change},
577
- diagnosis=case["diagnosis"],
809
+ diagnosis=diagnosis,
578
810
  gates=gates,
579
811
  quality_report=quality,
580
812
  replay_report=replay,
@@ -614,6 +846,11 @@ def finish(session_path, candidate_path, root, *, change):
614
846
  }
615
847
  study_file = write_once(root, "study.json", study_manifest)
616
848
  study = summarize_study(study_file)
849
+ verdict = (
850
+ {"mode": "per_pair", "passed": True}
851
+ if decision == "per_pair"
852
+ else _aggregate_decision(rows, specification["objective"], gates)
853
+ )
617
854
  report = {
618
855
  "schema_version": VERSION,
619
856
  "name": workload["name"],
@@ -626,12 +863,20 @@ def finish(session_path, candidate_path, root, *, change):
626
863
  "candidate_capture_hash": fingerprint(candidate_manifest),
627
864
  "baseline_runner_hash": specification["baseline_capture"].get("runner_hash"),
628
865
  "candidate_runner_hash": candidate_manifest.get("runner_hash"),
866
+ "comparison_baseline": "frozen_baseline" if controls is None else "interleaved_control",
867
+ "control_capture_hash": None if controls is None else fingerprint(control_manifest),
868
+ "control_runner_hash": None if controls is None else control_manifest.get("runner_hash"),
629
869
  "planned_attempts": len(rows),
630
870
  "passed_attempts": sum(row["passed"] for row in rows),
631
- "passed": all(row["passed"] for row in rows),
871
+ "decision": verdict,
872
+ "passed": all(row["passed"] for row in rows) and verdict["passed"],
632
873
  "synthetic": any(
633
874
  trace.metadata.get("synthetic") is True
634
- for trace in [*baselines.values(), *candidates.values()]
875
+ for trace in [
876
+ *baselines.values(),
877
+ *candidates.values(),
878
+ *(controls or {}).values(),
879
+ ]
635
880
  ),
636
881
  "cases": rows,
637
882
  "study": study,