agentloop-profiler 0.5.0__tar.gz → 0.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of agentloop-profiler might be problematic. Click here for more details.

Files changed (159) hide show
  1. agentloop_profiler-0.7.0/PKG-INFO +475 -0
  2. agentloop_profiler-0.7.0/README.md +424 -0
  3. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/THIRD_PARTY_LICENSES.md +26 -6
  4. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/__init__.py +6 -2
  5. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/audit.py +8 -3
  6. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/ci.py +71 -4
  7. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/cli.py +232 -24
  8. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/client.py +41 -12
  9. agentloop_profiler-0.7.0/agentloop/costs.py +667 -0
  10. agentloop_profiler-0.7.0/agentloop/cursor_validation.py +48 -0
  11. agentloop_profiler-0.7.0/agentloop/decorators.py +445 -0
  12. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/demo.py +17 -0
  13. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/doctor.py +16 -19
  14. agentloop_profiler-0.7.0/agentloop/entrypoint.py +190 -0
  15. agentloop_profiler-0.7.0/agentloop/estimates.py +133 -0
  16. agentloop_profiler-0.7.0/agentloop/events.py +75 -0
  17. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/exporters.py +3 -1
  18. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/findings.py +111 -20
  19. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/graph.py +66 -53
  20. agentloop_profiler-0.7.0/agentloop/html_report.py +357 -0
  21. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/integrations/crewai.py +5 -5
  22. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/integrations/langgraph.py +12 -2
  23. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/integrations/openai.py +90 -44
  24. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/integrations/openai_agents.py +80 -1
  25. agentloop_profiler-0.7.0/agentloop/intervention_service.py +110 -0
  26. agentloop_profiler-0.7.0/agentloop/intervention_store.py +118 -0
  27. agentloop_profiler-0.7.0/agentloop/interventions.py +176 -0
  28. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/issues.py +2 -1
  29. agentloop_profiler-0.7.0/agentloop/metrics.py +272 -0
  30. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/migrations.py +63 -1
  31. agentloop_profiler-0.7.0/agentloop/operations.py +40 -0
  32. agentloop_profiler-0.7.0/agentloop/optimizer.py +142 -0
  33. agentloop_profiler-0.7.0/agentloop/otel.py +698 -0
  34. agentloop_profiler-0.7.0/agentloop/otel_semantics.py +134 -0
  35. agentloop_profiler-0.7.0/agentloop/parallelism.py +135 -0
  36. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/patches.py +24 -4
  37. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/plan_export.py +38 -4
  38. agentloop_profiler-0.7.0/agentloop/quality.py +409 -0
  39. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/replay.py +182 -36
  40. agentloop_profiler-0.5.0/agentloop/optimizer.py → agentloop_profiler-0.7.0/agentloop/rules.py +165 -134
  41. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/savings.py +40 -17
  42. agentloop_profiler-0.7.0/agentloop/schema.py +247 -0
  43. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/server.py +138 -32
  44. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/store.py +234 -64
  45. agentloop_profiler-0.7.0/agentloop/studies.py +441 -0
  46. agentloop_profiler-0.7.0/agentloop/tokens.py +174 -0
  47. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/tracer.py +145 -18
  48. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/value.py +64 -14
  49. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/version.py +1 -1
  50. agentloop_profiler-0.7.0/agentloop_profiler.egg-info/PKG-INFO +475 -0
  51. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop_profiler.egg-info/SOURCES.txt +48 -0
  52. agentloop_profiler-0.7.0/agentloop_profiler.egg-info/entry_points.txt +2 -0
  53. agentloop_profiler-0.7.0/dashboard/__init__.py +5 -0
  54. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/dashboard/app.py +144 -69
  55. agentloop_profiler-0.7.0/dashboard/streamlit_compat.py +63 -0
  56. agentloop_profiler-0.7.0/dashboard/trace_upload.py +57 -0
  57. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/dashboard/value_view.py +7 -3
  58. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/pyproject.toml +10 -4
  59. agentloop_profiler-0.7.0/tests/test_api_versioning.py +210 -0
  60. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_ci_command.py +120 -2
  61. agentloop_profiler-0.7.0/tests/test_ci_evidence.py +93 -0
  62. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_cli_trace_inputs.py +34 -0
  63. agentloop_profiler-0.7.0/tests/test_client.py +237 -0
  64. agentloop_profiler-0.7.0/tests/test_costs.py +500 -0
  65. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_crewai_integration.py +26 -0
  66. agentloop_profiler-0.7.0/tests/test_cursor_server.py +59 -0
  67. agentloop_profiler-0.7.0/tests/test_cursor_shape_validation.py +105 -0
  68. agentloop_profiler-0.7.0/tests/test_dashboard_input_validation.py +206 -0
  69. agentloop_profiler-0.7.0/tests/test_dashboard_quality.py +27 -0
  70. agentloop_profiler-0.7.0/tests/test_dashboard_trace_upload.py +85 -0
  71. agentloop_profiler-0.7.0/tests/test_dashboard_value_view.py +10 -0
  72. agentloop_profiler-0.7.0/tests/test_decorators.py +628 -0
  73. agentloop_profiler-0.7.0/tests/test_dependabot_config.py +13 -0
  74. agentloop_profiler-0.7.0/tests/test_diagnosis_api.py +140 -0
  75. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_distribution_metadata.py +1 -1
  76. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_doctor_autoinstrument.py +67 -6
  77. agentloop_profiler-0.7.0/tests/test_estimates.py +149 -0
  78. agentloop_profiler-0.7.0/tests/test_evidence_workflow.py +29 -0
  79. agentloop_profiler-0.7.0/tests/test_finding_identity.py +144 -0
  80. agentloop_profiler-0.7.0/tests/test_finding_rules.py +112 -0
  81. agentloop_profiler-0.7.0/tests/test_first_use_cli.py +54 -0
  82. agentloop_profiler-0.7.0/tests/test_graph.py +220 -0
  83. agentloop_profiler-0.7.0/tests/test_html_report.py +166 -0
  84. agentloop_profiler-0.7.0/tests/test_integration_conformance.py +210 -0
  85. agentloop_profiler-0.7.0/tests/test_interventions.py +238 -0
  86. agentloop_profiler-0.7.0/tests/test_langgraph_conformance.py +67 -0
  87. agentloop_profiler-0.7.0/tests/test_langgraph_integration.py +183 -0
  88. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_markdown_exporters.py +84 -0
  89. agentloop_profiler-0.7.0/tests/test_metrics.py +163 -0
  90. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_migrations.py +54 -6
  91. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_openai_agents_integration.py +131 -1
  92. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_openai_integration.py +129 -0
  93. agentloop_profiler-0.7.0/tests/test_operations.py +152 -0
  94. agentloop_profiler-0.7.0/tests/test_optimizer.py +57 -0
  95. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_otel_interop.py +162 -1
  96. agentloop_profiler-0.7.0/tests/test_parallelization_evidence.py +231 -0
  97. agentloop_profiler-0.7.0/tests/test_python_support.py +28 -0
  98. agentloop_profiler-0.7.0/tests/test_quality.py +481 -0
  99. agentloop_profiler-0.7.0/tests/test_release_workflows.py +198 -0
  100. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_remote_cli_credentials.py +1 -1
  101. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_replay.py +251 -1
  102. agentloop_profiler-0.7.0/tests/test_research_example.py +25 -0
  103. agentloop_profiler-0.7.0/tests/test_rule_error_privacy.py +67 -0
  104. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_savings_aggregation.py +64 -4
  105. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_server.py +187 -11
  106. agentloop_profiler-0.7.0/tests/test_standalone_notices.py +201 -0
  107. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_store.py +50 -0
  108. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_store_contract.py +255 -1
  109. agentloop_profiler-0.7.0/tests/test_streamlit_compat.py +40 -0
  110. agentloop_profiler-0.7.0/tests/test_studies.py +254 -0
  111. agentloop_profiler-0.7.0/tests/test_telemetry_conformance.py +234 -0
  112. agentloop_profiler-0.7.0/tests/test_token_provenance.py +520 -0
  113. agentloop_profiler-0.7.0/tests/test_trace_context.py +153 -0
  114. agentloop_profiler-0.7.0/tests/test_trace_schema.py +96 -0
  115. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_value.py +32 -1
  116. agentloop_profiler-0.5.0/PKG-INFO +0 -598
  117. agentloop_profiler-0.5.0/README.md +0 -550
  118. agentloop_profiler-0.5.0/agentloop/costs.py +0 -15
  119. agentloop_profiler-0.5.0/agentloop/decorators.py +0 -160
  120. agentloop_profiler-0.5.0/agentloop/events.py +0 -49
  121. agentloop_profiler-0.5.0/agentloop/metrics.py +0 -123
  122. agentloop_profiler-0.5.0/agentloop/otel.py +0 -302
  123. agentloop_profiler-0.5.0/agentloop/quality.py +0 -222
  124. agentloop_profiler-0.5.0/agentloop_profiler.egg-info/PKG-INFO +0 -598
  125. agentloop_profiler-0.5.0/agentloop_profiler.egg-info/entry_points.txt +0 -2
  126. agentloop_profiler-0.5.0/dashboard/__init__.py +0 -1
  127. agentloop_profiler-0.5.0/tests/test_client.py +0 -144
  128. agentloop_profiler-0.5.0/tests/test_dashboard_value_view.py +0 -7
  129. agentloop_profiler-0.5.0/tests/test_decorators.py +0 -58
  130. agentloop_profiler-0.5.0/tests/test_langgraph_integration.py +0 -89
  131. agentloop_profiler-0.5.0/tests/test_metrics.py +0 -30
  132. agentloop_profiler-0.5.0/tests/test_optimizer.py +0 -25
  133. agentloop_profiler-0.5.0/tests/test_quality.py +0 -114
  134. agentloop_profiler-0.5.0/tests/test_release_workflows.py +0 -91
  135. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/LICENSE +0 -0
  136. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/autoinstrument.py +0 -0
  137. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/config.py +0 -0
  138. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/integrations/__init__.py +0 -0
  139. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/integrations/sdk.py +0 -0
  140. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/integrations/vercel_ai.py +0 -0
  141. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/markdown.py +0 -0
  142. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/otel_ids.py +0 -0
  143. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/runtime.py +0 -0
  144. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop/timing.py +0 -0
  145. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop_profiler.egg-info/dependency_links.txt +0 -0
  146. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop_profiler.egg-info/requires.txt +0 -0
  147. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/agentloop_profiler.egg-info/top_level.txt +0 -0
  148. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/setup.cfg +0 -0
  149. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_bump_version.py +0 -0
  150. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_cli_store_commands.py +0 -0
  151. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_demo_cli.py +0 -0
  152. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_exporters.py +0 -0
  153. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_issues.py +0 -0
  154. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_markdown.py +0 -0
  155. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_otel_ids.py +0 -0
  156. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_patch_plan.py +0 -0
  157. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_runtime.py +0 -0
  158. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_timing.py +0 -0
  159. {agentloop_profiler-0.5.0 → agentloop_profiler-0.7.0}/tests/test_vercel_ai_integration.py +0 -0
@@ -0,0 +1,475 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentloop-profiler
3
+ Version: 0.7.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
+ ## Without and with AgentLoop
88
+
89
+ <picture>
90
+ <source media="(max-width: 600px)" srcset="docs/assets/workflow-comparison-mobile.svg">
91
+ <source media="(prefers-reduced-motion: reduce)" srcset="docs/assets/workflow-comparison.svg">
92
+ <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.">
93
+ </picture>
94
+
95
+ <details>
96
+ <summary>Read the comparison in text</summary>
97
+
98
+ | Question | Without AgentLoop | With AgentLoop |
99
+ |---|---|---|
100
+ | Where did the time go? | Add timers and connect logs to calls. | Inspect recorded model, tool, and retry spans. |
101
+ | What should I investigate? | Look through calls and logs for repeated work. | Follow findings to affected spans and suggested changes. |
102
+ | Did the change help? | Write your own before/after comparison. | Compare saved runs with `agentloop replay`. |
103
+ | Is the output still acceptable? | Combine task-specific checks with the performance comparison. | Supply quality fixtures and evaluate them alongside performance gates. |
104
+
105
+ </details>
106
+
107
+ AgentLoop supplies the tracing and comparison workflow. You choose the change,
108
+ define what a correct output looks like, and decide which checks must pass.
109
+
110
+ ## How AgentLoop fits your stack
111
+
112
+ <picture>
113
+ <source media="(max-width: 600px)" srcset="docs/assets/framework-comparison-mobile.svg">
114
+ <source media="(prefers-reduced-motion: reduce)" srcset="docs/assets/framework-comparison.svg">
115
+ <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.">
116
+ </picture>
117
+
118
+ Your application runs the agent and chooses its framework and models.
119
+ AgentLoop's [decorators and adapters](#framework-integrations) record the
120
+ instrumented calls. Exported traces feed analysis, baseline/candidate replay,
121
+ and reports for review or CI.
122
+
123
+ When you change the framework, model, prompt, or execution strategy, record the
124
+ same task again. [Compare both runs](#compare-before-and-after) with the same
125
+ [quality fixtures](#quality-gates) to check the effect of your change.
126
+
127
+ ## Quickstart
128
+
129
+ Requires Python 3.10 or newer:
130
+
131
+ ```bash
132
+ python -m pip install agentloop-profiler
133
+ agentloop quickstart
134
+ ```
135
+
136
+ The package name is `agentloop-profiler`; the Python import and CLI command are
137
+ both `agentloop`.
138
+
139
+ `quickstart` creates `runs/agentloop_quickstart.json` and prints findings from
140
+ synthetic data. Use it to check the installation and learn the report format.
141
+ The demo itself makes no network or model API calls.
142
+
143
+ Inspect the saved trace and export the complete analysis:
144
+
145
+ ```bash
146
+ agentloop analyze runs/agentloop_quickstart.json --json-out runs/quickstart_analysis.json
147
+ ```
148
+
149
+ The analysis JSON contains the trace, its metrics, findings, and optimization
150
+ suggestions. See [First useful result](docs/FIRST_USE.md) for more options.
151
+
152
+ Add `--html runs/report.html` to `analyze` for a single offline report with a
153
+ timeline and linked finding evidence. See [HTML reports](docs/HTML_REPORTS.md).
154
+
155
+ ## Record your own run
156
+
157
+ Save this complete example as `example_agent.py`. It traces a few local function
158
+ calls so you can try instrumentation without a model SDK or API key. Replace the
159
+ function body with your own work when adapting it to an agent.
160
+
161
+ ```python
162
+ import agentloop
163
+
164
+ NOTES = {
165
+ "tracing": "Record the steps in a workflow.",
166
+ "optimization": "Investigate repeated or expensive work.",
167
+ "replay": "Compare saved baseline and candidate traces.",
168
+ }
169
+
170
+
171
+ @agentloop.trace_tool(name="lookup_note")
172
+ def lookup_note(topic: str) -> str:
173
+ return NOTES[topic]
174
+
175
+
176
+ with agentloop.trace_agent("research_agent") as trace:
177
+ output = {"notes": [lookup_note(topic) for topic in NOTES]}
178
+ trace.metadata["output"] = output
179
+
180
+ trace.export_json("runs/research_agent.json")
181
+ print(output)
182
+ ```
183
+
184
+ Run it, then analyze the file it created:
185
+
186
+ ```bash
187
+ python example_agent.py
188
+ agentloop analyze runs/research_agent.json --json-out runs/research_agent_analysis.json
189
+ ```
190
+
191
+ The decorator records each function call's duration and status. The example also
192
+ explicitly saves the final output in trace metadata so the quality checks below
193
+ can read it. Decide which outputs are appropriate to retain when adapting this
194
+ example to real data.
195
+
196
+ For model calls, use an [SDK integration](#framework-integrations) to capture
197
+ provider token usage. The [integration guide](docs/INTEGRATIONS.md) also covers
198
+ model decorators, context managers, streaming, and cancellation.
199
+
200
+ ## Inspect findings
201
+
202
+ Start with `analyze`. It combines metrics, findings, and proposed optimizations
203
+ in one report. AgentLoop looks for patterns such as repeated context, retry loops,
204
+ repeated model calls, large steps, and recurring tool calls.
205
+
206
+ On `main`, reports and optimization use the same [versioned finding rules](docs/FINDING_RULES.md).
207
+ If a rule fails, its diagnostics remain visible and analysis is marked incomplete.
208
+ CI requires complete analysis before recommending a merge.
209
+
210
+ Treat a suggestion as a change to investigate. For example, repeated tool names
211
+ alone do not establish that calls are safe to run concurrently. The development
212
+ version on `main` exposes the evidence and assumptions behind
213
+ [parallelization candidates](docs/PARALLELIZATION.md).
214
+
215
+ Use individual commands when you need a specific artifact:
216
+
217
+ | Command | Output |
218
+ |---|---|
219
+ | `agentloop report runs/research_agent.json` | Metrics for one run. |
220
+ | `agentloop diagnose --path runs/research_agent.json` | Findings with affected spans and validation criteria. |
221
+ | `agentloop optimize --path runs/research_agent.json` | Suggested changes and estimated savings. |
222
+ | `agentloop patch --path runs/research_agent.json --repo .` | Proposed edits for the repository at `.`, ready for you to review and apply. |
223
+
224
+ Change one thing at a time, such as reducing repeated context or changing a retry
225
+ policy, so you can attribute the result to that change.
226
+
227
+ ## Compare before and after
228
+
229
+ Run your agent before the change and export `runs/baseline.json`. Run the changed
230
+ agent on the same task and export `runs/candidate.json`. `replay` compares these
231
+ saved traces:
232
+
233
+ ```bash
234
+ agentloop replay --baseline runs/baseline.json --candidate runs/candidate.json --min-latency-improvement-pct 10
235
+ ```
236
+
237
+ This requires at least a 10% latency improvement. The report also compares costs,
238
+ tokens, retries, and call counts. It writes `runs/replay_report.md` and exits
239
+ nonzero when a required gate fails. Use `agentloop replay --help` to choose other
240
+ thresholds or a JSON output path.
241
+
242
+ A result applies to the runs and checks you supplied. Repeat the comparison across
243
+ representative tasks before drawing broader conclusions. Add output checks when
244
+ you need evidence that the changed agent still meets its task requirements.
245
+
246
+ ## Quality gates
247
+
248
+ Quality fixtures define checks against the recorded output. For the example
249
+ above, save this as `fixtures.json`:
250
+
251
+ ```json
252
+ {
253
+ "fixtures": [
254
+ {
255
+ "id": "notes_present",
256
+ "scorer": {"type": "required_fields", "required": ["notes"]}
257
+ }
258
+ ]
259
+ }
260
+ ```
261
+
262
+ Run the check against the example trace:
263
+
264
+ ```bash
265
+ agentloop quality-report fixtures.json --candidate runs/research_agent.json
266
+ ```
267
+
268
+ This checks that the final output has a nonempty `notes` field. Choose expectations
269
+ that express correctness for your own task. Fixtures can provide outputs directly
270
+ or use a trace's `metadata.output`; the scorer can also use the last model call's
271
+ recorded output text when available.
272
+
273
+ | Scorer | Check |
274
+ |---|---|
275
+ | `exact_match` | Output exactly matches an expected value, including its type. |
276
+ | `contains` | Output contains specified text. |
277
+ | `glob` | Output matches a bounded wildcard pattern. |
278
+ | `required_fields` | A JSON object contains the specified nonempty fields. |
279
+ | `json_subset` | A JSON object contains specified top-level keys with matching values. |
280
+ | `custom` | A trusted local Python function, configured as `module:function`, scores the output. |
281
+
282
+ Every candidate case must pass. If you set `--min-quality-score` in `replay`/`ci`
283
+ (or `--min-score` in `quality-report`), the average score must also meet that threshold.
284
+ Invalid suites fail closed.
285
+
286
+ Custom scorers run Python code and should be used only with trusted local fixtures.
287
+ The HTTP endpoint rejects them. See the [changelog](CHANGELOG.md) for `regex` and
288
+ `json_schema` migration notes.
289
+
290
+ Once you have baseline and candidate traces, use the same fixtures in CI:
291
+
292
+ ```bash
293
+ agentloop ci --baseline runs/baseline.json --candidate runs/candidate.json --quality-fixtures fixtures.json
294
+ ```
295
+
296
+ `ci` writes a Markdown report suitable for a pull request and exits nonzero when
297
+ a required gate fails. It evaluates the traces your application supplies.
298
+
299
+ The repository's required replay check uses synthetic demos to test AgentLoop's
300
+ CI machinery. For comparisons using your application's artifacts, see
301
+ [CI self-tests and application comparisons](docs/CI.md).
302
+
303
+ ## Understand the results
304
+
305
+ These notes describe the current `main` branch. Check [Unreleased changes](CHANGELOG.md#unreleased)
306
+ for behavior that has not yet shipped in the published package.
307
+
308
+ | Result | How to interpret it |
309
+ |---|---|
310
+ | 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. |
311
+ | Operation kinds | Agent, workflow, model, tool, retrieval, and other roles recorded alongside legacy event categories. See [Operation kinds](docs/OPERATIONS.md). |
312
+ | Token counts | Counts identify their source: a provider, a tokenizer, user code, or a word-count estimate. Missing usage is marked unavailable. |
313
+ | Model cost | A calculation from token counts and configured pricing. Unknown prices or estimated usage limit the comparisons you can make. |
314
+ | Optimization savings | Uncalibrated predictions with versioned formulas, coefficients, and assumptions. Measure a candidate run to establish the actual effect. |
315
+ | Quality scores | Results of the checks you supplied. Their coverage depends on your fixtures. |
316
+
317
+ Cost gates can be marked `indeterminate` when pricing or usable token counts are
318
+ missing. An indeterminate cost comparison does not fail the default gate; requiring
319
+ a positive `--min-cost-improvement-pct` makes unverifiable cost improvement fail.
320
+ See [Pricing](docs/PRICING.md) and [Trace compatibility](docs/TRACE_SCHEMA.md) for
321
+ the details, including how older traces are handled.
322
+
323
+ The optimizer avoids double-counting suggestions that affect the same spans.
324
+ Reports say whether the chosen combination is exact or approximate. See
325
+ [Savings selection](docs/SAVINGS_SELECTION.md).
326
+ For individual predictions, see [Estimator provenance](docs/ESTIMATORS.md).
327
+ The [intervention ledger](docs/INTERVENTIONS.md) links finding predictions to
328
+ measured candidate results and preserves quality checks in an exportable record.
329
+ For experiments across tasks and repetitions, use [paired study summaries](docs/STUDIES.md).
330
+
331
+ Keep your Markdown renderer's safe mode or HTML sanitizer enabled when viewing
332
+ reports from untrusted traces.
333
+
334
+ ## Framework integrations
335
+
336
+ For existing telemetry, [OTLP conformance](docs/TELEMETRY_CONFORMANCE.md) covers
337
+ GenAI, OpenInference, and MCP JSON, including operation kinds and evidence metadata.
338
+
339
+ | Integration | How it connects |
340
+ |---|---|
341
+ | Custom Python agents | Decorators and context managers around your functions. |
342
+ | OpenAI SDK | Wrap a client or callable to capture calls, streams, and reported usage. |
343
+ | OpenAI Agents SDK | Attach an AgentLoop tracing processor. |
344
+ | LangGraph | Instrument the builder before adding nodes, then wrap the compiled runnable. |
345
+ | CrewAI | Wrap crew, task, or agent execution methods. |
346
+ | OpenTelemetry / Vercel AI SDK telemetry | Import supported telemetry into AgentLoop traces. |
347
+
348
+ The adapters are included in AgentLoop. Install the framework's own SDK separately
349
+ when needed; `python -m pip install "agentloop-profiler[instrumentation]"` includes
350
+ the OpenAI Python SDK. See [Framework integrations](docs/INTEGRATIONS.md) for
351
+ setup and supported behavior.
352
+
353
+ ## Dashboard and persistence
354
+
355
+ The dashboard reads stored traces. From a [source checkout](#source-checkout),
356
+ load the synthetic example and start Streamlit:
357
+
358
+ ```bash
359
+ uv run --frozen --all-extras agentloop quickstart
360
+ uv run --frozen --all-extras agentloop store-trace --path runs/agentloop_quickstart.json --project-id default
361
+ uv run --frozen --all-extras streamlit run dashboard/app.py
362
+ ```
363
+
364
+ Open the URL printed by Streamlit and leave the sidebar's Project field set to
365
+ `default`. To inspect your own data, store your trace file with `store-trace`.
366
+
367
+ AgentLoop uses SQLite by default and supports Postgres for shared storage. The
368
+ optional HTTP API accepts traces and serves project-scoped reports and findings.
369
+ Application endpoints use `/v1`. Existing unversioned aliases remain available
370
+ throughout 0.x; see [API versioning](docs/API_VERSIONING.md) for the migration path.
371
+ See [Dashboard setup](docs/DASHBOARD.md) and [Production deployment](docs/PRODUCTION.md)
372
+ for database configuration, API authentication, and deployment instructions.
373
+
374
+ ## Other installation options
375
+
376
+ ### Source checkout
377
+
378
+ Use a source checkout for the dashboard or the latest unreleased changes.
379
+ Install [uv](https://docs.astral.sh/uv/getting-started/installation/), then run:
380
+
381
+ ```bash
382
+ git clone https://github.com/dipeshbabu/agentloop.git
383
+ cd agentloop
384
+ uv sync --locked --all-extras
385
+ uv run --frozen --all-extras agentloop quickstart
386
+ ```
387
+
388
+ ### Standalone CLI
389
+
390
+ The [GitHub Releases page](https://github.com/dipeshbabu/agentloop/releases) has
391
+ executables for Linux x86-64, Windows x86-64, macOS Intel, and macOS Apple silicon.
392
+ They bundle Python and the core CLI. Use the Python package for SDK instrumentation,
393
+ the dashboard, API server, or Postgres support.
394
+
395
+ Use the downloaded executable wherever the examples show `agentloop`.
396
+
397
+ <details>
398
+ <summary>Download and verify a standalone executable</summary>
399
+
400
+ Download the matching file and `SHA256SUMS` from the same release. Replace `X.Y.Z`
401
+ with its version number.
402
+
403
+ Linux (Bash):
404
+
405
+ ```bash
406
+ set -euo pipefail
407
+ version=X.Y.Z
408
+ asset="agentloop-v${version}-linux-x86_64"
409
+ curl -LO "https://github.com/dipeshbabu/agentloop/releases/download/v${version}/${asset}"
410
+ curl -LO "https://github.com/dipeshbabu/agentloop/releases/download/v${version}/SHA256SUMS"
411
+ mapfile -t checksum_lines < <(awk -v asset="$asset" '$2 == asset { print }' SHA256SUMS)
412
+ if [ "${#checksum_lines[@]}" -ne 1 ]; then
413
+ echo "Expected exactly one checksum for ${asset}" >&2
414
+ exit 1
415
+ fi
416
+ printf '%s\n' "${checksum_lines[0]}" | sha256sum --check --strict
417
+ chmod +x "$asset"
418
+ ./"$asset" --help
419
+ ```
420
+
421
+ Windows PowerShell:
422
+
423
+ ```powershell
424
+ $Version = "X.Y.Z"
425
+ $Asset = "agentloop-v$Version-windows-x86_64.exe"
426
+ Invoke-WebRequest "https://github.com/dipeshbabu/agentloop/releases/download/v$Version/$Asset" -OutFile agentloop.exe
427
+ Invoke-WebRequest "https://github.com/dipeshbabu/agentloop/releases/download/v$Version/SHA256SUMS" -OutFile SHA256SUMS
428
+ $ChecksumLines = @(Get-Content SHA256SUMS | Where-Object {
429
+ $_ -match "^[0-9a-fA-F]{64} $([regex]::Escape($Asset))$"
430
+ })
431
+ if ($ChecksumLines.Count -ne 1) { throw "Expected exactly one checksum for $Asset" }
432
+ $ExpectedHash = ($ChecksumLines[0] -split " ", 2)[0]
433
+ $ActualHash = (Get-FileHash .\agentloop.exe -Algorithm SHA256).Hash
434
+ if ($ActualHash -ne $ExpectedHash) { throw "Checksum verification failed for $Asset" }
435
+ .\agentloop.exe --help
436
+ ```
437
+
438
+ Each release includes platform-specific third-party notices. macOS executables
439
+ are ad-hoc signed but not notarized; Gatekeeper may require approval on first launch.
440
+
441
+ </details>
442
+
443
+ ## Research use
444
+
445
+ For experiments, record one trace per task attempt and condition. Attach metadata
446
+ such as task ID, seed, model, and source commit, and repeat comparisons across your
447
+ task set. The [research guide](docs/RESEARCH.md) explains this workflow. From a
448
+ source checkout, run the offline paired example with:
449
+
450
+ ```bash
451
+ uv run --frozen --all-extras python examples/research_experiment_demo.py
452
+ ```
453
+
454
+ ## Help and contributions
455
+
456
+ Run `agentloop --help` for all commands, or `agentloop COMMAND --help` for a specific
457
+ command. Use `agentloop doctor` to inspect your installation and available integrations.
458
+
459
+ - [Support](SUPPORT.md): usage help and troubleshooting.
460
+ - [Issue forms](https://github.com/dipeshbabu/agentloop/issues/new/choose): bugs and feature requests.
461
+ - [Contributing](CONTRIBUTING.md): development setup and required checks.
462
+ - [Roadmap](docs/ROADMAP.md) and [changelog](CHANGELOG.md): project direction and release changes.
463
+ - [Security](SECURITY.md): private vulnerability reports.
464
+ - [Governance](GOVERNANCE.md) and [Code of Conduct](CODE_OF_CONDUCT.md): project decisions and participation.
465
+
466
+ AgentLoop is under active pre-1.0 development. Use a tagged release when you need
467
+ a fixed version, and check the changelog before upgrading. Maintainers can use the
468
+ [launch checklist](docs/OPEN_SOURCE_CHECKLIST.md) when preparing a public release.
469
+
470
+ ## License
471
+
472
+ Copyright 2026 Dipesh Tharu Mahato.
473
+
474
+ AgentLoop is licensed under the [Apache License 2.0](LICENSE). Dependencies retain
475
+ their own terms; see [THIRD_PARTY_LICENSES.md](THIRD_PARTY_LICENSES.md).