witty-kangaroo-6889
08/21/2025, 6:38 AMtall-airline-16756
08/21/2025, 6:38 AMtall-airline-16756
08/21/2025, 6:39 AMLANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, and LANGFUSE_HOST.
2. Next, call the setup_langfuse() function right in your entry point. This will initialize the tracer provider and configure OpenTelemetry to send spans to Langfuse through the OTLP endpoint.
Once that’s all set up, the system will automatically trace your LLM requests and responses:
• For each LLM inference, an llm_request span is created, capturing helpful details like the request model, input/output token usage, and timing info.
• The entire LLM request, including chat context messages, gets recorded as OpenTelemetry events like gen_ai.user.message and gen_ai.assistant.message.
• The response, including generated text and any tool calls, is captured as an event named gen_ai.choice.
All this data follows OpenTelemetry’s GenAI conventions and you can explore it easily in the Langfuse dashboard. If you want to see it in action, there’s a complete working example waiting for you in the LiveKit Agents GitHub repository.
Sources: Logs, metrics, and telemetry | LiveKit Docs | livekit-plugins/livekit-plugins-google/livekit/plugins/google/llm.py