Skip to main content Switch to mobile version prism-ai-opentelemetry 0.4.0 GenAI-convention OpenTelemetry spans from Prism telemetry, for Python.
pip install prism-ai-opentelemetry==0.4.0 Copy PIP instructions
OpenTelemetry spans for Prism generations, using the GenAI semantic conventions and the OpenInference keys that Phoenix and Arize read. The Python port of particle-academy/prism-opentelemetry.
Zero runtime dependencies. Python 3.10+.
One root span per generation, with the operation, provider, model and, when given, session.id and user.id.
A child span per step, with token usage and, when given, cost.
A child span per tool call (execute_tool ), attached to the step it belongs to.
A failed generation ends its root span with an error status.
Children are parented off the root stored in SpanStore under the trace id, never off the ambient context. Prism's tool loop is recursive, and ambient context does not survive it.
Prompts, completions and tool arguments are user content, and a span export leaves the application. They are recorded only with capture_content=True.
Captured content is cut at max_content_length characters (65,536 by default) and marked …[truncated].
Even with capture on, media bytes (images, audio, video, documents) are replaced by their size unless you also pass capture_media=True. without_media_bytes() is the function that does it.
The model, provider, token counts and rate limits are not content and are always recorded.
Exception messages are recorded only when content capture is on. With capture_content off, a failed span's status description is The generation failed. and record_exception receives a stand-in that carries only the exception's class: no message, traceback, cause or notes. The class's module and qualified name are still exported, so do not build exception class names from data. The stand-in is not an instance of the original class, so a span processor that filters on isinstance no longer matches; filter on exception.type instead.
With capture on, the status description is cut to max_content_length. The exception itself is recorded unless what an SDK would write from it (its message and its formatted traceback with every cause, context and note) is longer than max_content_length, or its __str__ raises or returns something other than a plain str. Then record_exception receives a stand-in of the same class name whose message is that text, cut. Like the capture-off stand-in it is not an instance of the original class, and it has no traceback or chain of its own.
A captured value that cannot be serialised (a prompt, an output, a tool's parameters or result) is left off the span rather than raising.
record_exceptions is on by default. Turn it off to record no exception at all.
Pass the provider's quota buckets as RateLimit(name, limit, remaining, resets_at) to on_generation_completed or on the error given to on_generation_failed. They are written as prism.rate_limit. .* attributes, on success as well as on failure.
prism-parity's opentelemetry-media-content corpus pins the media-byte rule, and all three languages agree on it.
Its opentelemetry-span-attributes corpus does not agree yet. Rate-limit attributes are identical in PHP, TypeScript and Python. These still differ:
the operation name and span name, which the PHP reference maps onto the GenAI vocabulary and the ports pass through;
the span kind for image and stream operations;
the status of a successful span, unset in PHP and ok in the ports;
gen_ai.response.finish_reasons;
captured content, which Python encodes with spaces after separators and escaped non-ASCII;
where truncation cuts a long value.
Spans from a PHP application and a Python agent in the same trace show those differences.
Both files in this release have provenance metadata.
MIT View SPDX License List
agents ai llm observability opentelemetry prism tracing
Development Status 3 - Alpha
Intended Audience Developers
Programming Language Python :: 3
Release files for prism-ai-opentelemetry 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 40.0 kB
Release files / prism_ai_opentelemetry-0.4.0.tar.gz
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 verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Security for prism-ai-opentelemetry 0.4.0
Both files in this release have been uploaded with provenance metadata.
With provenance prism_ai_opentelemetry-0.4.0.tar.gz Nov 26, 2026
Attestation for prism_ai_opentelemetry-0.4.0.tar.gz
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
Nov 26, 2026 2 release files Full provenance
Sep 22, 2026 2 release files Full provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation




