Skip to main content

conviva-agent-tracing

OpenLLMetry auto-instrumentation, exporting to Conviva. Wraps traceloop-sdk so the LLM, vector-DB and agent-framework libraries it supports are instrumented automatically, and routes the resulting spans to the Conviva agent gateway with cvx.conversation_id and cnv.project_id on every span. Traces only — no metrics or logs are exported.

It is built from two Conviva packages, both installed as dependencies and both usable on their own:

Package Role here
conviva-otlp-exporter The OTLP exporter to https://<customer_key>.agw.conviva.com/v1/traces, and the span processors that stamp cvx.conversation_id and cnv.project_id.
conviva-agent-traces-connector Copies the Conviva client's c3.* W3C baggage — client id, conversation id, message id — onto every span.

The Python mirror of @convivainc/agent-tracing — same shape, snake_case names.

If you already have an instrumentation library and only want the Conviva transport, use conviva-otlp-exporter directly; it depends on no vendor SDK.

Install

pip install conviva-agent-tracing

Use

import conviva_agent_tracing

conviva_agent_tracing.init(app_name="flight-booking")

Call init() before importing the libraries you want instrumented — OpenLLMetry patches modules at import time.

Two values configure it, and nothing else — the second is optional:

customer key customer_key= or CONVIVA_CUSTOMER_KEY. Becomes the subdomain: https://<customer_key>.agw.conviva.com.
project id project_id= or CONVIVA_PROJECT_ID. Sent as the X-Conviva-Project-Id header and written onto every span as cnv.project_id. Optional: without it, traces go to the account's default project.

Both are resolved by conviva-otlp-exporter, so the endpoint precedence and header rules documented there apply unchanged.

API

init(...) -> ResolvedConfig Initialize. Idempotent: a second call warns and returns the cached config. Raises ConvivaTracingError on bad configuration, before touching any global state.
get_config() The active ResolvedConfig, or None before init().
force_flush() Drain the batch processor. Call before a short-lived process exits.
shutdown() Flush pending spans — see the caveat below.
set_association_properties({...}) Attach properties to the current trace. session_id is the one Conviva reads back as cvx.conversation_id.
BaggageSpanProcessor, BaggageConfig, ensure_baggage_propagator The connector, re-exported. init() already installs it.

OpenLLMetry's manual-annotation decorators — workflow, task, agent, tool, conversation and the a-prefixed async variants — are re-exported, so an application depends on this package alone.

Any keyword init() does not name is passed straight through to Traceloop.init: instruments, block_instruments, sampler, propagator, resource_attributes and the rest.

conviva_agent_tracing.init(
    app_name="flight-booking",
    conversation_id="conv-42",           # or let the processor resolve it
    attributes={"tenant": "acme"},       # stamped on every span
    span_processors=[MyProcessor()],     # composed after Conviva's
    disable_batch=True,                  # export each span as it ends
    trace_content=False,                 # or CONVIVA_TRACE_CONTENT=false
    baggage_config=BaggageConfig(        # which baggage reaches spans
        allowlist=("c3.", "tenant"),
    ),
)

Conviva client baggage

The Conviva client sensor sends c3.client_id, c3.conv_id and c3.msg_id in the W3C baggage header. init() installs the connector's BaggageSpanProcessor ahead of the Conviva processors and merges the W3C baggage propagator into the global one, so every span started while that baggage is in context carries those entries as attributes under their own names. Your HTTP server instrumentation still has to extract the header into context — that part is not this package's job.

Conversation ids

ConversationIdSpanProcessor resolves one from, in order: the conversation_id argument → span attributes (traceloop.association.properties.session_id, session.id, gen_ai.conversation.id) → baggage (c3.conv_id, conversation_id, session_id, langfuse_session_id). Ids are only extracted, never generated: a span with none of these carries no cvx.conversation_id. The usual path is the second:

conviva_agent_tracing.set_association_properties({"session_id": conversation_id})

Override the source lists with conversation_id_sources= and conversation_id_baggage_keys= if your application names them differently.

Two things to know

shutdown() only flushes. OpenLLMetry keeps its tracer provider private and exposes no shutdown hook, so instrumentation stays installed and tracing cannot be restarted in the same process. The JS wrapper has the same limitation.

Every span is exported, not just LLM spans. OpenLLMetry installs no scope filter, so spans from any HTTP or database instrumentation on the global provider go to Conviva too. That is what auto-collection means here, but it is a louder default than a scoped exporter.

Traces only

Nothing but traces goes to Conviva. init() sets TRACELOOP_METRICS_ENABLED and TRACELOOP_LOGGING_ENABLED to false unless you have set them yourself. If you turn OpenLLMetry's logging on without a logging_exporter or TRACELOOP_LOGGING_ENDPOINT of your own, init() turns it back off with a warning — OpenLLMetry would otherwise send the logs to the gateway. Metrics and logs you route to your own destination are left alone.

Test

uv run pytest packages/python/conviva-agent-tracing

Documentation

README.md What the package does and its API.
INTEGRATION.md Step-by-step integration into an application.
AGENTS.md Guidance for AI coding agents working on or with this package.

Metadata

Release files for conviva-agent-tracing 1.0.0

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

Built distribution (wheel)

Table of built distributions (wheels) for conviva-agent-tracing 1.0.0
File Interpreter ABI Platform Actions
conviva_agent_tracing-1.0.0-py3-none-any.whl Python 3 none any Details for conviva_agent_tracing-1.0.0-py3-none-any.whl

Release files / conviva_agent_tracing-1.0.0-py3-none-any.whl

Download URL conviva_agent_tracing-1.0.0-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
18f66e60947177c2b504b5e3943ee969ba598814486ea18d58efa71212670714
BLAKE2b-256 checksum
How to use checksums
782273a3397a55040ce2165e3571fcfdea9da23aecfd69fd9131c44638a33e25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Nov 18, 2026.

Transparency log

Security for conviva-agent-tracing 1.0.0

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

1 file in this release has been uploaded with provenance metadata.

Attestation for conviva_agent_tracing-1.0.0-py3-none-any.whl

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 Nov 18, 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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file Full provenance

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