Skip to main content

pytracer-autogen

pyTracer adapter for AutoGen (0.4+; the separate AutoGen 0.2 API is not supported). AutoGen emits OpenTelemetry spans using the GenAI semantic conventions; this adapter plugs a pyTracer exporter into an OpenTelemetry tracer provider, so the spans AutoGen emits are captured as pyTracer spans with no @op in the agent code. AutoGen's own spans carry less than the other frameworks report, so the adapter fills in the rest:

Captured
Agent spans, with the agent's name Yes
Tool calls with their output Yes. AutoGen's tool span has only the call id; the result is joined from the message AutoGen sends with it, and an error result marks the span failed
Model calls Yes. AutoGen emits no model-call span, so each call is recorded from the call event the model client logs (the autogen_ext clients for OpenAI, Azure, Anthropic, Ollama and others do), with model, request, reply and tokens; a client that logs nothing has its calls rebuilt from the replies AutoGen delivers (reply and tokens, marked pytracer.derived). A GenAI-instrumented client (for example opentelemetry-instrumentation-openai-v2) keeps its prompt and reply too: install() reads the content that library sends as log records
One trace per team run Yes. AutoGen delivers each message in a new OpenTelemetry trace linked to the sender's; the adapter follows those links (see One trace per run)
Nesting under an enclosing pytracer.start_span(...) Yes
Replay without @op Yes, with install(replayable=True) (see Replay)

AutoGen emits its GenAI model and tool spans through the global OpenTelemetry provider, so register pyTracer globally with install() before building the runtime. Configure pyTracer first, so the exporter records into your transport:

import pytracer_sdk as pytracer
from pytracer_autogen import install
from autogen_core import SingleThreadedAgentRuntime

pytracer.configure(
    pytracer.HTTPTransport("https://gateway.internal", api_key="YOUR_KEY"),
    service_name="my-agent", branch="main", commit="abc123",
)

install()  # register pyTracer as the global OpenTelemetry provider
runtime = SingleThreadedAgentRuntime()

Passing a provider only to the runtime (SingleThreadedAgentRuntime(tracer_provider=pytracer_tracer_provider())) sees just the runtime's internal messaging spans, which the exporter drops as noise, so install() is the setup that captures the actual model and tool calls.

Because it keys off standard GenAI attributes (gen_ai.operation.name, gen_ai.tool.name, gen_ai.agent.name, gen_ai.usage.*), the same exporter captures spans from any GenAI-instrumented library, not only AutoGen.

What install() changes in your process, each logged at INFO when it happens:

  • It registers pyTracer as the global OpenTelemetry tracer provider.
  • It adds a handler to the autogen_core.events logger to read model-call events. If that logger was dropping INFO records (the default), it is set to INFO with propagation off, so your other handlers see exactly what they saw before; set that logger's level yourself to manage it.
  • It adds a processor to the global OpenTelemetry LoggerProvider to read GenAI model content, registering a LoggerProvider if none is set. To use your own, register it before install() and pyTracer adds to it.

Versions: what is captured depends on the AutoGen version emitting GenAI spans. Some versions emit no model-call span or tool result; pyTracer records what the framework reports, so upgrade AutoGen (or add the relevant GenAI instrumentation) if model calls or tool outputs are missing.

Alongside other frameworks

AutoGen 0.7.5, its latest release (September 2025; AutoGen is in maintenance mode), pins protobuf~=5.29.3. AutoGen does not use googleapis-common-protos itself, but its protobuf pin rules out 1.75.1 and later, which need protobuf>=6.33.5. Installed in one command with other frameworks (CrewAI pulls it in through both opentelemetry-exporter-otlp-proto-http and chromadb), pip and uv pick a compatible 1.75.0. Added to an existing environment that has a newer one, pip downgrades protobuf and only warns, and the next import fails with VersionError: Detected incompatible Protobuf Gencode/Runtime versions; fix it with pip install "googleapis-common-protos<1.75.1". See using several frameworks in one environment.

One trace per run

AutoGen delivers each message in a new OpenTelemetry trace, linked to the trace that sent it. The provider built by install() follows those links, so a team run is recorded as one pyTracer trace, with each agent turn at the top of the run and its tool calls beneath it. A run started inside an open pyTracer span nests under it, like the other adapters:

with pytracer.start_span("answer-question"):
    await team.run(task="...")   # one trace, rooted at "answer-question"

Replay

Install with replayable=True and a captured run replays without adding @op to anything:

install(replayable=True)   # also routes model clients and tools through pyTracer

AutoGen's model calls (create / create_stream on every ChatCompletionClient, including the autogen_ext clients and custom ones) and tool calls (BaseTool.run_json, which every tool call goes through) then run through pyTracer, so the replay engine can return their recorded results: in full mode neither the models nor the tools run again, in partial mode the tools stay frozen while the models run live, and streamed replies replay chunk by chunk. Each model call is matched on what was asked (the messages, the tools offered, the output format). uninstall_seams() removes the routing again.

Without replayable=True the adapter only captures, and replaying an adapter-only trace is flagged (the run has recordings but hits no @op seam) rather than silently running live. See the main README for the replay workflow.

AutoGen versions

Every AutoGen release from 0.4.0 is captured in full (the table above), but older releases report less about a run, so install() fills the gap differently:

AutoGen What it reports How the adapter captures the rest
0.7.2 and later GenAI agent, tool and model-call data, and each tool's result From AutoGen's own spans and events
0.6.2 to 0.7.1 The GenAI spans, but no tool results Model and tool calls go through pyTracer (the routing replayable=True uses), which records their output
0.4.0 to 0.6.1 No agent or tool spans (before 0.4.9, no spans at all) As above, plus each agent turn and each team run go through pyTracer, so a run is one trace with its turns, calls and tool output

On releases before 0.7.2 that routing is always on, since it is how the calls are captured; uninstall_seams() would stop it. Streamed replies replay chunk by chunk wherever AgentChat streams them (0.4.5 and later). CI runs the adapter's tests on 0.4.0, 0.4.9, 0.6.2, 0.7.2 and the latest release.

Metadata

Release files for pytracer-autogen 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytracer-autogen 0.1.4
File Size Uploaded Provenance Actions
pytracer_autogen-0.1.4.tar.gz 28.1 kB With provenance Details for pytracer_autogen-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytracer-autogen 0.1.4
File Interpreter ABI Platform Actions
pytracer_autogen-0.1.4-py3-none-any.whl Python 3 none any Details for pytracer_autogen-0.1.4-py3-none-any.whl

Total release size: 51.6 kB

Release files / pytracer_autogen-0.1.4.tar.gz

Download URL pytracer_autogen-0.1.4.tar.gz
Size 28.1 kB
Tags Source
SHA-256 checksum
How to use checksums
70c776deeee9cceeb4806c867cca2e00276ac4478ae9a83d5ddbce5bb3430d70
BLAKE2b-256 checksum
How to use checksums
122932b53368181c9c5765d3d9a4c64ff4f7726c358379f3f5c6bca02248a68c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / pytracer_autogen-0.1.4-py3-none-any.whl

Download URL pytracer_autogen-0.1.4-py3-none-any.whl
Size 23.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61ab297f9d0299dd8b64e29465a6c52b37b5d3ecbfac08ac4b9ce662e4e2856f
BLAKE2b-256 checksum
How to use checksums
f61952e27a41a06652506e93c4c2149844e5f4c9c896fc797d8b02693bd7ce54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for pytracer-autogen 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pytracer_autogen-0.1.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page