Pattern-aware OpenTelemetry tracing for multi-agent LLM systems
Project description
pyagent-trace
Pattern-aware OpenTelemetry tracing for multi-agent LLM systems. Track costs, record interactions, debug with replay.
Install
pip install pyagent-trace # Core (CostTracker, Recorder work without OTel)
pip install pyagent-trace[otel] # With OpenTelemetry spans
Components
- CostTracker — Accumulate costs by pattern, agent, and model (no OTel required)
- Recorder — Record all messages + LLM responses to JSONL for replay/debug
- PatternSpanEmitter — Create OTel spans for pattern executions (requires OTel)
- traced_pattern / traced_agent — Decorators for automatic tracing (requires OTel)
- PyAgentAttributes — Custom
pyagent.*attribute constants
Quick Example (no OTel required)
from pyagent_trace import CostTracker, Recorder
tracker = CostTracker()
tracker.record("debate", "bull_agent", "gpt-4o", 500, 200, 0.003)
print(f"Total: ${tracker.total_cost:.4f}")
print(f"By model: {tracker.by_model()}")
recorder = Recorder()
recorder.start("debate")
recorder.record_llm_call("bull", messages, "Bull case: ...")
recorder.end("Final decision")
recorder.save("traces/debug.jsonl")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyagent_trace-0.2.0.tar.gz.
File metadata
- Download URL: pyagent_trace-0.2.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62437e097ae61a1db5da08900940df916ab359f8274107da44196000f9760bc6
|
|
| MD5 |
7a1c7321cec246e53febd7994a5e1fb9
|
|
| BLAKE2b-256 |
50502019c9ae64aa6acd0dbb49378ccb67ccf3c37208c3d3d7985deef9c8aa36
|
Provenance
The following attestation bundles were made for pyagent_trace-0.2.0.tar.gz:
Publisher:
publish.yml on pyagent-core/pyagent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyagent_trace-0.2.0.tar.gz -
Subject digest:
62437e097ae61a1db5da08900940df916ab359f8274107da44196000f9760bc6 - Sigstore transparency entry: 1756486294
- Sigstore integration time:
-
Permalink:
pyagent-core/pyagent@00d72728c06b5339307ebe880888e9326c6d5e6e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pyagent-core
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@00d72728c06b5339307ebe880888e9326c6d5e6e -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pyagent_trace-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pyagent_trace-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a73bcbb8317bb0b1bbbd7a8a4b0b0670fc029f09db9c44daf8d71ad1c655698e
|
|
| MD5 |
96a256934fd5bf94be8694971d1b184d
|
|
| BLAKE2b-256 |
85744cf723c31de63232d3b54bab836a637c88e4c0105dfbd33ee98bf19907b7
|
Provenance
The following attestation bundles were made for pyagent_trace-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on pyagent-core/pyagent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyagent_trace-0.2.0-py3-none-any.whl -
Subject digest:
a73bcbb8317bb0b1bbbd7a8a4b0b0670fc029f09db9c44daf8d71ad1c655698e - Sigstore transparency entry: 1756486459
- Sigstore integration time:
-
Permalink:
pyagent-core/pyagent@00d72728c06b5339307ebe880888e9326c6d5e6e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pyagent-core
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@00d72728c06b5339307ebe880888e9326c6d5e6e -
Trigger Event:
workflow_dispatch
-
Statement type: