Skip to main content

OpenTelemetry tracing + metrics emitter for AgentForge

Project description

agentforge-otel

OpenTelemetry tracing for AgentForge (feat-009).

The OTel API ships in agentforge-core — the framework emits spans unconditionally. Without this package, those calls degrade to NonRecordingSpan (near-zero cost). Installing agentforge-otel wires up the SDK, an OTLP exporter, and a sampler so the spans actually reach a collector.

Quick start

from agentforge import Agent
from agentforge_otel import OpenTelemetryHook

otel = OpenTelemetryHook(
    endpoint="http://otel-collector:4317",
    service_name="my-agent",
    sample_rate=1.0,
)

agent = Agent(
    model="bedrock:...",
    tools=[...],
    on_step=otel,
    on_finish=otel,
)

Constructing the hook installs the SDK provider once (idempotent). The framework's existing span emission then produces a tree per run:

span: agent.run
└── span: strategy.iteration
    ├── span: llm.call
    ├── span: tool.<name>
    └── span: evaluator.<name>

Span attributes carry agentforge.run_id, cost, token counts, finish reason, and step count — same correlation key the RunIdFilter puts on every log line.

Multiple backends

Run OTel alongside any other observer:

agent = Agent(
    model="...",
    on_step=[otel, my_statsd_hook],
    on_finish=[otel, persist_to_db],
)

Hooks fire in registration order; one hook's exception doesn't affect siblings (the framework logs WARN via agentforge.observability and keeps going).

Vendor compatibility

OTel is the wire format; any collector that ingests OTLP works: Datadog, Honeycomb, Jaeger, Grafana Tempo, SigNoz, New Relic. Point the endpoint at your collector's gRPC port (4317 by default).

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

agentforge_otel-0.4.0.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

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

agentforge_otel-0.4.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file agentforge_otel-0.4.0.tar.gz.

File metadata

  • Download URL: agentforge_otel-0.4.0.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agentforge_otel-0.4.0.tar.gz
Algorithm Hash digest
SHA256 6e2242b2d0514a252d40ffa5f43d2944a9e13036836e5a97e6299510059bd18c
MD5 e955ede1c5e8b9254b364a4ad77e6fab
BLAKE2b-256 9a1cb5aece1345d8ff1cec26e6eb7bc022bc349df5997edc03c2b6b25b1b679c

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentforge_otel-0.4.0.tar.gz:

Publisher: release.yml on Scaffoldic/agentforge-py

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

File details

Details for the file agentforge_otel-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: agentforge_otel-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agentforge_otel-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3b037fdb50662a352db13d4da751877a4af79a06f4f93e420c0b676765df13bc
MD5 322950d5809af700642962332dac0cf8
BLAKE2b-256 bc366134fa69608fb6ab5a51363f5f7b84413d4e458b54ba8e0e8da96cb2dea8

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentforge_otel-0.4.0-py3-none-any.whl:

Publisher: release.yml on Scaffoldic/agentforge-py

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