agent-observability-trace 0.1.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.
- agent_observability_trace-0.1.0/.gitignore +64 -0
- agent_observability_trace-0.1.0/CHANGELOG.md +34 -0
- agent_observability_trace-0.1.0/LICENSE +198 -0
- agent_observability_trace-0.1.0/PKG-INFO +362 -0
- agent_observability_trace-0.1.0/README.md +272 -0
- agent_observability_trace-0.1.0/pyproject.toml +171 -0
- agent_observability_trace-0.1.0/src/agent_trace/__init__.py +1182 -0
- agent_observability_trace-0.1.0/src/agent_trace/_cli.py +1378 -0
- agent_observability_trace-0.1.0/src/agent_trace/_inspect.py +2021 -0
- agent_observability_trace-0.1.0/src/agent_trace/_replay/__init__.py +1 -0
- agent_observability_trace-0.1.0/src/agent_trace/_replay/engine.py +268 -0
- agent_observability_trace-0.1.0/src/agent_trace/_replay/fixture.py +868 -0
- agent_observability_trace-0.1.0/src/agent_trace/core/__init__.py +1 -0
- agent_observability_trace-0.1.0/src/agent_trace/core/clock.py +91 -0
- agent_observability_trace-0.1.0/src/agent_trace/core/exceptions.py +51 -0
- agent_observability_trace-0.1.0/src/agent_trace/core/span.py +271 -0
- agent_observability_trace-0.1.0/src/agent_trace/core/trace.py +92 -0
- agent_observability_trace-0.1.0/src/agent_trace/exporters/__init__.py +1 -0
- agent_observability_trace-0.1.0/src/agent_trace/exporters/file.py +80 -0
- agent_observability_trace-0.1.0/src/agent_trace/exporters/otlp.py +199 -0
- agent_observability_trace-0.1.0/src/agent_trace/exporters/remote_fixture.py +307 -0
- agent_observability_trace-0.1.0/src/agent_trace/exporters/stdout.py +258 -0
- agent_observability_trace-0.1.0/src/agent_trace/integrations/__init__.py +69 -0
- agent_observability_trace-0.1.0/src/agent_trace/integrations/agno.py +489 -0
- agent_observability_trace-0.1.0/src/agent_trace/integrations/autogen.py +582 -0
- agent_observability_trace-0.1.0/src/agent_trace/integrations/crewai.py +486 -0
- agent_observability_trace-0.1.0/src/agent_trace/integrations/google_genai.py +731 -0
- agent_observability_trace-0.1.0/src/agent_trace/integrations/haystack.py +254 -0
- agent_observability_trace-0.1.0/src/agent_trace/integrations/langchain_core.py +361 -0
- agent_observability_trace-0.1.0/src/agent_trace/integrations/langgraph.py +2093 -0
- agent_observability_trace-0.1.0/src/agent_trace/integrations/langgraph_checkpoint.py +763 -0
- agent_observability_trace-0.1.0/src/agent_trace/integrations/langgraph_state_diff.py +345 -0
- agent_observability_trace-0.1.0/src/agent_trace/integrations/langgraph_stream_debug.py +202 -0
- agent_observability_trace-0.1.0/src/agent_trace/integrations/llama_index.py +472 -0
- agent_observability_trace-0.1.0/src/agent_trace/integrations/mcp.py +281 -0
- agent_observability_trace-0.1.0/src/agent_trace/integrations/openai_agents.py +811 -0
- agent_observability_trace-0.1.0/src/agent_trace/integrations/pydantic_ai.py +504 -0
- agent_observability_trace-0.1.0/src/agent_trace/integrations/streaming.py +218 -0
- agent_observability_trace-0.1.0/src/agent_trace/interceptor/__init__.py +64 -0
- agent_observability_trace-0.1.0/src/agent_trace/interceptor/aiohttp_hook.py +152 -0
- agent_observability_trace-0.1.0/src/agent_trace/interceptor/botocore_hook.py +223 -0
- agent_observability_trace-0.1.0/src/agent_trace/interceptor/grpc_hook.py +651 -0
- agent_observability_trace-0.1.0/src/agent_trace/interceptor/httpx_hook.py +866 -0
- agent_observability_trace-0.1.0/src/agent_trace/interceptor/logging_hook.py +137 -0
- agent_observability_trace-0.1.0/src/agent_trace/interceptor/requests_patch.py +184 -0
- agent_observability_trace-0.1.0/src/agent_trace/interceptor/sse.py +176 -0
- agent_observability_trace-0.1.0/src/agent_trace/interceptor/stdio_hook.py +245 -0
- agent_observability_trace-0.1.0/src/agent_trace/interceptor/warnings_hook.py +132 -0
- agent_observability_trace-0.1.0/src/agent_trace/interceptor/websocket_hook.py +323 -0
- agent_observability_trace-0.1.0/src/agent_trace/plugins/__init__.py +35 -0
- agent_observability_trace-0.1.0/src/agent_trace/plugins/base.py +111 -0
- agent_observability_trace-0.1.0/src/agent_trace/py.typed +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
*.egg
|
|
7
|
+
*.egg-info/
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
.eggs/
|
|
11
|
+
|
|
12
|
+
# Virtual environments
|
|
13
|
+
.venv/
|
|
14
|
+
venv/
|
|
15
|
+
env/
|
|
16
|
+
|
|
17
|
+
# uv
|
|
18
|
+
.uv/
|
|
19
|
+
|
|
20
|
+
# Testing and coverage
|
|
21
|
+
.pytest_cache/
|
|
22
|
+
.coverage
|
|
23
|
+
.coverage.*
|
|
24
|
+
htmlcov/
|
|
25
|
+
coverage.xml
|
|
26
|
+
*.sarif
|
|
27
|
+
|
|
28
|
+
# Benchmarks output
|
|
29
|
+
.benchmarks/
|
|
30
|
+
benchmarks/results/latest.json
|
|
31
|
+
|
|
32
|
+
# Type checking
|
|
33
|
+
.mypy_cache/
|
|
34
|
+
.dmypy.json
|
|
35
|
+
dmypy.json
|
|
36
|
+
|
|
37
|
+
# IDE
|
|
38
|
+
.vscode/
|
|
39
|
+
.idea/
|
|
40
|
+
*.swp
|
|
41
|
+
*.swo
|
|
42
|
+
*~
|
|
43
|
+
|
|
44
|
+
# OS
|
|
45
|
+
.DS_Store
|
|
46
|
+
Thumbs.db
|
|
47
|
+
|
|
48
|
+
# Secrets and local config
|
|
49
|
+
.env
|
|
50
|
+
.env.*
|
|
51
|
+
*.pem
|
|
52
|
+
*.key
|
|
53
|
+
|
|
54
|
+
# agent-trace runtime data — fixture files contain API keys and prompt content
|
|
55
|
+
.agent-trace/
|
|
56
|
+
*.db
|
|
57
|
+
fixture.db
|
|
58
|
+
|
|
59
|
+
# Docs build
|
|
60
|
+
docs/_build/
|
|
61
|
+
docs/site/
|
|
62
|
+
|
|
63
|
+
# Pre-commit
|
|
64
|
+
.pre-commit-config.yaml.bak
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to agent-trace are documented here.
|
|
4
|
+
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
5
|
+
|
|
6
|
+
## [Unreleased]
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
- gRPC transport interception (`pip install agent-trace[grpc]`) for LLM SDKs
|
|
10
|
+
that default to gRPC instead of REST (e.g. Vertex AI's mTLS-authenticated
|
|
11
|
+
path). Records/replays unary-unary and unary-stream gRPC calls the same
|
|
12
|
+
way `RecordingTransport`/`ReplayTransport` do for httpx; wired into
|
|
13
|
+
`Tracer._install_recording_transport`/`_uninstall_recording_transport` and
|
|
14
|
+
the replay engine alongside the existing httpx/requests patches. Covers
|
|
15
|
+
both sync `grpc` and async `grpc.aio` (unary-unary only for aio).
|
|
16
|
+
- HTTP transport interception for `aiohttp.ClientSession` (`pip install agent-trace[aiohttp]`), closing a silent recording gap for LLM traffic routed through aiohttp-based clients (e.g. LiteLLM's default async transport)
|
|
17
|
+
|
|
18
|
+
## [0.1.0] - 2026-06-19
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
- Core span and trace data model (`Span`, `Trace`, `SpanStatus`)
|
|
22
|
+
- Clock abstraction (`core/clock.py`) enabling deterministic replay
|
|
23
|
+
- HTTP transport interception for `httpx` and `requests`
|
|
24
|
+
- SQLite-backed fixture store (`replay/fixture.py`) for record/replay
|
|
25
|
+
- Replay engine with `AGENT_TRACE_NETWORK_GUARD` enforcement
|
|
26
|
+
- `@tracer.instrument(record=True)` decorator API
|
|
27
|
+
- `tracer.span()` context manager for manual span creation
|
|
28
|
+
- LangGraph callback handler integration (`pip install agent-trace[langgraph]`)
|
|
29
|
+
- OpenAI Agents SDK hook integration (`pip install agent-trace[openai-agents]`)
|
|
30
|
+
- OTLP exporter for Jaeger/Grafana Tempo (`pip install agent-trace[otlp]`)
|
|
31
|
+
- `stdout` and `file` exporters
|
|
32
|
+
- Three benchmark scripts: overhead, fidelity, ingestion
|
|
33
|
+
- CI pipeline with ruff, mypy --strict, pytest, Trivy, OpenSSF Scorecard
|
|
34
|
+
- Apache 2.0 license
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship made available under
|
|
36
|
+
the License, as indicated by a copyright notice that is included in
|
|
37
|
+
or attached to the work (an example is provided in the Appendix below).
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
43
|
+
of this License, Derivative Works shall not include works that remain
|
|
44
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
45
|
+
the Work and Derivative Works thereof.
|
|
46
|
+
|
|
47
|
+
"Contribution" shall mean, as submitted to the Licensor for inclusion
|
|
48
|
+
in the Work by the copyright owner or by an individual or Legal Entity
|
|
49
|
+
authorized to submit on behalf of the copyright owner. For the purposes
|
|
50
|
+
of this definition, "submitted" means any form of electronic, verbal,
|
|
51
|
+
or written communication sent to the Licensor or its representatives,
|
|
52
|
+
including but not limited to communication on electronic mailing lists,
|
|
53
|
+
source code control systems, and issue tracking systems that are managed
|
|
54
|
+
by, or on behalf of, the Licensor for the purpose of discussing and
|
|
55
|
+
improving the Work, but excluding communication that is conspicuously
|
|
56
|
+
marked or designated in writing by the copyright owner as "Not a
|
|
57
|
+
Contribution."
|
|
58
|
+
|
|
59
|
+
"Contributor" shall mean Licensor and any Legal Entity on behalf of
|
|
60
|
+
whom a Contribution has been received by the Licensor and incorporated
|
|
61
|
+
within the Work.
|
|
62
|
+
|
|
63
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
64
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
65
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
66
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
67
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
68
|
+
Work and such Derivative Works in Source or Object form.
|
|
69
|
+
|
|
70
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
71
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
72
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
73
|
+
(except as stated in this section) patent license to make, have made,
|
|
74
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
75
|
+
where such license applies only to those patent claims licensable
|
|
76
|
+
by such Contributor that are necessarily infringed by their
|
|
77
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
78
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
79
|
+
institute patent litigation against any entity (including a
|
|
80
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
81
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
82
|
+
or contributory patent infringement, then any patent licenses
|
|
83
|
+
granted to You under this License for that Work shall terminate
|
|
84
|
+
as of the date such litigation is filed.
|
|
85
|
+
|
|
86
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
87
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
88
|
+
modifications, and in Source or Object form, provided that You
|
|
89
|
+
meet the following conditions:
|
|
90
|
+
|
|
91
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
92
|
+
Works a copy of this License; and
|
|
93
|
+
|
|
94
|
+
(b) You must cause any modified files to carry prominent notices
|
|
95
|
+
stating that You changed the files; and
|
|
96
|
+
|
|
97
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
98
|
+
that You distribute, all copyright, patent, trademark, and
|
|
99
|
+
attribution notices from the Source form of the Work,
|
|
100
|
+
excluding those notices that do not pertain to any part of
|
|
101
|
+
the Derivative Works; and
|
|
102
|
+
|
|
103
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
104
|
+
distribution, You must include a readable copy of the
|
|
105
|
+
attribution notices contained within such NOTICE file, in
|
|
106
|
+
at least one of the following places: within a NOTICE text
|
|
107
|
+
file distributed as part of the Derivative Works; within
|
|
108
|
+
the Source form or documentation, if provided along with the
|
|
109
|
+
Derivative Works; or, within a display generated by the
|
|
110
|
+
Derivative Works, if and wherever such third-party notices
|
|
111
|
+
normally appear. The contents of the NOTICE file are for
|
|
112
|
+
informational purposes only and do not modify the License.
|
|
113
|
+
You may add Your own attribution notices within Derivative
|
|
114
|
+
Works that You distribute, alongside or as an addendum to
|
|
115
|
+
the NOTICE text from the Work, provided that such additional
|
|
116
|
+
attribution notices cannot be construed as modifying the
|
|
117
|
+
License.
|
|
118
|
+
|
|
119
|
+
You may add Your own license statement for Your modifications and
|
|
120
|
+
may provide additional grant of rights to use, copy, modify, merge,
|
|
121
|
+
publish, distribute, sublicense, and/or sell copies of the
|
|
122
|
+
Contribution, either on an unchanged basis, or on the basis of
|
|
123
|
+
derivatives of it, solely to the extent these changes are necessary
|
|
124
|
+
to conform to other license requirements applicable to those
|
|
125
|
+
derivatives.
|
|
126
|
+
|
|
127
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
128
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
129
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
130
|
+
this License, without any additional terms or conditions.
|
|
131
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
132
|
+
the terms of any separate license agreement you may have executed
|
|
133
|
+
with Licensor regarding such Contributions.
|
|
134
|
+
|
|
135
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
136
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
137
|
+
except as required for reasonable and customary use in describing the
|
|
138
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
139
|
+
|
|
140
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
141
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
142
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
143
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
144
|
+
implied, including, without limitation, any warranties or conditions
|
|
145
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
146
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
147
|
+
appropriateness of using or reproducing the Work and assume any
|
|
148
|
+
risks associated with Your exercise of permissions under this License.
|
|
149
|
+
|
|
150
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
151
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
152
|
+
unless required by applicable law (such as deliberate and grossly
|
|
153
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
154
|
+
liable to You for damages, including any direct, indirect, special,
|
|
155
|
+
incidental, or exemplary damages of any character arising as a
|
|
156
|
+
result of this License or out of the use or inability to use the
|
|
157
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
158
|
+
work stoppage, computer failure or malfunction, or all other
|
|
159
|
+
commercial damages or losses), even if such Contributor has been
|
|
160
|
+
advised of the possibility of such damages.
|
|
161
|
+
|
|
162
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
163
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
164
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
165
|
+
or other liability obligations and/or rights consistent with this
|
|
166
|
+
License. However, in accepting such obligations, You may act only
|
|
167
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
168
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
169
|
+
defend, and hold each Contributor harmless for any liability
|
|
170
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
171
|
+
of your accepting any such warranty or additional liability.
|
|
172
|
+
|
|
173
|
+
END OF TERMS AND CONDITIONS
|
|
174
|
+
|
|
175
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
176
|
+
|
|
177
|
+
To apply the Apache License to your work, attach the following
|
|
178
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
179
|
+
replaced with your own identifying information. (Don't include
|
|
180
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
181
|
+
comment syntax for the file format in question. It is also
|
|
182
|
+
recommended that a file or directory name and a description of the
|
|
183
|
+
purpose of the file be included on the same "PRINT" or "on the
|
|
184
|
+
first page" of each appropriate file.
|
|
185
|
+
|
|
186
|
+
Copyright 2026 Rudrendu Paul and Sourav Nandy
|
|
187
|
+
|
|
188
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
189
|
+
you may not use this file except in compliance with the License.
|
|
190
|
+
You may obtain a copy of the License at
|
|
191
|
+
|
|
192
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
193
|
+
|
|
194
|
+
Unless required by applicable law or agreed to in writing, software
|
|
195
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
196
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
197
|
+
See the License for the specific language governing permissions and
|
|
198
|
+
limitations under the License.
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent-observability-trace
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: AI agent observability with deterministic record/replay — capture any LangGraph or OpenAI Agents SDK run, replay it offline at zero API cost.
|
|
5
|
+
Project-URL: Homepage, https://github.com/RudrenduPaul/agent-observability
|
|
6
|
+
Project-URL: Documentation, https://github.com/RudrenduPaul/agent-observability/blob/main/docs/getting-started.md
|
|
7
|
+
Project-URL: Repository, https://github.com/RudrenduPaul/agent-observability
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/RudrenduPaul/agent-observability/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/RudrenduPaul/agent-observability/blob/main/CHANGELOG.md
|
|
10
|
+
Author: Sourav Nandy
|
|
11
|
+
Author-email: Rudrendu Paul <rkpaul.venture@gmail.com>
|
|
12
|
+
License: Apache-2.0
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Keywords: agents,debugging,langgraph,llm,observability,openai,replay,tracing
|
|
15
|
+
Classifier: Development Status :: 3 - Alpha
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
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: Topic :: Software Development :: Debuggers
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
|
+
Classifier: Typing :: Typed
|
|
26
|
+
Requires-Python: >=3.10
|
|
27
|
+
Requires-Dist: httpx>=0.27
|
|
28
|
+
Requires-Dist: rich>=13.0
|
|
29
|
+
Provides-Extra: agno
|
|
30
|
+
Requires-Dist: agno>=2.7; extra == 'agno'
|
|
31
|
+
Provides-Extra: aiohttp
|
|
32
|
+
Requires-Dist: aiohttp>=3.9; extra == 'aiohttp'
|
|
33
|
+
Provides-Extra: autogen
|
|
34
|
+
Requires-Dist: autogen-agentchat>=0.4; extra == 'autogen'
|
|
35
|
+
Requires-Dist: autogen-ext[openai]>=0.4; extra == 'autogen'
|
|
36
|
+
Provides-Extra: botocore
|
|
37
|
+
Requires-Dist: boto3>=1.34; extra == 'botocore'
|
|
38
|
+
Provides-Extra: crewai
|
|
39
|
+
Requires-Dist: crewai>=1.0.0; extra == 'crewai'
|
|
40
|
+
Provides-Extra: dev
|
|
41
|
+
Requires-Dist: aiohttp>=3.9; extra == 'dev'
|
|
42
|
+
Requires-Dist: aioresponses>=0.7; extra == 'dev'
|
|
43
|
+
Requires-Dist: boto3>=1.34; extra == 'dev'
|
|
44
|
+
Requires-Dist: groq>=0.9; extra == 'dev'
|
|
45
|
+
Requires-Dist: grpcio-tools>=1.60; extra == 'dev'
|
|
46
|
+
Requires-Dist: grpcio>=1.60; extra == 'dev'
|
|
47
|
+
Requires-Dist: langchain-classic>=1.0; extra == 'dev'
|
|
48
|
+
Requires-Dist: langchain-core>=0.3; extra == 'dev'
|
|
49
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
50
|
+
Requires-Dist: pre-commit>=3.7; extra == 'dev'
|
|
51
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
52
|
+
Requires-Dist: pytest-benchmark[histogram]>=4.0; extra == 'dev'
|
|
53
|
+
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
|
|
54
|
+
Requires-Dist: pytest-env>=1.0; extra == 'dev'
|
|
55
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
56
|
+
Requires-Dist: requests>=2.31; extra == 'dev'
|
|
57
|
+
Requires-Dist: respx>=0.21; extra == 'dev'
|
|
58
|
+
Requires-Dist: ruff>=0.5; extra == 'dev'
|
|
59
|
+
Requires-Dist: types-requests>=2.31; extra == 'dev'
|
|
60
|
+
Requires-Dist: websockets>=13.0; extra == 'dev'
|
|
61
|
+
Provides-Extra: google-genai
|
|
62
|
+
Requires-Dist: google-genai>=2.0; extra == 'google-genai'
|
|
63
|
+
Requires-Dist: langchain-google-genai>=4.0; extra == 'google-genai'
|
|
64
|
+
Provides-Extra: groq
|
|
65
|
+
Requires-Dist: groq>=0.9; extra == 'groq'
|
|
66
|
+
Provides-Extra: grpc
|
|
67
|
+
Requires-Dist: grpcio>=1.60; extra == 'grpc'
|
|
68
|
+
Provides-Extra: haystack
|
|
69
|
+
Requires-Dist: haystack-ai>=2.0; extra == 'haystack'
|
|
70
|
+
Provides-Extra: langchain
|
|
71
|
+
Requires-Dist: langchain-core>=0.3; extra == 'langchain'
|
|
72
|
+
Provides-Extra: langgraph
|
|
73
|
+
Requires-Dist: langchain-core>=0.3; extra == 'langgraph'
|
|
74
|
+
Requires-Dist: langgraph>=1.0.10; extra == 'langgraph'
|
|
75
|
+
Provides-Extra: llama-index
|
|
76
|
+
Requires-Dist: llama-index-core>=0.14; extra == 'llama-index'
|
|
77
|
+
Provides-Extra: mcp
|
|
78
|
+
Requires-Dist: mcp>=1.26; extra == 'mcp'
|
|
79
|
+
Provides-Extra: openai-agents
|
|
80
|
+
Requires-Dist: openai-agents>=0.0.3; extra == 'openai-agents'
|
|
81
|
+
Provides-Extra: otlp
|
|
82
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.25; extra == 'otlp'
|
|
83
|
+
Provides-Extra: pydantic-ai
|
|
84
|
+
Requires-Dist: pydantic-ai>=2.0; extra == 'pydantic-ai'
|
|
85
|
+
Provides-Extra: realtime
|
|
86
|
+
Requires-Dist: websockets>=13.0; extra == 'realtime'
|
|
87
|
+
Provides-Extra: requests
|
|
88
|
+
Requires-Dist: requests>=2.31; extra == 'requests'
|
|
89
|
+
Description-Content-Type: text/markdown
|
|
90
|
+
|
|
91
|
+
# Agent Observability
|
|
92
|
+
|
|
93
|
+
**Deterministic record/replay for LLM agents.** Capture a failing agent run once, reproduce it offline in under 2 ms with zero API calls, on any Python HTTP client.
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
# Record a 12-step LangGraph run that fails at step 7
|
|
97
|
+
$ uv run --extra langgraph python demos/record_replay_demo.py
|
|
98
|
+
|
|
99
|
+
=== RECORD MODE ===
|
|
100
|
+
Running 12-step pipeline (will fail at step 7)
|
|
101
|
+
|
|
102
|
+
✓ step_01 completed
|
|
103
|
+
...
|
|
104
|
+
✓ step_06 completed
|
|
105
|
+
✗ step_07 Step 7: upstream dependency returned null — cannot continue pipeline
|
|
106
|
+
|
|
107
|
+
Recorded:
|
|
108
|
+
8 spans captured
|
|
109
|
+
fixture → /tmp/agent-trace-demo-.../pipeline-run-001/fixture.db
|
|
110
|
+
7 node spans
|
|
111
|
+
1 error span(s)
|
|
112
|
+
|
|
113
|
+
=== REPLAY MODE ===
|
|
114
|
+
(No network calls — all state served from local fixture)
|
|
115
|
+
|
|
116
|
+
✓ step_01 completed
|
|
117
|
+
...
|
|
118
|
+
✓ step_06 completed
|
|
119
|
+
✗ step_07 Step 7: upstream dependency returned null — cannot continue pipeline
|
|
120
|
+
|
|
121
|
+
Replay complete — same failure reproduced offline.
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
[](https://pypi.org/project/agent-trace/)
|
|
125
|
+
[](LICENSE)
|
|
126
|
+
[](https://www.python.org/downloads/)
|
|
127
|
+
[](https://github.com/RudrenduPaul/agent-observability/actions)
|
|
128
|
+
[](https://securityscorecards.dev/viewer/?uri=github.com/RudrenduPaul/agent-observability)
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Install
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
pip install agent-trace
|
|
136
|
+
# or
|
|
137
|
+
uv add agent-trace
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
LangGraph support:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
pip install agent-trace[langgraph]
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
OpenAI Agents SDK support:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
pip install agent-trace[openai-agents]
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## The problem
|
|
153
|
+
|
|
154
|
+
A LangGraph run fails after step 8. Your trace in LangSmith or Langfuse shows *what* broke. But to reproduce it you have to re-run the entire agent: 8 more LLM calls, 30 more seconds, another $0.15 in API cost. If the failure was caused by a specific tool response or a transient model output, you can't reproduce it at all. You're debugging against a moving target.
|
|
155
|
+
|
|
156
|
+
**Agent Observability solves this at the HTTP transport layer.** It records every request and response verbatim to a local SQLite file. Replay serves those exact bytes back in sequence, in under 1 ms per exchange: same code path, same span tree, same failure. No API calls.
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
Recording overhead: 0.011% (0.090 ms added per LLM call — 0.011% of GPT-4o p50)
|
|
160
|
+
Replay latency: 0.93 ms mean (vs ~8,500 ms live on GPT-4o × 10 steps)
|
|
161
|
+
Replay fidelity: 100% (response bytes byte-for-byte identical to recorded)
|
|
162
|
+
CI cost per replay: $0
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Quick start
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
from agent_trace import tracer
|
|
171
|
+
import httpx
|
|
172
|
+
|
|
173
|
+
@tracer.instrument(record=True)
|
|
174
|
+
def fetch_data(query: str) -> dict:
|
|
175
|
+
with tracer.span("http-call") as span:
|
|
176
|
+
resp = httpx.get("https://httpbin.org/get", params={"q": query})
|
|
177
|
+
span.set_attribute("http.status_code", resp.status_code)
|
|
178
|
+
return resp.json()
|
|
179
|
+
|
|
180
|
+
result = fetch_data("hello")
|
|
181
|
+
# Trace and fixture saved to ~/.agent-trace/runs/run_<id>/
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Replay offline — no API calls, no tokens:
|
|
185
|
+
|
|
186
|
+
```python
|
|
187
|
+
from agent_trace import replay
|
|
188
|
+
|
|
189
|
+
with replay("run_<id>") as ctx:
|
|
190
|
+
result = fetch_data("hello") # served from fixture, zero network
|
|
191
|
+
print(result) # identical to the original run
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
> To store the input for later retrieval in replay, call `ctx.fixture.set_metadata('input', query)` inside the recording context.
|
|
195
|
+
|
|
196
|
+
> **Sync and async clients:** Agent Observability intercepts `httpx.Client`, `httpx.AsyncClient`, and `requests.Session` — including the async client used by default in the OpenAI Python SDK v1.x and Anthropic SDK. The patch is installed at request-dispatch time, so it also covers clients constructed before recording/replay starts (e.g. a module-level `openai.AsyncOpenAI()` instance).
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Use in CI: replay at zero cost
|
|
201
|
+
|
|
202
|
+
Record once. Commit the fixture. Replay in every CI run at zero API cost:
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
# tests/test_agent.py
|
|
206
|
+
import pytest
|
|
207
|
+
from pathlib import Path
|
|
208
|
+
from agent_trace import replay
|
|
209
|
+
|
|
210
|
+
FIXTURE_PATH = Path("fixtures/my_agent_run.db")
|
|
211
|
+
|
|
212
|
+
@pytest.mark.skipif(
|
|
213
|
+
not FIXTURE_PATH.exists(),
|
|
214
|
+
reason="Run: python scripts/record_fixture.py to generate the fixture"
|
|
215
|
+
)
|
|
216
|
+
def test_agent_answer():
|
|
217
|
+
with replay(FIXTURE_PATH) as ctx:
|
|
218
|
+
from my_module import my_agent
|
|
219
|
+
result = my_agent("what is 2+2?")
|
|
220
|
+
assert "4" in result
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Set `AGENT_TRACE_NETWORK_GUARD=1` in CI. Any HTTP call not in the fixture raises `NetworkGuardError` immediately — catching regressions before they hit production.
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
AGENT_TRACE_NETWORK_GUARD=1 uv run pytest tests/
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## How Agent Observability compares
|
|
232
|
+
|
|
233
|
+
Most observability tools for LLM agents are **observe-only** — they show you a trace of what happened, but reproducing a failure still requires re-running the full agent against live APIs.
|
|
234
|
+
|
|
235
|
+
| Capability | Agent Observability | LangSmith | Langfuse | Helicone | OpenLLMetry |
|
|
236
|
+
|---|---|---|---|---|---|
|
|
237
|
+
| Offline replay from local fixture | **Yes** | Partial ¹ | No | No | No |
|
|
238
|
+
| Works with any HTTP client | **Yes** | No | No | No | No |
|
|
239
|
+
| CI replay without API keys | **Yes** | Partial ¹ | No | No | No |
|
|
240
|
+
| Deterministic span timing in replay | **Yes** | No | No | No | No |
|
|
241
|
+
| Captures raw HTTP request/response bytes | **Yes** | No | No | Yes | No |
|
|
242
|
+
| Span-level tracing | Yes | Yes | Yes | Yes | Yes |
|
|
243
|
+
| OTLP export (Jaeger, Grafana Tempo) | Yes | No | Yes | No | Yes |
|
|
244
|
+
| Open-source core | Yes | No | Yes | No | Yes |
|
|
245
|
+
| Local-only, no server required | Yes | No | Self-host | No | Self-host |
|
|
246
|
+
|
|
247
|
+
¹ LangSmith has `LANGSMITH_TEST_CACHE` / VCR cassettes (`langsmith[vcr]`) for Python + LangChain only. It captures HTTP to `api.openai.com` but not arbitrary HTTP clients, does not record full wire-level bytes, and requires a LangSmith account.
|
|
248
|
+
|
|
249
|
+
**Choose LangSmith** if your team is on LangChain and needs dataset management, prompt versioning, and human feedback loops.
|
|
250
|
+
|
|
251
|
+
**Choose Langfuse** if you want a fully open-source, self-hostable observability stack with strong Postgres-backed storage.
|
|
252
|
+
|
|
253
|
+
**Choose OpenLLMetry** if your team already runs on OpenTelemetry and wants standard `gen_ai.*` spans without adding a new observability system.
|
|
254
|
+
|
|
255
|
+
**Agent Observability** is not a replacement for dashboards and eval pipelines. It solves the specific upstream problem: reproducing a specific failed run without any LLM API cost, for any agent built on any Python HTTP client.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Try it with Docker
|
|
260
|
+
|
|
261
|
+
Agent Observability emits OTLP spans. Run a local observability stack to browse trace trees:
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
git clone https://github.com/RudrenduPaul/agent-observability
|
|
265
|
+
cd agent-observability
|
|
266
|
+
docker compose up -d
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Starts three services (all optional):
|
|
270
|
+
|
|
271
|
+
- **Jaeger** (`http://localhost:16686`) — OTLP span ingestion and trace UI
|
|
272
|
+
- **Grafana** (`http://localhost:3000`) — dashboards and alerts
|
|
273
|
+
- **Tempo** (port 3200) — long-term trace storage backend
|
|
274
|
+
|
|
275
|
+
Then point your exporter at the collector:
|
|
276
|
+
|
|
277
|
+
```python
|
|
278
|
+
from agent_trace.exporters.otlp import OTLPExporter
|
|
279
|
+
|
|
280
|
+
# 4317 = OTLP gRPC ingestion endpoint
|
|
281
|
+
exporter = OTLPExporter(endpoint="http://localhost:4317")
|
|
282
|
+
exporter.export(trace)
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## Known limitations
|
|
288
|
+
|
|
289
|
+
Agent Observability's capture model is HTTP-interceptor-based (plus
|
|
290
|
+
instrumented framework callbacks for the integrations under
|
|
291
|
+
`src/agent_trace/integrations/`) and process-local. That model has real
|
|
292
|
+
edges — stated explicitly here so they're clear before you hit one, not
|
|
293
|
+
after:
|
|
294
|
+
|
|
295
|
+
- **Process-local only.** Recording/replay happens inside the Python
|
|
296
|
+
process you import `agent_trace` into (`httpx.Client(transport=
|
|
297
|
+
RecordingTransport(...))`, `session.mount(..., RecordingAdapter(...))`,
|
|
298
|
+
or `ReplayEngine.replay()`'s monkeypatches — see
|
|
299
|
+
`src/agent_trace/interceptor/`). It cannot observe or replay calls made
|
|
300
|
+
by a third-party **hosted** service you don't run or deploy yourself
|
|
301
|
+
(e.g. a vendor's own hosted chat assistant) — only your own process's
|
|
302
|
+
outbound calls.
|
|
303
|
+
|
|
304
|
+
- **gRPC coverage is partial.** `src/agent_trace/interceptor/grpc_hook.py`
|
|
305
|
+
patches `grpc.secure_channel`/`grpc.insecure_channel` (and the `grpc.aio`
|
|
306
|
+
equivalents) to capture Gemini/Vertex AI traffic that bypasses `httpx`
|
|
307
|
+
entirely — unary-unary calls (e.g. `GenerateContent`) and sync
|
|
308
|
+
unary-stream calls (e.g. `StreamGenerateContent`) are fully recorded and
|
|
309
|
+
replayed. Client-streaming and bidirectional-streaming gRPC calls, and
|
|
310
|
+
any `grpc.aio` streaming call, are **not** captured — those go straight
|
|
311
|
+
to the live network unintercepted, both during recording and (if
|
|
312
|
+
attempted) replay.
|
|
313
|
+
|
|
314
|
+
- **Capture starts once a request object exists.** `RecordingTransport.
|
|
315
|
+
handle_request`/`AsyncRecordingTransport.handle_async_request`
|
|
316
|
+
(`httpx_hook.py`) and `RecordingAdapter.send`
|
|
317
|
+
(`requests_patch.py`) only run once a fully-constructed
|
|
318
|
+
`httpx.Request`/`PreparedRequest` reaches them. Any exception raised
|
|
319
|
+
*before* that — while an SDK is serializing a tool schema, building
|
|
320
|
+
headers, or otherwise assembling the call, or even earlier, during plain
|
|
321
|
+
Python object construction (e.g. `TypeError` from `abc.ABCMeta` when
|
|
322
|
+
instantiating an abstract class incorrectly) — happens entirely upstream
|
|
323
|
+
of the interceptor's capture surface and produces zero fixture rows.
|
|
324
|
+
A wired-in framework integration's own error callback (e.g.
|
|
325
|
+
`LangGraphTracer.on_llm_error`) *does* still capture such pre-HTTP
|
|
326
|
+
exceptions when they propagate through that framework's own
|
|
327
|
+
`try`/`except` — so "invisible to the interceptor" is not the same as
|
|
328
|
+
"invisible everywhere": it depends on whether a framework integration is
|
|
329
|
+
wired in for the exception to pass through.
|
|
330
|
+
|
|
331
|
+
- **No visibility into a framework's own print/display code.** Exceptions
|
|
332
|
+
raised inside local logging/printing/display machinery — e.g. `rich`
|
|
333
|
+
Console output, IPython/Jupyter display hooks, triggered by a framework's
|
|
334
|
+
own `verbose=True` logging — have zero HTTP traffic and zero framework
|
|
335
|
+
callback surface. No existing or planned capture mechanism (HTTP
|
|
336
|
+
interceptor, MCP stdio-transport hook, or any framework integration)
|
|
337
|
+
observes this category of failure.
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
## Security
|
|
342
|
+
|
|
343
|
+
- **Supply chain:** SLSA Level 2 via GitHub Actions provenance. All releases signed with Sigstore. SBOM attached to every GitHub Release.
|
|
344
|
+
- **Vulnerability scanning:** Dependabot keeps all GitHub Actions and Python dependencies current. Secret scanning auto-enables when the repo goes public.
|
|
345
|
+
- **Fixture safety:** Fixture files at `~/.agent-trace/runs/` contain full HTTP request and response bodies, including API keys and prompt contents. Add `.agent-trace/` and `*.db` to your `.gitignore`. Never commit a fixture generated against a production API key.
|
|
346
|
+
- **Disclosure:** [SECURITY.md](SECURITY.md) — report vulnerabilities to `agent.obs.oss.security@gmail.com` with a 48-hour response SLA.
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## Contributing
|
|
351
|
+
|
|
352
|
+
- Read [CONTRIBUTING.md](CONTRIBUTING.md) before opening a PR
|
|
353
|
+
- Good first issues are labeled in [GitHub Issues](https://github.com/RudrenduPaul/agent-observability/issues)
|
|
354
|
+
- Replay engine (`src/agent_trace/_replay/`) requires 80% test coverage — correctness-critical
|
|
355
|
+
- Interceptor (`src/agent_trace/interceptor/`) requires 80% test coverage
|
|
356
|
+
- GitHub Discussions for design questions and ideas
|
|
357
|
+
|
|
358
|
+
Apache 2.0. Contributions welcome.
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
*Built by Rudrendu Paul*
|