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.outputfor full debugging context. - Multiprocessing Support: Designed to work with LiveKit's worker process model.
- Event Parsing: Extracts LLM outputs from
gen_ai.choiceevents 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file traceai_livekit-0.1.0.tar.gz.
File metadata
- Download URL: traceai_livekit-0.1.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.0 CPython/3.13.0 Darwin/25.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a803330f1ae8ed128e47a364f79be8cebfb937dd1f0b3711b6a86be48ffed27b
|
|
| MD5 |
6d21c847533e72d688e888f780357f75
|
|
| BLAKE2b-256 |
b8644d596065114d83eb9ad8d74c1c6945f0c78e547e4e3a036084196044af91
|
File details
Details for the file traceai_livekit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: traceai_livekit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.0 CPython/3.13.0 Darwin/25.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64fbe57a28dfb10b1b0ec2dbe26b2a6e36beb9b1638a724914be46675dda9bf9
|
|
| MD5 |
5d4246bd5e44e0a11414480a13bbe435
|
|
| BLAKE2b-256 |
1b08f623437ad882ad3b57a0ecb89dad75e85086f4b8b31d67a7797b4c065217
|