agentloop-profiler 0.1.0__py3-none-any.whl

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 (166) hide show
  1. agentloop/__init__.py +136 -0
  2. agentloop/ablation_protocol.py +229 -0
  3. agentloop/ablations.py +564 -0
  4. agentloop/aggregate_cli.py +88 -0
  5. agentloop/aggregate_stats.py +175 -0
  6. agentloop/aggregates.py +532 -0
  7. agentloop/audit.py +39 -0
  8. agentloop/autoinstrument.py +145 -0
  9. agentloop/batch_experiments.py +295 -0
  10. agentloop/batching.py +95 -0
  11. agentloop/budget_types.py +335 -0
  12. agentloop/budgets.py +539 -0
  13. agentloop/calibration.py +872 -0
  14. agentloop/checkpoint_state.py +306 -0
  15. agentloop/checkpoint_store.py +86 -0
  16. agentloop/ci.py +202 -0
  17. agentloop/cli.py +1314 -0
  18. agentloop/client.py +228 -0
  19. agentloop/completion.py +345 -0
  20. agentloop/completion_types.py +199 -0
  21. agentloop/config.py +50 -0
  22. agentloop/context_controls.py +443 -0
  23. agentloop/context_experiments.py +337 -0
  24. agentloop/context_types.py +216 -0
  25. agentloop/costs.py +667 -0
  26. agentloop/cursor_validation.py +48 -0
  27. agentloop/decorators.py +445 -0
  28. agentloop/demo.py +300 -0
  29. agentloop/doctor.py +341 -0
  30. agentloop/drift.py +361 -0
  31. agentloop/drift_cli.py +147 -0
  32. agentloop/drift_types.py +110 -0
  33. agentloop/drift_windows.py +340 -0
  34. agentloop/entrypoint.py +201 -0
  35. agentloop/estimates.py +133 -0
  36. agentloop/events.py +75 -0
  37. agentloop/experiment_artifacts.py +80 -0
  38. agentloop/experiment_observations.py +169 -0
  39. agentloop/experiment_reports.py +545 -0
  40. agentloop/experiment_types.py +355 -0
  41. agentloop/experiments.py +392 -0
  42. agentloop/exporters.py +117 -0
  43. agentloop/finding_benchmark_types.py +131 -0
  44. agentloop/finding_benchmarks.py +424 -0
  45. agentloop/findings.py +419 -0
  46. agentloop/graph.py +464 -0
  47. agentloop/harness.py +825 -0
  48. agentloop/harness_bench/__init__.py +1 -0
  49. agentloop/harness_bench/cli.py +77 -0
  50. agentloop/harness_bench/drivers.py +96 -0
  51. agentloop/harness_bench/offline.py +507 -0
  52. agentloop/harness_evidence.py +585 -0
  53. agentloop/harness_usage.py +91 -0
  54. agentloop/html_report.py +860 -0
  55. agentloop/integrations/__init__.py +1 -0
  56. agentloop/integrations/crewai.py +144 -0
  57. agentloop/integrations/harbor/__init__.py +1 -0
  58. agentloop/integrations/harbor/atif.py +982 -0
  59. agentloop/integrations/harbor/atif_validation.py +329 -0
  60. agentloop/integrations/harbor/cli.py +207 -0
  61. agentloop/integrations/harbor/manifest.py +86 -0
  62. agentloop/integrations/harbor/trial_evidence.py +196 -0
  63. agentloop/integrations/harbor/trials.py +1109 -0
  64. agentloop/integrations/harbor/verifier.py +118 -0
  65. agentloop/integrations/langgraph.py +150 -0
  66. agentloop/integrations/langgraph_harness.py +466 -0
  67. agentloop/integrations/langgraph_recovery.py +366 -0
  68. agentloop/integrations/omnigent/__init__.py +1 -0
  69. agentloop/integrations/omnigent/cli.py +78 -0
  70. agentloop/integrations/omnigent/evidence.py +93 -0
  71. agentloop/integrations/omnigent/telemetry.py +422 -0
  72. agentloop/integrations/openai.py +415 -0
  73. agentloop/integrations/openai_agents.py +291 -0
  74. agentloop/integrations/sdk.py +82 -0
  75. agentloop/integrations/vercel_ai.py +83 -0
  76. agentloop/interoperability/__init__.py +5 -0
  77. agentloop/interoperability/artifacts.py +112 -0
  78. agentloop/interoperability/cli.py +59 -0
  79. agentloop/interoperability/cohort_evidence.py +175 -0
  80. agentloop/interoperability/cohorts.py +681 -0
  81. agentloop/interoperability/contracts.py +427 -0
  82. agentloop/interoperability/coordination.py +554 -0
  83. agentloop/interoperability/evidence.py +215 -0
  84. agentloop/interoperability/otlp_jsonl.py +775 -0
  85. agentloop/interoperability/otlp_validation.py +496 -0
  86. agentloop/interoperability/registry.py +561 -0
  87. agentloop/interoperability/validation.py +333 -0
  88. agentloop/intervention_service.py +110 -0
  89. agentloop/intervention_store.py +118 -0
  90. agentloop/interventions.py +190 -0
  91. agentloop/issues.py +90 -0
  92. agentloop/judgment_adapters.py +125 -0
  93. agentloop/judgment_benchmark_types.py +98 -0
  94. agentloop/judgment_benchmarks.py +606 -0
  95. agentloop/judgment_types.py +241 -0
  96. agentloop/judgment_views.py +38 -0
  97. agentloop/judgments.py +342 -0
  98. agentloop/loop_guards.py +274 -0
  99. agentloop/loop_types.py +66 -0
  100. agentloop/markdown.py +102 -0
  101. agentloop/metrics.py +342 -0
  102. agentloop/migrations.py +303 -0
  103. agentloop/model_routing.py +470 -0
  104. agentloop/onboarding.py +315 -0
  105. agentloop/operations.py +44 -0
  106. agentloop/optimizer.py +199 -0
  107. agentloop/otel.py +715 -0
  108. agentloop/otel_ids.py +81 -0
  109. agentloop/otel_semantics.py +134 -0
  110. agentloop/parallelism.py +141 -0
  111. agentloop/patches.py +603 -0
  112. agentloop/plan_export.py +126 -0
  113. agentloop/policy_promotion.py +325 -0
  114. agentloop/promotion_evidence.py +304 -0
  115. agentloop/promotion_types.py +209 -0
  116. agentloop/quality.py +446 -0
  117. agentloop/ranking.py +529 -0
  118. agentloop/recovery_evidence.py +96 -0
  119. agentloop/replay.py +753 -0
  120. agentloop/retention.py +375 -0
  121. agentloop/retention_types.py +113 -0
  122. agentloop/reuse_experiments.py +247 -0
  123. agentloop/routing_checks.py +116 -0
  124. agentloop/routing_types.py +241 -0
  125. agentloop/rules.py +396 -0
  126. agentloop/runtime.py +286 -0
  127. agentloop/savings.py +158 -0
  128. agentloop/scheduling_plan.py +99 -0
  129. agentloop/scheduling_types.py +169 -0
  130. agentloop/schema.py +257 -0
  131. agentloop/semantic_rules.py +200 -0
  132. agentloop/semantic_waste.py +345 -0
  133. agentloop/semantic_waste_types.py +88 -0
  134. agentloop/server.py +494 -0
  135. agentloop/store.py +1429 -0
  136. agentloop/structural_experiments.py +431 -0
  137. agentloop/structural_types.py +113 -0
  138. agentloop/structured_quality.py +1020 -0
  139. agentloop/studies.py +629 -0
  140. agentloop/study_statistics.py +58 -0
  141. agentloop/substitution_evidence.py +199 -0
  142. agentloop/substitution_export.py +190 -0
  143. agentloop/substitution_reports.py +407 -0
  144. agentloop/substitution_types.py +284 -0
  145. agentloop/substitutions.py +267 -0
  146. agentloop/timing.py +142 -0
  147. agentloop/tokens.py +188 -0
  148. agentloop/tool_scheduling.py +410 -0
  149. agentloop/trace_sources.py +31 -0
  150. agentloop/tracer.py +494 -0
  151. agentloop/value.py +306 -0
  152. agentloop/version.py +3 -0
  153. agentloop/workflow_types.py +264 -0
  154. agentloop/workflows.py +284 -0
  155. agentloop_profiler-0.1.0.dist-info/METADATA +513 -0
  156. agentloop_profiler-0.1.0.dist-info/RECORD +166 -0
  157. agentloop_profiler-0.1.0.dist-info/WHEEL +5 -0
  158. agentloop_profiler-0.1.0.dist-info/entry_points.txt +2 -0
  159. agentloop_profiler-0.1.0.dist-info/licenses/LICENSE +201 -0
  160. agentloop_profiler-0.1.0.dist-info/licenses/THIRD_PARTY_LICENSES.md +101 -0
  161. agentloop_profiler-0.1.0.dist-info/top_level.txt +2 -0
  162. dashboard/__init__.py +5 -0
  163. dashboard/app.py +922 -0
  164. dashboard/streamlit_compat.py +63 -0
  165. dashboard/trace_upload.py +57 -0
  166. dashboard/value_view.py +105 -0
@@ -0,0 +1,513 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentloop-profiler
3
+ Version: 0.1.0
4
+ Summary: Profiler and optimization layer for AI agent execution graphs
5
+ Author: Dipesh Babu
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/dipeshbabu/agentloop
8
+ Project-URL: Documentation, https://github.com/dipeshbabu/agentloop#readme
9
+ Project-URL: Repository, https://github.com/dipeshbabu/agentloop.git
10
+ Project-URL: Issues, https://github.com/dipeshbabu/agentloop/issues
11
+ Project-URL: Changelog, https://github.com/dipeshbabu/agentloop/blob/main/CHANGELOG.md
12
+ Keywords: ai-agents,agent-evaluation,observability,optimization,profiling,research,tracing
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
24
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
25
+ Classifier: Topic :: Software Development :: Debuggers
26
+ Classifier: Topic :: Software Development :: Testing
27
+ Requires-Python: >=3.10
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE
30
+ License-File: THIRD_PARTY_LICENSES.md
31
+ Requires-Dist: typer>=0.12.0
32
+ Requires-Dist: rich>=13.0.0
33
+ Provides-Extra: dashboard
34
+ Requires-Dist: streamlit>=1.34.0; extra == "dashboard"
35
+ Requires-Dist: pandas>=2.0.0; extra == "dashboard"
36
+ Provides-Extra: server
37
+ Requires-Dist: fastapi>=0.110.0; extra == "server"
38
+ Requires-Dist: uvicorn>=0.27.0; extra == "server"
39
+ Provides-Extra: postgres
40
+ Requires-Dist: psycopg[binary]>=3.3.4; extra == "postgres"
41
+ Provides-Extra: instrumentation
42
+ Requires-Dist: openai>=1.0.0; extra == "instrumentation"
43
+ Provides-Extra: all
44
+ Requires-Dist: streamlit>=1.34.0; extra == "all"
45
+ Requires-Dist: pandas>=2.0.0; extra == "all"
46
+ Requires-Dist: fastapi>=0.110.0; extra == "all"
47
+ Requires-Dist: uvicorn>=0.27.0; extra == "all"
48
+ Requires-Dist: psycopg[binary]>=3.3.4; extra == "all"
49
+ Requires-Dist: openai>=1.0.0; extra == "all"
50
+ Dynamic: license-file
51
+
52
+ <h1 align="center">
53
+ <picture>
54
+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/agentloop-logo-dark.svg">
55
+ <img src="docs/assets/agentloop-logo-light.svg" alt="AgentLoop" width="440">
56
+ </picture>
57
+ </h1>
58
+
59
+ <p align="center">
60
+ <strong>Find wasted work in AI agents. Verify each change.</strong><br>
61
+ Trace calls, inspect findings, and compare performance with your quality checks.
62
+ </p>
63
+
64
+ <p align="center">
65
+ <a href="https://github.com/dipeshbabu/agentloop/actions/workflows/ci.yml"><img src="https://github.com/dipeshbabu/agentloop/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
66
+ <a href="https://pypi.org/project/agentloop-profiler/"><img src="https://img.shields.io/pypi/v/agentloop-profiler.svg?cacheSeconds=300" alt="PyPI"></a>
67
+ <a href="https://pepy.tech/projects/agentloop-profiler"><img src="https://static.pepy.tech/badge/agentloop-profiler/month" alt="Downloads/month"></a>
68
+ <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.10%2B-3776AB.svg" alt="Python 3.10 or newer"></a>
69
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue.svg" alt="License: Apache-2.0"></a>
70
+ </p>
71
+
72
+ <p align="center">
73
+ <a href="#quickstart">Quickstart</a> ·
74
+ <a href="#without-and-with-agentloop">Why AgentLoop</a> ·
75
+ <a href="#compare-before-and-after">Compare runs</a> ·
76
+ <a href="#framework-integrations">Integrations</a> ·
77
+ <a href="docs/FIRST_USE.md">Guide</a>
78
+ </p>
79
+
80
+ AgentLoop records model calls, tool calls, and retries in an agent workflow. Use
81
+ its reports to inspect latency, token usage, and estimated model costs, find
82
+ repeated work, and compare runs before and after a change.
83
+
84
+ Tracing and analysis run locally. You can work with JSON files without a database
85
+ or hosted account. The dashboard and HTTP API are optional.
86
+
87
+ AgentLoop also profiles classifiers, rules and decision
88
+ pipelines. See [AI execution profiling](docs/AI_EXECUTION_PROFILING.md) for the
89
+ trace-to-quality workflow and five offline reference examples in `0.1.0`.
90
+
91
+ The [Harbor and Omnigent interoperability workstream](docs/INTEROPERABILITY.md)
92
+ includes read-only [Harbor ATIF](docs/HARBOR_ATIF.md) and
93
+ [job/trial/verifier import](docs/HARBOR_TRIALS.md), source-qualified native reports
94
+ and pinned offline fixtures. [Omnigent telemetry/session import](docs/OMNIGENT_OTEL.md)
95
+ preserves policy observations and coverage gaps. Task-paired cross-harness
96
+ comparisons and behavior-verified capabilities are included in this release.
97
+
98
+ The [bounded OTLP JSONL importer](docs/OTLP_JSONL.md) joins split telemetry traces
99
+ and keeps duplicate/conflicting records, conversion losses and inferred timing
100
+ explicit. It works offline without upstream runtimes or OpenTelemetry packages.
101
+
102
+ The [capability registry](docs/HARNESS_CAPABILITIES.md) lists explicit adapter
103
+ declarations and distinguishes current probe evidence from unknown/skipped
104
+ capabilities. Inspection does not enable runtime controls.
105
+
106
+ Run the [offline capability bench](docs/HARNESS_BENCH.md) to check actual wrapped
107
+ behavior, source counters and declaration drift. Missing SDKs and live-only
108
+ features remain explicit skips.
109
+
110
+ The [cross-harness cohort workflow](docs/CROSS_HARNESS_STUDIES.md) compares completed
111
+ Harbor jobs with exact task pairing and independent verifier criteria, while
112
+ retaining failed, missing and unpaired attempts in population reports.
113
+
114
+ [Coordination reports](docs/MULTIAGENT_EFFICIENCY.md) preserve distinct child
115
+ documents, observed interval overlap and usage attribution, with explicit gaps
116
+ for missing children, caller wait, duplicate-work inputs and review quality.
117
+
118
+ The [offline adoption guide](docs/INTEROPERABILITY_READINESS.md) connects the
119
+ copyable examples, source/quality limits, complete inventories and validation
120
+ workflow. These integrations are Unreleased checkout capabilities.
121
+
122
+ ## Without and with AgentLoop
123
+
124
+ <picture>
125
+ <source media="(max-width: 600px)" srcset="docs/assets/workflow-comparison-mobile.svg">
126
+ <source media="(prefers-reduced-motion: reduce)" srcset="docs/assets/workflow-comparison.svg">
127
+ <img src="docs/assets/workflow-comparison.gif" width="100%" alt="Architecture comparison: your agent feeds custom timing, usage parsing, retry analysis, output checks, and report code without AgentLoop. With AgentLoop, the same execution evidence feeds a shared tracing, analysis, and replay workflow.">
128
+ </picture>
129
+
130
+ <details>
131
+ <summary>Read the comparison in text</summary>
132
+
133
+ | Question | Without AgentLoop | With AgentLoop |
134
+ |---|---|---|
135
+ | Where did the time go? | Add timers and connect logs to calls. | Inspect recorded model, tool, and retry spans. |
136
+ | What should I investigate? | Look through calls and logs for repeated work. | Follow findings to affected spans and suggested changes. |
137
+ | Did the change help? | Write your own before/after comparison. | Compare saved runs with `agentloop replay`. |
138
+ | Is the output still acceptable? | Combine task-specific checks with the performance comparison. | Supply quality fixtures and evaluate them alongside performance gates. |
139
+
140
+ </details>
141
+
142
+ AgentLoop supplies the tracing and comparison workflow. You choose the change,
143
+ define what a correct output looks like, and decide which checks must pass.
144
+
145
+ ## How AgentLoop fits your stack
146
+
147
+ <picture>
148
+ <source media="(max-width: 600px)" srcset="docs/assets/framework-comparison-mobile.svg">
149
+ <source media="(prefers-reduced-motion: reduce)" srcset="docs/assets/framework-comparison.svg">
150
+ <img src="docs/assets/framework-comparison.gif" width="100%" alt="Architecture: your application runs the agent and calls models and tools. AgentLoop decorators and adapters record spans into trace JSON. Analyze produces metrics and findings; replay compares a candidate with its baseline and your quality fixtures. Both produce reports for review or CI.">
151
+ </picture>
152
+
153
+ Your application runs the agent and chooses its framework and models.
154
+ AgentLoop's [decorators and adapters](#framework-integrations) record the
155
+ instrumented calls. Exported traces feed analysis, baseline/candidate replay,
156
+ and reports for review or CI.
157
+
158
+ When you change the framework, model, prompt, or execution strategy, record the
159
+ same task again. [Compare both runs](#compare-before-and-after) with the same
160
+ [quality fixtures](#quality-gates) to check the effect of your change.
161
+
162
+ ## Quickstart
163
+
164
+ Requires Python 3.10 or newer:
165
+
166
+ ```bash
167
+ python -m pip install agentloop-profiler
168
+ agentloop quickstart
169
+ ```
170
+
171
+ The package name is `agentloop-profiler`; the Python import and CLI command are
172
+ both `agentloop`.
173
+
174
+ `quickstart` creates `runs/agentloop_quickstart.json` and prints findings from
175
+ synthetic data. Use it to check the installation and learn the report format.
176
+ The demo itself makes no network or model API calls.
177
+
178
+ Inspect the saved trace and export the complete analysis:
179
+
180
+ ```bash
181
+ agentloop analyze runs/agentloop_quickstart.json --json-out runs/quickstart_analysis.json
182
+ ```
183
+
184
+ The analysis JSON contains the trace, its metrics, findings, and optimization
185
+ suggestions. See [First useful result](docs/FIRST_USE.md) for more options.
186
+
187
+ Add `--html runs/report.html` to `analyze` for a single offline report with a
188
+ timeline and linked finding evidence. See [HTML reports](docs/HTML_REPORTS.md).
189
+
190
+ ## Record your own run
191
+
192
+ Save this complete example as `example_agent.py`. It traces a few local function
193
+ calls so you can try instrumentation without a model SDK or API key. Replace the
194
+ function body with your own work when adapting it to an agent.
195
+
196
+ ```python
197
+ import agentloop
198
+
199
+ NOTES = {
200
+ "tracing": "Record the steps in a workflow.",
201
+ "optimization": "Investigate repeated or expensive work.",
202
+ "replay": "Compare saved baseline and candidate traces.",
203
+ }
204
+
205
+
206
+ @agentloop.trace_tool(name="lookup_note")
207
+ def lookup_note(topic: str) -> str:
208
+ return NOTES[topic]
209
+
210
+
211
+ with agentloop.trace_agent("research_agent") as trace:
212
+ output = {"notes": [lookup_note(topic) for topic in NOTES]}
213
+ trace.metadata["output"] = output
214
+
215
+ trace.export_json("runs/research_agent.json")
216
+ print(output)
217
+ ```
218
+
219
+ Run it, then analyze the file it created:
220
+
221
+ ```bash
222
+ python example_agent.py
223
+ agentloop analyze runs/research_agent.json --json-out runs/research_agent_analysis.json
224
+ ```
225
+
226
+ The decorator records each function call's duration and status. The example also
227
+ explicitly saves the final output in trace metadata so the quality checks below
228
+ can read it. Decide which outputs are appropriate to retain when adapting this
229
+ example to real data.
230
+
231
+ For model calls, use an [SDK integration](#framework-integrations) to capture
232
+ provider token usage. The [integration guide](docs/INTEGRATIONS.md) also covers
233
+ model decorators, context managers, streaming, and cancellation.
234
+
235
+ ## Inspect findings
236
+
237
+ Start with `analyze`. It combines metrics, findings, and proposed optimizations
238
+ in one report. AgentLoop looks for patterns such as repeated context, retry loops,
239
+ repeated model calls, large steps, and recurring tool calls.
240
+
241
+ On `main`, reports and optimization use the same [versioned finding rules](docs/FINDING_RULES.md).
242
+ If a rule fails, its diagnostics remain visible and analysis is marked incomplete.
243
+ CI requires complete analysis before recommending a merge.
244
+
245
+ Treat a suggestion as a change to investigate. For example, repeated tool names
246
+ alone do not establish that calls are safe to run concurrently. The development
247
+ version on `main` exposes the evidence and assumptions behind
248
+ [parallelization candidates](docs/PARALLELIZATION.md).
249
+
250
+ Use individual commands when you need a specific artifact:
251
+
252
+ | Command | Output |
253
+ |---|---|
254
+ | `agentloop report runs/research_agent.json` | Metrics for one run. |
255
+ | `agentloop diagnose --path runs/research_agent.json` | Findings with affected spans and validation criteria. |
256
+ | `agentloop optimize --path runs/research_agent.json` | Suggested changes and estimated savings. |
257
+ | `agentloop patch --path runs/research_agent.json --repo .` | Proposed edits for the repository at `.`, ready for you to review and apply. |
258
+
259
+ Change one thing at a time, such as reducing repeated context or changing a retry
260
+ policy, so you can attribute the result to that change.
261
+
262
+ ## Compare before and after
263
+
264
+ Run your agent before the change and export `runs/baseline.json`. Run the changed
265
+ agent on the same task and export `runs/candidate.json`. `replay` compares these
266
+ saved traces:
267
+
268
+ ```bash
269
+ agentloop replay --baseline runs/baseline.json --candidate runs/candidate.json --min-latency-improvement-pct 10
270
+ ```
271
+
272
+ This requires at least a 10% latency improvement. The report also compares costs,
273
+ tokens, retries, and call counts. It writes `runs/replay_report.md` and exits
274
+ nonzero when a required gate fails. Use `agentloop replay --help` to choose other
275
+ thresholds or a JSON output path.
276
+
277
+ A result applies to the runs and checks you supplied. Repeat the comparison across
278
+ representative tasks before drawing broader conclusions. Add output checks when
279
+ you need evidence that the changed agent still meets its task requirements.
280
+
281
+ ## Quality gates
282
+
283
+ Quality fixtures define checks against the recorded output. For the example
284
+ above, save this as `fixtures.json`:
285
+
286
+ ```json
287
+ {
288
+ "fixtures": [
289
+ {
290
+ "id": "notes_present",
291
+ "scorer": {"type": "required_fields", "required": ["notes"]}
292
+ }
293
+ ]
294
+ }
295
+ ```
296
+
297
+ Run the check against the example trace:
298
+
299
+ ```bash
300
+ agentloop quality-report fixtures.json --candidate runs/research_agent.json
301
+ ```
302
+
303
+ This checks that the final output has a nonempty `notes` field. Choose expectations
304
+ that express correctness for your own task. Fixtures can provide outputs directly
305
+ or use a trace's `metadata.output`; the scorer can also use the last model call's
306
+ recorded output text when available.
307
+
308
+ | Scorer | Check |
309
+ |---|---|
310
+ | `exact_match` | Output exactly matches an expected value, including its type. |
311
+ | `contains` | Output contains specified text. |
312
+ | `glob` | Output matches a bounded wildcard pattern. |
313
+ | `required_fields` | A JSON object contains the specified nonempty fields. |
314
+ | `json_subset` | A JSON object contains specified top-level keys with matching values. |
315
+ | `custom` | A trusted local Python function, configured as `module:function`, scores the output. |
316
+
317
+ Every candidate case must pass. If you set `--min-quality-score` in `replay`/`ci`
318
+ (or `--min-score` in `quality-report`), the average score must also meet that threshold.
319
+ Invalid suites fail closed.
320
+
321
+ Custom scorers run Python code and should be used only with trusted local fixtures.
322
+ The HTTP endpoint rejects them. See the [changelog](CHANGELOG.md) for `regex` and
323
+ `json_schema` migration notes.
324
+
325
+ Once you have baseline and candidate traces, use the same fixtures in CI:
326
+
327
+ ```bash
328
+ agentloop ci --baseline runs/baseline.json --candidate runs/candidate.json --quality-fixtures fixtures.json
329
+ ```
330
+
331
+ `ci` writes a Markdown report suitable for a pull request and exits nonzero when
332
+ a required gate fails. It evaluates the traces your application supplies.
333
+
334
+ The repository's required replay check uses synthetic demos to test AgentLoop's
335
+ CI machinery. For comparisons using your application's artifacts, see
336
+ [CI self-tests and application comparisons](docs/CI.md).
337
+
338
+ ## Understand the results
339
+
340
+ These notes describe the current `main` branch. Check [Unreleased changes](CHANGELOG.md#unreleased)
341
+ for behavior that has not yet shipped in the published package.
342
+
343
+ | Result | How to interpret it |
344
+ |---|---|
345
+ | Runtime and call counts | Recorded execution data. `total_runtime_ms` is elapsed time; `cumulative_span_time_ms` sums spans and can be larger when calls overlap or nest. |
346
+ | Operation kinds | Agent, workflow, model, tool, retrieval, and other roles recorded alongside legacy event categories. See [Operation kinds](docs/OPERATIONS.md). |
347
+ | Token counts | Counts identify their source: a provider, a tokenizer, user code, or a word-count estimate. Missing usage is marked unavailable. |
348
+ | Model cost | A calculation from token counts and configured pricing. Unknown prices or estimated usage limit the comparisons you can make. |
349
+ | Optimization savings | Uncalibrated predictions with versioned formulas, coefficients, and assumptions. Measure a candidate run to establish the actual effect. |
350
+ | Quality scores | Results of the checks you supplied. Their coverage depends on your fixtures. |
351
+
352
+ Cost gates can be marked `indeterminate` when pricing or usable token counts are
353
+ missing. An indeterminate cost comparison does not fail the default gate; requiring
354
+ a positive `--min-cost-improvement-pct` makes unverifiable cost improvement fail.
355
+ See [Pricing](docs/PRICING.md) and [Trace compatibility](docs/TRACE_SCHEMA.md) for
356
+ the details, including how older traces are handled.
357
+
358
+ The optimizer avoids double-counting suggestions that affect the same spans.
359
+ Reports say whether the chosen combination is exact or approximate. See
360
+ [Savings selection](docs/SAVINGS_SELECTION.md).
361
+ For individual predictions, see [Estimator provenance](docs/ESTIMATORS.md).
362
+ The [intervention ledger](docs/INTERVENTIONS.md) links finding predictions to
363
+ measured candidate results and preserves quality checks in an exportable record.
364
+ For experiments across tasks and repetitions, use [paired study summaries](docs/STUDIES.md).
365
+
366
+ Keep your Markdown renderer's safe mode or HTML sanitizer enabled when viewing
367
+ reports from untrusted traces.
368
+
369
+ ## Framework integrations
370
+
371
+ For existing telemetry, [OTLP conformance](docs/TELEMETRY_CONFORMANCE.md) covers
372
+ GenAI, OpenInference, and MCP JSON, including operation kinds and evidence metadata.
373
+ From an unreleased source checkout, [standards-first onboarding](docs/ONBOARDING.md)
374
+ validates existing telemetry before analysis and provides one explicit SDK
375
+ instrumentation entrypoint with documented coverage and measured local overhead.
376
+
377
+ | Integration | How it connects |
378
+ |---|---|
379
+ | Custom Python agents | Decorators and context managers around your functions. |
380
+ | OpenAI SDK | Wrap a client or callable to capture calls, streams, and reported usage. |
381
+ | OpenAI Agents SDK | Attach an AgentLoop tracing processor. |
382
+ | LangGraph | Instrument the builder before adding nodes, then wrap the compiled runnable. |
383
+ | CrewAI | Wrap crew, task, or agent execution methods. |
384
+ | OpenTelemetry / Vercel AI SDK telemetry | Import supported telemetry into AgentLoop traces. |
385
+
386
+ The adapters are included in AgentLoop. Install the framework's own SDK separately
387
+ when needed; `python -m pip install "agentloop-profiler[instrumentation]"` includes
388
+ the OpenAI Python SDK. See [Framework integrations](docs/INTEGRATIONS.md) for
389
+ setup and supported behavior.
390
+
391
+ ## Dashboard and persistence
392
+
393
+ The dashboard reads stored traces. From a [source checkout](#source-checkout),
394
+ load the synthetic example and start Streamlit:
395
+
396
+ ```bash
397
+ uv run --frozen --all-extras agentloop quickstart
398
+ uv run --frozen --all-extras agentloop store-trace --path runs/agentloop_quickstart.json --project-id default
399
+ uv run --frozen --all-extras streamlit run dashboard/app.py
400
+ ```
401
+
402
+ Open the URL printed by Streamlit and leave the sidebar's Project field set to
403
+ `default`. To inspect your own data, store your trace file with `store-trace`.
404
+
405
+ AgentLoop uses SQLite by default and supports Postgres for shared storage. The
406
+ optional HTTP API accepts traces and serves project-scoped reports and findings.
407
+ Application endpoints use `/v1`. Existing unversioned aliases remain available
408
+ throughout 0.x; see [API versioning](docs/API_VERSIONING.md) for the migration path.
409
+ See [Dashboard setup](docs/DASHBOARD.md) and [Production deployment](docs/PRODUCTION.md)
410
+ for database configuration, API authentication, and deployment instructions.
411
+
412
+ ## Other installation options
413
+
414
+ ### Source checkout
415
+
416
+ Use a source checkout for the dashboard or the latest unreleased changes.
417
+ Install [uv](https://docs.astral.sh/uv/getting-started/installation/), then run:
418
+
419
+ ```bash
420
+ git clone https://github.com/dipeshbabu/agentloop.git
421
+ cd agentloop
422
+ uv sync --locked --all-extras
423
+ uv run --frozen --all-extras agentloop quickstart
424
+ ```
425
+
426
+ ### Standalone CLI
427
+
428
+ The [GitHub Releases page](https://github.com/dipeshbabu/agentloop/releases) has
429
+ executables for Linux x86-64, Windows x86-64, macOS Intel, and macOS Apple silicon.
430
+ They bundle Python and the core CLI. Use the Python package for SDK instrumentation,
431
+ the dashboard, API server, or Postgres support.
432
+
433
+ Use the downloaded executable wherever the examples show `agentloop`.
434
+
435
+ <details>
436
+ <summary>Download and verify a standalone executable</summary>
437
+
438
+ Download the matching file and `SHA256SUMS` from the same release. Replace `X.Y.Z`
439
+ with its version number.
440
+
441
+ Linux (Bash):
442
+
443
+ ```bash
444
+ set -euo pipefail
445
+ version=X.Y.Z
446
+ asset="agentloop-v${version}-linux-x86_64"
447
+ curl -LO "https://github.com/dipeshbabu/agentloop/releases/download/v${version}/${asset}"
448
+ curl -LO "https://github.com/dipeshbabu/agentloop/releases/download/v${version}/SHA256SUMS"
449
+ mapfile -t checksum_lines < <(awk -v asset="$asset" '$2 == asset { print }' SHA256SUMS)
450
+ if [ "${#checksum_lines[@]}" -ne 1 ]; then
451
+ echo "Expected exactly one checksum for ${asset}" >&2
452
+ exit 1
453
+ fi
454
+ printf '%s\n' "${checksum_lines[0]}" | sha256sum --check --strict
455
+ chmod +x "$asset"
456
+ ./"$asset" --help
457
+ ```
458
+
459
+ Windows PowerShell:
460
+
461
+ ```powershell
462
+ $Version = "X.Y.Z"
463
+ $Asset = "agentloop-v$Version-windows-x86_64.exe"
464
+ Invoke-WebRequest "https://github.com/dipeshbabu/agentloop/releases/download/v$Version/$Asset" -OutFile agentloop.exe
465
+ Invoke-WebRequest "https://github.com/dipeshbabu/agentloop/releases/download/v$Version/SHA256SUMS" -OutFile SHA256SUMS
466
+ $ChecksumLines = @(Get-Content SHA256SUMS | Where-Object {
467
+ $_ -match "^[0-9a-fA-F]{64} $([regex]::Escape($Asset))$"
468
+ })
469
+ if ($ChecksumLines.Count -ne 1) { throw "Expected exactly one checksum for $Asset" }
470
+ $ExpectedHash = ($ChecksumLines[0] -split " ", 2)[0]
471
+ $ActualHash = (Get-FileHash .\agentloop.exe -Algorithm SHA256).Hash
472
+ if ($ActualHash -ne $ExpectedHash) { throw "Checksum verification failed for $Asset" }
473
+ .\agentloop.exe --help
474
+ ```
475
+
476
+ Each release includes platform-specific third-party notices. macOS executables
477
+ are ad-hoc signed but not notarized; Gatekeeper may require approval on first launch.
478
+
479
+ </details>
480
+
481
+ ## Research use
482
+
483
+ For experiments, record one trace per task attempt and condition. Attach metadata
484
+ such as task ID, seed, model, and source commit, and repeat comparisons across your
485
+ task set. The [research guide](docs/RESEARCH.md) explains this workflow. From a
486
+ source checkout, run the offline paired example with:
487
+
488
+ ```bash
489
+ uv run --frozen --all-extras python examples/research_experiment_demo.py
490
+ ```
491
+
492
+ ## Help and contributions
493
+
494
+ Run `agentloop --help` for all commands, or `agentloop COMMAND --help` for a specific
495
+ command. Use `agentloop doctor` to inspect your installation and available integrations.
496
+
497
+ - [Support](SUPPORT.md): usage help and troubleshooting.
498
+ - [Issue forms](https://github.com/dipeshbabu/agentloop/issues/new/choose): bugs and feature requests.
499
+ - [Contributing](CONTRIBUTING.md): development setup and required checks.
500
+ - [Roadmap](docs/ROADMAP.md) and [changelog](CHANGELOG.md): project direction and release changes.
501
+ - [Security](SECURITY.md): private vulnerability reports.
502
+ - [Governance](GOVERNANCE.md) and [Code of Conduct](CODE_OF_CONDUCT.md): project decisions and participation.
503
+
504
+ AgentLoop is under active pre-1.0 development. Use a tagged release when you need
505
+ a fixed version, and check the changelog before upgrading. Maintainers can use the
506
+ [launch checklist](docs/OPEN_SOURCE_CHECKLIST.md) when preparing a public release.
507
+
508
+ ## License
509
+
510
+ Copyright 2026 Dipesh Tharu Mahato.
511
+
512
+ AgentLoop is licensed under the [Apache License 2.0](LICENSE). Dependencies retain
513
+ their own terms; see [THIRD_PARTY_LICENSES.md](THIRD_PARTY_LICENSES.md).