Skip to main content

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

pyagent_trace-0.2.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyagent_trace-0.2.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

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

Hashes for pyagent_trace-0.2.0.tar.gz
Algorithm Hash digest
SHA256 62437e097ae61a1db5da08900940df916ab359f8274107da44196000f9760bc6
MD5 7a1c7321cec246e53febd7994a5e1fb9
BLAKE2b-256 50502019c9ae64aa6acd0dbb49378ccb67ccf3c37208c3d3d7985deef9c8aa36

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyagent_trace-0.2.0.tar.gz:

Publisher: publish.yml on pyagent-core/pyagent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for pyagent_trace-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a73bcbb8317bb0b1bbbd7a8a4b0b0670fc029f09db9c44daf8d71ad1c655698e
MD5 96a256934fd5bf94be8694971d1b184d
BLAKE2b-256 85744cf723c31de63232d3b54bab836a637c88e4c0105dfbd33ee98bf19907b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyagent_trace-0.2.0-py3-none-any.whl:

Publisher: publish.yml on pyagent-core/pyagent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page