Skip to main content

Respan instrumentation plugin for LiveKit Agents

Project description

Respan LiveKit Instrumentation

Respan instrumentation plugin for LiveKit Agents. It translates LiveKit's native livekit-agents LLM spans into canonical Respan chat spans and emits Respan tool spans for execute_function_call.

Installation

pip install respan-ai respan-instrumentation-livekit livekit-agents

Usage

import os

from livekit.agents import llm
from respan import Respan, workflow
from respan_instrumentation_livekit import LiveKitInstrumentor

respan = Respan(
    api_key=os.environ["RESPAN_API_KEY"],
    app_name="livekit-example",
    instrumentations=[LiveKitInstrumentor()],
)


@workflow(name="livekit_chat.workflow")
async def run_chat(model: llm.LLM) -> str:
    chat_ctx = llm.ChatContext.empty()
    chat_ctx.add_message(role="user", content="Say hello in one sentence.")
    response = await model.chat(chat_ctx=chat_ctx).collect()
    return response.text

Captured Spans

  • LiveKit LLMStream requests become Respan chat spans with request messages, completions, tool calls, tool definitions when available, model, provider, and token usage.
  • LiveKit execute_function_call executions become Respan tool spans.

Use Respan(..., customer_identifier=..., thread_identifier=..., metadata=...) or respan.propagate_attributes(...) to attach Respan attributes to LiveKit spans.

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

respan_instrumentation_livekit-0.1.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file respan_instrumentation_livekit-0.1.0.tar.gz.

File metadata

File hashes

Hashes for respan_instrumentation_livekit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 12a47a5cf73d13f9e585c070cd560dd0a3ac162d27c3793bdb8da1d74633ff15
MD5 b0a400d233cc9bbe558a7d1b93e7b216
BLAKE2b-256 f26450f60e0e9cd7ebc7620a68f783f8bccb6be4b2d5577eb9f4289f70f50903

See more details on using hashes here.

File details

Details for the file respan_instrumentation_livekit-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for respan_instrumentation_livekit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d58fc01dda2df79b25743e4739342ae105087b4e8bdb93f0fa5264fdcec16426
MD5 43e1abd33f224e56f706b6f57a422625
BLAKE2b-256 690fe1519ca8ea0b23939d4db8b3a9f80fca9afd308cbf34c29aac1826d4e62d

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