Skip to main content

OpenTelemetry instrumentation for LiveKit

Project description

traceAI-livekit

OpenTelemetry instrumentation for LiveKit agents integrated with Future AGI.

This package provides automatic attribute mapping from LiveKit's native OpenTelemetry instrumentation to Future AGI's semantic conventions, ensuring rich and structured traces in your dashboard.

Installation

pip install traceai-livekit

Quick Start

To instrument your LiveKit agent, simply initialize fi-instrumentation and enable the attribute mapping inside your agent's entrypoint.

from livekit.agents import AgentServer, JobContext
from fi_instrumentation.otel import register, ProjectType
from traceai_livekit import enable_http_attribute_mapping

server = AgentServer()

@server.rtc_session()
async def entrypoint(ctx: JobContext):
    # 1. Initialize TraceAI (inside entrypoint for multiprocessing safety)
    register(
        project_name="My LiveKit Agent",
        project_type=ProjectType.OBSERVE,
        set_global_tracer_provider=True,
    )
    
    # 2. Enable LiveKit attribute mapping
    # This automatically hooks into LiveKit's telemetry system
    enable_http_attribute_mapping()
    
    # ... rest of your agent logic ...
    await ctx.connect()

if __name__ == "__main__":
    server.run()

Features

  • Automatic Attribute Mapping: Converts LiveKit attributes (like lk.user_input, gen_ai.usage.input_tokens) to Future AGI standard attributes (input.value, llm.tokenCount.prompt).
  • Raw Data Preservation: Keeps original LiveKit attributes and adds raw.input / raw.output for full debugging context.
  • Multiprocessing Support: Designed to work with LiveKit's worker process model.
  • Event Parsing: Extracts LLM outputs from gen_ai.choice events when available.

Examples

Check the examples/ directory for complete working agents:

  • simple_agent.py: A basic voice assistant agent.
  • egress_agent.py: An agent with call recording (Egress) enabled.

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

traceai_livekit-0.1.1.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

traceai_livekit-0.1.1-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file traceai_livekit-0.1.1.tar.gz.

File metadata

  • Download URL: traceai_livekit-0.1.1.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for traceai_livekit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8a32c304c1854436d6ea427fd8900e8dcbca9420dfbbbd795d8c0d784f98a6a4
MD5 0ab897e6b7b887a2e562c93fd80c8414
BLAKE2b-256 1efa93160d00b499304874a03453241025db60586b8435d8133e9600492e6a4e

See more details on using hashes here.

File details

Details for the file traceai_livekit-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: traceai_livekit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for traceai_livekit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 692421835b30146f367761e569dad75248dc48de158185061c7cf7b31cfdf8d4
MD5 732df1ea029a4a88f9504aebb8a6e0cd
BLAKE2b-256 c296beda1bbc53391f619257cba5b2b533f9a05d3a54205255b02e2a6e06f8dd

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