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.2.4.tar.gz (13.2 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.2.4-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for agentforge_otel-0.2.4.tar.gz
Algorithm Hash digest
SHA256 67872275fdcd54ff2421c17776e40c27954cca4d1f246ef1215d46e0ed27cdfd
MD5 445ec60872f330c758a8f0fa47204c69
BLAKE2b-256 da2a055e20704fa0ce70405edea37b90b84a43be1c272a4dfb47936be6fde8b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for agentforge_otel-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b9746b620f02ca2bc83135c0ae02423ac14845f46ab6c84d25aba7b35dbc1be5
MD5 c8a3e168602c14316884156ac1a70252
BLAKE2b-256 f6f4b2da20a4a884941e133c054624c7710af6bb877465b23ed50abbf025624e

See more details on using hashes here.

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