Skip to main content

Respan LiveKit instrumentation

Translate LiveKit Agents' native tracing into Respan spans while preserving the SDK's stream, tool execution and Session APIs. This package supports livekit-agents>=1.6.0,<2; controlled native SDK validation covers 1.6.0 and 1.8.4. The optional OpenAI companion was tested at matching versions 1.6.0 and 1.8.4, with its released OpenAI dependency bounds (the current companion requires<3).

pip install respan-tracing respan-instrumentation-livekit livekit-plugins-openai
import os
from respan_tracing import RespanTelemetry
from respan_instrumentation_livekit import LiveKitInstrumentor

telemetry = RespanTelemetry(
    api_key=os.environ["RESPAN_API_KEY"],
    app_name="livekit-example",
    is_auto_instrument=False,
)
owner = LiveKitInstrumentor()
owner.activate()
# Run the normal LiveKit LLMStream or AgentSession APIs here.
# Close the SDK's streams/session before releasing the owner.
owner.deactivate()

Native LLMStream request spans become chat spans with model/provider fields, messages, current tool calls, complete available tool schemas and actual usage. OpenAI SSE usage is observed before DTO coercion. Missing, boolean, negative or otherwise unproven token counts are omitted; complete actual input/output counts can produce a total. Counts observed before a failed stream remain available.

execute_function_call emits one tool span with the actual result, invocation ID and declaring request parent when its original call object is available. Existing Session function_tool spans are translated in place, including native error flags, without an additional tool span. Session's native string rendering of tool results is retained; utility calls retain structured raw results. Complete dense and sparse vectors are retained in known tool values. Errors do not invent output, usage or HTTP status; an actual SDK HTTP status is preserved when provided. Other native SDK spans retain their graph and use task common fields.

Content capture has an initial upper bound and an irreversible veto at later checkpoints. LiveKitInstrumentor(capture_content=False), Respan content context, TRACELOOP_TRACE_CONTENT=false, OTel GenAI message-content opt-out and available native LiveKit redaction/capture controls are respected. Private spans omit messages, arguments, outputs, schemas and exception text while keeping structural fields and valid actual usage. A parent veto applies to delayed descendants. A local recording parent created before activation has an unobserved initial policy: its child content stays hidden conservatively, even if capture is enabled later. Activate before creating local parents to enroll their initial bounds. Remote/non-recording parents retain context policy semantics. Sampling and OTel suppression skip owned payload serialization. Credential values are redacted while structural schema property names and benign URL parameters remain intact.

LiveKitInstrumentor(capture_audio=True) (off by default) keeps each turn's audio as two clips the log panel plays: the agent's speech on tts_node (log type speech) and the user's speech on a user_speech span under the turn (log type transcription, with the transcript). Clips are 16-bit WAV, sent as data URLs that Respan stores as log media, and are capped at 60 s each (a longer clip is cut there and marked respan.metadata.voice.audio_truncated). Audio is content: it needs capture_content and follows the same privacy vetoes. Frames are copied as they pass, never held; buffers are released when their span or call ends. The hook points are LiveKit internals: when they are missing, audio capture is off (a debug log) and the agent runs unchanged.

Owners with the same provider/settings share hooks; incompatible settings are rejected. Teardown restores only still-owned hooks/provider fields and preserves foreign replacements. In-flight owned streams finish under the retained privacy policy; reactivate after those streams close. Native values, exceptions, caller context and iterator protocols are preserved.

Declared floors are respan-tracing>=2.17.0, respan-sdk>=2.7.0 (first tested release with the required constants module), and AI semantic conventions>=0.5.1. Native LiveKit supplies the compatible OTel bounds. No unpublished companion package is required.

Coverage is bounded to native LLM streams, function utility execution and room-free Session tool tracing. Live voice rooms, realtime audio/video, remote sessions and every provider plugin are not validated by this suite. The paired Python examples use controlled SDK/HTTP fixtures by default, with explicit export and optional live OpenAI modes. Local canonical wire validation and stored trace projections are separate checks; downstream projection limitations do not change this package's span contract.

Metadata

Release files for respan-instrumentation-livekit 0.3.0

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

Source distribution (sdist)

Source distribution for respan-instrumentation-livekit 0.3.0
File Size Uploaded Provenance Actions
respan_instrumentation_livekit-0.3.0.tar.gz 22.6 kB With provenance Details for respan_instrumentation_livekit-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for respan-instrumentation-livekit 0.3.0
File Interpreter ABI Platform Actions
respan_instrumentation_livekit-0.3.0-py3-none-any.whl Python 3 none any Details for respan_instrumentation_livekit-0.3.0-py3-none-any.whl

Total release size: 49.4 kB

Release files / respan_instrumentation_livekit-0.3.0.tar.gz

Download URL respan_instrumentation_livekit-0.3.0.tar.gz
Size 22.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cee50f2f282e453fc7c3fde56f773442397d014e88a367e03293bd621195d7cd
BLAKE2b-256 checksum
How to use checksums
9872ad21a3fab643c310b88be37c2fa1cfa8260dccc3e75a537f0adffb95b36e
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 17, 2026.

Transparency log

Release files / respan_instrumentation_livekit-0.3.0-py3-none-any.whl

Download URL respan_instrumentation_livekit-0.3.0-py3-none-any.whl
Size 26.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e25c18626fc4f8ff96fa84528ea6ed05cecf6c9da71049dc026e1c9131a7a5b2
BLAKE2b-256 checksum
How to use checksums
dff91192afa7cd3db9e9237494f9b0be2b8ddb0a20175ba3f72a08310fd2f01d
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 17, 2026.

Transparency log

Security for respan-instrumentation-livekit 0.3.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

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

Select from 2 files

Attestation for respan_instrumentation_livekit-0.3.0.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 Nov 17, 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