Skip to content

Add LiveKit Agents support#9

Closed
Hormold wants to merge 3 commits into
raindrop-ai:mainfrom
Hormold:feat/livekit-agents-adapter
Closed

Add LiveKit Agents support#9
Hormold wants to merge 3 commits into
raindrop-ai:mainfrom
Hormold:feat/livekit-agents-adapter

Conversation

@Hormold

@Hormold Hormold commented May 15, 2026

Copy link
Copy Markdown

Adds support for ingesting traces from the LiveKit Agents Python SDK.

What's added

  • src/spans/adapters/livekit.ts — turns lk.chat_ctx into a chat-history view for llm_node spans and lk.function_tool.* into tool-call data.
  • src/parse.ts — classifies LiveKit llm_node as LLM_GENERATION (via lk.chat_ctx + gen_ai.request.model), picks up lk.function_tool.name, and recognizes gen_ai.provider.name.
  • src/otlp-protobuf.ts — decodes protobuf OTLP requests so the stock opentelemetry-exporter-otlp-proto-http exporter works directly. Workshop used to silently drop protobuf bodies.

How to wire it up

from livekit.agents.telemetry import set_tracer_provider
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor

provider = TracerProvider()
provider.add_span_processor(BatchSpanProcessor(
    OTLPSpanExporter(endpoint="http://localhost:5899/v1/traces")
))
set_tracer_provider(provider)

Screenshots

Screenshot 2026-05-15 at 9 23 09 AM

Hormold added 3 commits May 14, 2026 18:53
Adds support for spans emitted by the livekit-agents Python SDK.

- src/spans/adapters/livekit.ts: extracts chat history from lk.chat_ctx
  (handling message / function_call / function_call_output items) and
  tool calls from lk.function_tool.{name,arguments,output,is_error}
- src/parse.ts: classifies llm_node spans as LLM_GENERATION via
  (lk.chat_ctx + gen_ai.request.model); recognizes lk.function_tool.name
  as a tool-name attribute alongside ai.toolCall.name / tool.name
- src/spans/normalize.ts: registers the two adapters
LiveKit Agents sets gen_ai.provider.name (newer OTel GenAI convention)
rather than the older gen_ai.system. Without this fallback the provider
column stays empty for every LiveKit span.
The standard opentelemetry-exporter-otlp-proto-http exporter always sends
protobuf regardless of OTEL_EXPORTER_OTLP_PROTOCOL. Workshop was warning
and dropping these bodies; this decodes them via protobufjs against an
inline OTLP schema and converts to the JSON shape parseOtlpRequest
already consumes.
@Hormold
Hormold marked this pull request as ready for review May 15, 2026 16:23
@pavel-y-ivanov

Copy link
Copy Markdown
Contributor

Thank you for the PR! Included the changes into this release: https://github.com/raindrop-ai/workshop/releases/tag/v0.1.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants