agentloop-profiler 0.5.0__tar.gz → 0.6.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 (126) hide show
  1. agentloop_profiler-0.6.0/PKG-INFO +428 -0
  2. agentloop_profiler-0.6.0/README.md +377 -0
  3. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/THIRD_PARTY_LICENSES.md +19 -6
  4. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/__init__.py +14 -2
  5. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/audit.py +8 -3
  6. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/ci.py +7 -1
  7. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/cli.py +80 -21
  8. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/client.py +23 -7
  9. agentloop_profiler-0.6.0/agentloop/costs.py +650 -0
  10. agentloop_profiler-0.6.0/agentloop/cursor_validation.py +66 -0
  11. agentloop_profiler-0.6.0/agentloop/decorators.py +460 -0
  12. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/doctor.py +16 -19
  13. agentloop_profiler-0.6.0/agentloop/entrypoint.py +139 -0
  14. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/events.py +18 -2
  15. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/exporters.py +3 -1
  16. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/findings.py +55 -18
  17. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/integrations/crewai.py +5 -5
  18. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/integrations/openai.py +76 -41
  19. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/integrations/openai_agents.py +80 -1
  20. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/issues.py +2 -1
  21. agentloop_profiler-0.6.0/agentloop/metrics.py +250 -0
  22. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/migrations.py +45 -1
  23. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/optimizer.py +73 -28
  24. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/otel.py +158 -20
  25. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/patches.py +13 -2
  26. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/plan_export.py +13 -4
  27. agentloop_profiler-0.6.0/agentloop/quality.py +403 -0
  28. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/replay.py +125 -36
  29. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/savings.py +40 -17
  30. agentloop_profiler-0.6.0/agentloop/schema.py +238 -0
  31. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/server.py +29 -12
  32. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/store.py +201 -35
  33. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/tracer.py +33 -7
  34. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/value.py +64 -14
  35. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/version.py +1 -1
  36. agentloop_profiler-0.6.0/agentloop_profiler.egg-info/PKG-INFO +428 -0
  37. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop_profiler.egg-info/SOURCES.txt +19 -0
  38. agentloop_profiler-0.6.0/agentloop_profiler.egg-info/entry_points.txt +2 -0
  39. agentloop_profiler-0.6.0/dashboard/__init__.py +5 -0
  40. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/dashboard/app.py +106 -66
  41. agentloop_profiler-0.6.0/dashboard/streamlit_compat.py +63 -0
  42. agentloop_profiler-0.6.0/dashboard/trace_upload.py +57 -0
  43. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/dashboard/value_view.py +7 -3
  44. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/pyproject.toml +9 -3
  45. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_ci_command.py +120 -2
  46. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_cli_trace_inputs.py +34 -0
  47. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_client.py +109 -21
  48. agentloop_profiler-0.6.0/tests/test_costs.py +500 -0
  49. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_crewai_integration.py +26 -0
  50. agentloop_profiler-0.6.0/tests/test_cursor_server.py +59 -0
  51. agentloop_profiler-0.6.0/tests/test_cursor_shape_validation.py +70 -0
  52. agentloop_profiler-0.6.0/tests/test_dashboard_input_validation.py +206 -0
  53. agentloop_profiler-0.6.0/tests/test_dashboard_quality.py +27 -0
  54. agentloop_profiler-0.6.0/tests/test_dashboard_trace_upload.py +85 -0
  55. agentloop_profiler-0.6.0/tests/test_dashboard_value_view.py +10 -0
  56. agentloop_profiler-0.6.0/tests/test_decorators.py +536 -0
  57. agentloop_profiler-0.6.0/tests/test_dependabot_config.py +13 -0
  58. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_distribution_metadata.py +1 -1
  59. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_doctor_autoinstrument.py +67 -6
  60. agentloop_profiler-0.6.0/tests/test_finding_identity.py +144 -0
  61. agentloop_profiler-0.6.0/tests/test_first_use_cli.py +54 -0
  62. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_langgraph_integration.py +22 -0
  63. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_markdown_exporters.py +84 -0
  64. agentloop_profiler-0.6.0/tests/test_metrics.py +163 -0
  65. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_migrations.py +54 -6
  66. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_openai_agents_integration.py +131 -1
  67. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_openai_integration.py +129 -0
  68. agentloop_profiler-0.6.0/tests/test_optimizer.py +57 -0
  69. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_otel_interop.py +162 -1
  70. agentloop_profiler-0.6.0/tests/test_python_support.py +28 -0
  71. agentloop_profiler-0.6.0/tests/test_quality.py +478 -0
  72. agentloop_profiler-0.6.0/tests/test_release_workflows.py +198 -0
  73. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_replay.py +251 -1
  74. agentloop_profiler-0.6.0/tests/test_research_example.py +25 -0
  75. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_savings_aggregation.py +64 -4
  76. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_server.py +198 -22
  77. agentloop_profiler-0.6.0/tests/test_standalone_notices.py +201 -0
  78. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_store.py +50 -0
  79. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_store_contract.py +108 -0
  80. agentloop_profiler-0.6.0/tests/test_streamlit_compat.py +40 -0
  81. agentloop_profiler-0.6.0/tests/test_trace_schema.py +96 -0
  82. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_value.py +32 -1
  83. agentloop_profiler-0.5.0/PKG-INFO +0 -598
  84. agentloop_profiler-0.5.0/README.md +0 -550
  85. agentloop_profiler-0.5.0/agentloop/costs.py +0 -15
  86. agentloop_profiler-0.5.0/agentloop/decorators.py +0 -160
  87. agentloop_profiler-0.5.0/agentloop/metrics.py +0 -123
  88. agentloop_profiler-0.5.0/agentloop/quality.py +0 -222
  89. agentloop_profiler-0.5.0/agentloop_profiler.egg-info/PKG-INFO +0 -598
  90. agentloop_profiler-0.5.0/agentloop_profiler.egg-info/entry_points.txt +0 -2
  91. agentloop_profiler-0.5.0/dashboard/__init__.py +0 -1
  92. agentloop_profiler-0.5.0/tests/test_dashboard_value_view.py +0 -7
  93. agentloop_profiler-0.5.0/tests/test_decorators.py +0 -58
  94. agentloop_profiler-0.5.0/tests/test_metrics.py +0 -30
  95. agentloop_profiler-0.5.0/tests/test_optimizer.py +0 -25
  96. agentloop_profiler-0.5.0/tests/test_quality.py +0 -114
  97. agentloop_profiler-0.5.0/tests/test_release_workflows.py +0 -91
  98. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/LICENSE +0 -0
  99. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/autoinstrument.py +0 -0
  100. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/config.py +0 -0
  101. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/demo.py +0 -0
  102. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/graph.py +0 -0
  103. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/integrations/__init__.py +0 -0
  104. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/integrations/langgraph.py +0 -0
  105. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/integrations/sdk.py +0 -0
  106. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/integrations/vercel_ai.py +0 -0
  107. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/markdown.py +0 -0
  108. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/otel_ids.py +0 -0
  109. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/runtime.py +0 -0
  110. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop/timing.py +0 -0
  111. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop_profiler.egg-info/dependency_links.txt +0 -0
  112. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop_profiler.egg-info/requires.txt +0 -0
  113. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/agentloop_profiler.egg-info/top_level.txt +0 -0
  114. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/setup.cfg +0 -0
  115. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_bump_version.py +0 -0
  116. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_cli_store_commands.py +0 -0
  117. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_demo_cli.py +0 -0
  118. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_exporters.py +0 -0
  119. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_issues.py +0 -0
  120. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_markdown.py +0 -0
  121. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_otel_ids.py +0 -0
  122. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_patch_plan.py +0 -0
  123. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_remote_cli_credentials.py +0 -0
  124. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_runtime.py +0 -0
  125. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_timing.py +0 -0
  126. {agentloop_profiler-0.5.0 → agentloop_profiler-0.6.0}/tests/test_vercel_ai_integration.py +0 -0
@@ -0,0 +1,428 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentloop-profiler
3
+ Version: 0.6.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
+ # AgentLoop
53
+
54
+ [![CI](https://github.com/dipeshbabu/agentloop/actions/workflows/ci.yml/badge.svg)](https://github.com/dipeshbabu/agentloop/actions/workflows/ci.yml)
55
+ [![PyPI](https://img.shields.io/pypi/v/agentloop-profiler.svg?cacheSeconds=300)](https://pypi.org/project/agentloop-profiler/)
56
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-3776AB.svg)](https://www.python.org/downloads/)
57
+ [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
58
+
59
+ **Find slow, expensive, and repetitive steps in AI agents, then verify that your fix actually works.**
60
+
61
+ AgentLoop is an open-source profiler, optimization, and intervention-evaluation layer for agentic systems. It traces model calls, tool calls, retries, tokens, context reuse, latency, errors, and execution structure. It turns those traces into evidence-backed findings and lets you compare a baseline with a changed agent under performance and quality gates.
62
+
63
+ AgentLoop is not memory for agents. It is performance engineering for agent loops.
64
+
65
+ It is local-first, works without a hosted account, and can sit around an existing custom agent or framework instead of replacing it.
66
+
67
+ ## First useful result
68
+
69
+ Install the Python package:
70
+
71
+ ```bash
72
+ python -m pip install agentloop-profiler
73
+ ```
74
+
75
+ The distribution is `agentloop-profiler`; the import and CLI are `agentloop`:
76
+
77
+ ```python
78
+ import agentloop
79
+ ```
80
+
81
+ Verify the install and get a real finding without an account, API key, database, network call, or paid model API:
82
+
83
+ ```bash
84
+ agentloop quickstart
85
+ ```
86
+
87
+ `quickstart` writes a deterministic trace marked as synthetic and prints concrete bottlenecks. Then analyze any AgentLoop trace with one command:
88
+
89
+ ```bash
90
+ agentloop analyze runs/agentloop_quickstart.json
91
+ agentloop analyze runs/my_agent.json --json-out runs/my_agent_analysis.json
92
+ ```
93
+
94
+ See [First useful result](docs/FIRST_USE.md) for the full beginner path.
95
+
96
+ ## What people use AgentLoop for
97
+
98
+ | Use case | What AgentLoop provides |
99
+ | --- | --- |
100
+ | Coding agents | Find repeated tool/file operations, retry loops, unnecessary model calls, context growth, and regressions after workflow changes. |
101
+ | Research agents | Measure retrieval, synthesis, tool, model, and retry behavior; compare sequential and parallel designs; verify quality after optimization. |
102
+ | Customer or operations agents | Compare routing, tool sequences, structured-output reliability, latency, retries, and model cost. |
103
+ | Multi-agent systems | Inspect execution structure, duplicated work, serial coordination, repeated handoffs, and recurring findings. |
104
+ | Platform teams | Import or export OpenTelemetry traces, persist findings in SQLite/Postgres, and gate agent changes in CI. |
105
+ | Researchers | Run paired agent interventions with trace-level experiment metadata and retain execution evidence alongside task evaluation. |
106
+
107
+ ## The workflow
108
+
109
+ ### 1. Trace an existing agent
110
+
111
+ For custom Python agents:
112
+
113
+ ```python
114
+ import agentloop
115
+
116
+ @agentloop.trace_model(name="planner", model="gpt-4.1-mini")
117
+ def plan(question: str) -> str:
118
+ return call_model(question)
119
+
120
+ @agentloop.trace_tool(name="web_search")
121
+ def search(query: str) -> list[str]:
122
+ return search_web(query)
123
+
124
+ @agentloop.traceable(root=True, agent_name="research_agent")
125
+ def run_agent(question: str) -> str:
126
+ plan_text = plan(question)
127
+ results = search(question)
128
+ return synthesize(plan_text, results)
129
+
130
+ run_agent("Compare three vector databases")
131
+ ```
132
+
133
+ You can also use the lower-level context managers directly:
134
+
135
+ ```python
136
+ from agentloop import trace_agent, trace_model_call, trace_tool_call
137
+
138
+ with trace_agent("research_agent") as trace:
139
+ with trace_model_call("plan", model="gpt-4.1", input_tokens=1200, output_tokens=200):
140
+ pass
141
+ with trace_tool_call("search_web"):
142
+ pass
143
+
144
+ trace.export_json("runs/research_agent.json")
145
+ ```
146
+
147
+ ### 2. Find the bottleneck
148
+
149
+ ```bash
150
+ agentloop analyze runs/research_agent.json
151
+ ```
152
+
153
+ Or use individual stages when you need more control:
154
+
155
+ ```bash
156
+ agentloop report runs/research_agent.json
157
+ agentloop diagnose --path runs/research_agent.json --json-out runs/diagnosis.json
158
+ agentloop optimize --path runs/research_agent.json --json-out runs/optimization.json
159
+ agentloop patch --path runs/research_agent.json --repo . --json-out runs/patch_plan.json
160
+ ```
161
+
162
+ AgentLoop currently detects patterns such as:
163
+
164
+ - independent tool calls that may be parallelized;
165
+ - repeated prompt/context prefixes;
166
+ - repeated model calls that may be batched;
167
+ - small model steps that may be routed to a cheaper model;
168
+ - retry loops that may benefit from structured outputs;
169
+ - oversized reasoning/context steps;
170
+ - runaway loops;
171
+ - tool oscillation.
172
+
173
+ Recommendations are hypotheses to test, not proof that the proposed rewrite is better.
174
+
175
+ ### 3. Change the agent
176
+
177
+ Apply one focused intervention such as parallel retrieval, context compression, a schema validator, a loop guard, or model routing. AgentLoop's patch command produces dry-run plans; it does not silently modify source code.
178
+
179
+ ### 4. Prove the change
180
+
181
+ ```bash
182
+ agentloop replay \
183
+ --baseline runs/baseline.json \
184
+ --candidate runs/candidate.json \
185
+ --min-latency-improvement-pct 10 \
186
+ --max-cost-regression-pct 0
187
+ ```
188
+
189
+ When faster or cheaper is not sufficient evidence, add task-grounded quality fixtures:
190
+
191
+ ```bash
192
+ agentloop replay \
193
+ --baseline runs/baseline.json \
194
+ --candidate runs/candidate.json \
195
+ --quality-fixtures evaluation/fixtures.json \
196
+ --min-quality-score 0.9
197
+ ```
198
+
199
+ Replay can compare runtime, cost, tokens, retries, model/tool calls, schema validity, and configured quality evidence.
200
+
201
+ For pull-request gating:
202
+
203
+ ```bash
204
+ agentloop ci \
205
+ --baseline artifacts/agentloop/baseline.json \
206
+ --candidate artifacts/agentloop/candidate.json \
207
+ --quality-fixtures evaluation/fixtures.json
208
+ ```
209
+
210
+ ## Framework integrations
211
+
212
+ AgentLoop includes instrumentation for existing agent stacks:
213
+
214
+ - OpenAI SDK
215
+ - OpenAI Agents SDK
216
+ - LangGraph
217
+ - CrewAI
218
+ - Vercel AI SDK telemetry
219
+ - OpenTelemetry GenAI-style traces
220
+ - custom Python agents through decorators and context managers
221
+
222
+ For copy-paste examples and streaming/cancellation semantics, see [Framework integrations](docs/INTEGRATIONS.md).
223
+
224
+ OpenAI example:
225
+
226
+ ```python
227
+ from openai import OpenAI
228
+ from agentloop import trace_agent
229
+ from agentloop.integrations.openai import instrument_openai_client
230
+
231
+ client = instrument_openai_client(OpenAI())
232
+
233
+ with trace_agent("research_agent") as trace:
234
+ client.responses.create(model="gpt-4.1-mini", input="Research three competitors.")
235
+
236
+ trace.export_json("runs/openai_agent.json")
237
+ ```
238
+
239
+ ## Research use
240
+
241
+ AgentLoop can be used as execution-level instrumentation and intervention evidence for agent-systems research.
242
+
243
+ Good fits include:
244
+
245
+ - ReAct versus planner-executor comparisons;
246
+ - single-agent versus multi-agent workflows;
247
+ - sequential versus parallel tool execution;
248
+ - reflection and retry strategies;
249
+ - context compression/caching;
250
+ - model routing;
251
+ - loop/tool-oscillation guardrails;
252
+ - execution signals associated with success or failure;
253
+ - quality, latency, cost, token, and reliability tradeoffs.
254
+
255
+ One trace should represent one task attempt under one condition. Use trace metadata for experiment, condition, task, dataset, seed, prompt/config version, model, and source commit. Run enough tasks or repetitions to characterize variability and aggregate results according to the study design.
256
+
257
+ AgentLoop deliberately does not choose a statistical test for a paper and does not replace model-training frameworks, mechanistic interpretability tooling, benchmark dataset management, or human evaluation systems.
258
+
259
+ See [Using AgentLoop for research](docs/RESEARCH.md). The repository also includes a deterministic offline paired-intervention example:
260
+
261
+ ```bash
262
+ python examples/research_experiment_demo.py
263
+ ```
264
+
265
+ ## Measured evidence versus estimates
266
+
267
+ Keep these separate when using AgentLoop for engineering decisions or research.
268
+
269
+ **Measured** evidence includes observed runtime, tokens, model/tool/retry counts, status/errors, task quality, and complete/provider-reported cost.
270
+
271
+ **Estimated** evidence includes optimizer savings, rewrite recommendations, priority scores, and modeled value/pricing scenarios.
272
+
273
+ Optimization cards are useful hypotheses. A proposed saving is not an experimental result until the change is implemented and measured on a candidate run.
274
+
275
+ Savings aggregation also records whether compatible-card selection was proven exact or used the documented bounded approximation. See [Savings selection accuracy](docs/SAVINGS_SELECTION.md).
276
+
277
+ ## Quality gates
278
+
279
+ Quality fixtures support dependency-free scorers:
280
+
281
+ - `exact_match`
282
+ - `contains`
283
+ - bounded `glob`
284
+ - `required_fields` / `json_schema`
285
+ - `json_subset`
286
+ - trusted local `custom` scorers with `module:function`
287
+
288
+ Use them with `agentloop quality-report`, `agentloop replay`, or `agentloop ci`. Invalid suites fail closed. Custom Python scorers are for trusted local fixture files and are rejected by the HTTP quality endpoint.
289
+
290
+ ## Trace and data compatibility
291
+
292
+ AgentLoop's native trace JSON is a public versioned compatibility surface used by the CLI, API, stores, and telemetry adapters. Custom metadata is preserved through native serialization and supported OpenTelemetry round trips.
293
+
294
+ See [Native trace schema and compatibility](docs/TRACE_SCHEMA.md).
295
+
296
+ Timing note: `total_runtime_ms` is end-to-end elapsed duration. `cumulative_span_time_ms` sums instrumented spans and can exceed elapsed time when spans overlap or nest.
297
+
298
+ Trace-derived values are treated as untrusted in AgentLoop Markdown exporters. Keep the downstream renderer's normal safe mode or HTML sanitizer enabled.
299
+
300
+ ## Dashboard and persistence
301
+
302
+ Run the local dashboard:
303
+
304
+ ```bash
305
+ python -m pip install "agentloop-profiler[dashboard]"
306
+ streamlit run dashboard/app.py
307
+ ```
308
+
309
+ The dashboard covers stored traces, event timelines, optimization findings, patch plans, replay proof, quality gates, value reports, and setup guidance. See [Dashboard guide](docs/DASHBOARD.md).
310
+
311
+ AgentLoop uses SQLite by default and also supports Postgres for shared/self-hosted use. The HTTP API provides project-scoped trace storage, diagnosis, findings, optimization queues, quality reports, value reports, and usage summaries.
312
+
313
+ For deployment details, see [Production deployment](docs/PRODUCTION.md). For pricing-data semantics, see [Pricing guide](docs/PRICING.md).
314
+
315
+ ## Advanced CLI
316
+
317
+ Useful commands include:
318
+
319
+ ```text
320
+ quickstart
321
+ analyze
322
+ report
323
+ diagnose
324
+ optimize
325
+ patch
326
+ replay
327
+ quality-report
328
+ ci
329
+ value-report
330
+ export-otel
331
+ import-otel
332
+ init-store
333
+ store-trace
334
+ list-stored-traces
335
+ list-findings
336
+ optimization-queue
337
+ server
338
+ doctor
339
+ production-check
340
+ ```
341
+
342
+ Run:
343
+
344
+ ```bash
345
+ agentloop --help
346
+ ```
347
+
348
+ for the current command surface.
349
+
350
+ ## Standalone CLI
351
+
352
+ Tagged releases also include self-contained executables for Linux x86-64, Windows x86-64, macOS Intel, and macOS Apple silicon. These bundle Python and the core CLI runtime. Optional dashboard, server, Postgres, and Python-SDK integrations use the Python package.
353
+
354
+ Download the matching file and `SHA256SUMS` from the [GitHub Releases page](https://github.com/dipeshbabu/agentloop/releases).
355
+
356
+ Linux example, replacing `X.Y.Z` with the release version:
357
+
358
+ ```bash
359
+ set -euo pipefail
360
+ version=X.Y.Z
361
+ asset="agentloop-v${version}-linux-x86_64"
362
+ curl -LO "https://github.com/dipeshbabu/agentloop/releases/download/v${version}/${asset}"
363
+ curl -LO "https://github.com/dipeshbabu/agentloop/releases/download/v${version}/SHA256SUMS"
364
+ mapfile -t checksum_lines < <(awk -v asset="$asset" '$2 == asset { print }' SHA256SUMS)
365
+ if [ "${#checksum_lines[@]}" -ne 1 ]; then
366
+ echo "Expected exactly one checksum for ${asset}" >&2
367
+ exit 1
368
+ fi
369
+ printf '%s\n' "${checksum_lines[0]}" | sha256sum --check --strict
370
+ chmod +x "$asset"
371
+ ```
372
+
373
+ Windows PowerShell:
374
+
375
+ ```powershell
376
+ $Version = "X.Y.Z"
377
+ $Asset = "agentloop-v$Version-windows-x86_64.exe"
378
+ Invoke-WebRequest "https://github.com/dipeshbabu/agentloop/releases/download/v$Version/$Asset" -OutFile agentloop.exe
379
+ Invoke-WebRequest "https://github.com/dipeshbabu/agentloop/releases/download/v$Version/SHA256SUMS" -OutFile SHA256SUMS
380
+ $ChecksumLines = @(Get-Content SHA256SUMS | Where-Object {
381
+ $_ -match "^[0-9a-fA-F]{64} $([regex]::Escape($Asset))$"
382
+ })
383
+ if ($ChecksumLines.Count -ne 1) { throw "Expected exactly one checksum for $Asset" }
384
+ $ExpectedHash = ($ChecksumLines[0] -split " ", 2)[0]
385
+ $ActualHash = (Get-FileHash .\agentloop.exe -Algorithm SHA256).Hash
386
+ if ($ActualHash -ne $ExpectedHash) { throw "Checksum verification failed for $Asset" }
387
+ .\agentloop.exe --help
388
+ ```
389
+
390
+ Each standalone release includes platform-specific third-party notices. macOS executables are ad-hoc signed but not notarized, so local Gatekeeper policy may require explicit first-launch approval.
391
+
392
+ ## Source checkout and contribution
393
+
394
+ For a source checkout:
395
+
396
+ ```bash
397
+ git clone https://github.com/dipeshbabu/agentloop.git
398
+ cd agentloop
399
+ uv sync --locked --all-extras --no-dev
400
+ uv run agentloop quickstart
401
+ ```
402
+
403
+ For development setup, architecture boundaries, validation commands, review expectations, security/privacy guidance, and contribution policy, see [CONTRIBUTING.md](CONTRIBUTING.md).
404
+
405
+ Project direction and non-goals are in [docs/ROADMAP.md](docs/ROADMAP.md).
406
+
407
+ ## Project status
408
+
409
+ AgentLoop is under active pre-1.0 development. Public interfaces may evolve, with user-facing changes recorded in [CHANGELOG.md](CHANGELOG.md).
410
+
411
+ Core scope: trace agent execution, find evidence-backed optimization opportunities, and verify interventions against performance and quality evidence.
412
+
413
+ ## Community
414
+
415
+ - Use the structured [issue forms](https://github.com/dipeshbabu/agentloop/issues/new/choose) for bugs, feature requests, and usage questions.
416
+ - Follow [SUPPORT.md](SUPPORT.md) for usage help.
417
+ - Follow [SECURITY.md](SECURITY.md) for private vulnerability reports.
418
+ - Project decisions follow [GOVERNANCE.md](GOVERNANCE.md).
419
+ - Participation is covered by the [Code of Conduct](CODE_OF_CONDUCT.md).
420
+ - Repository owners should complete the [open-source launch checklist](docs/OPEN_SOURCE_CHECKLIST.md) before announcing a public launch.
421
+
422
+ ## License
423
+
424
+ Copyright 2026 Dipesh Tharu Mahato and AgentLoop contributors.
425
+
426
+ AgentLoop is licensed under the [Apache License 2.0](LICENSE). Dependencies retain their own terms; see [THIRD_PARTY_LICENSES.md](THIRD_PARTY_LICENSES.md).
427
+
428
+ PyPI: https://pypi.org/project/agentloop-profiler/