Installation
Before configuring Langfuse, you must install the
langfuse package. Langfuse is included as an optional dependency in the monitoring extra group.langfuse package, you will see an error message indicating that Langfuse is not available, and the integration will not be configured.
Configuration
Langfuse is configured through theendpoints.yml file by adding a langfuse entry to the tracing section.
You can configure multiple tracing backends simultaneously (e.g., both Langfuse and Jaeger).
Here is a basic configuration example:
endpoints.yml
Configuration Options
public_key and private_key must be set as environment variables, and in your endpoints.yml file, you reference them using the ${ENV_VAR_NAME} syntax. For example:
- Set the environment variables in your shell or deployment environment:
- Reference these variables in your
endpoints.yml:
endpoints.yml
Multiple Tracing Backends
You can configure both Langfuse and other tracing backends (like OTLP) simultaneously:endpoints.yml
Sampling
sample_rate applies to every tracing backend in the process, not only to
Langfuse. When endpoints.yml also configures an OTLP collector or Jaeger,
that backend receives the same sampled subset of traces. Rasa decides once per
trace, from its trace ID, so a trace is never split between backends. A value
that is not a number from 0 to 1 is logged and ignored, and every trace is
kept. Sampling across backends applies in Rasa Pro 3.23 and later.
Rasa span content
Rasa also sends its own tracing spans to Langfuse, such as the voice call spans. By default, Langfuse receives these spans without their content. Rasa removes voice transcripts, spoken text, prompts, tool arguments and results, and exception messages and stack traces. An error status keeps only the exception class name. Setcapture_content: true on the Langfuse entry to send that
content:
endpoints.yml
capture_content is not set, the deprecated RASA_VOICE_CAPTURE_CONTENT
environment variable turns content on instead. An explicit capture_content: false takes precedence over the variable. Content capture for Langfuse applies
in Rasa Pro 3.23 and later. The LLM generations listed under
Trace Contents keep their input and output either way.
Traced Components
When Langfuse is configured, the following components automatically send traces:LLM-Based Components
- Command Generators: All LLM-based command generators that generate dialogue commands
- Contextual Response Rephraser: Components that rephrase responses using LLMs
- Enterprise Search Policy: Policy that uses LLMs to generate responses from search results
- ReAct Sub Agent: MCP-based sub agents that use LLMs for reasoning and tool execution
- LLM-Based Router: Components that route conversations using LLMs
Embedding Operations
- Flow Retrieval: Semantic search operations when retrieving relevant flows
- Enterprise Search Policy: Vector search operations when finding relevant documents
Trace Contents
Each trace sent to Langfuse includes the following information:Standard Trace Data
- Timestamp: When the LLM or embedding call was made
- Input: The prompt or query sent to the LLM/embedding model
- Output: The response or embedding vector returned
- Latency: Time taken for the request to complete
- Token Usage: Number of prompt tokens, completion tokens, and total tokens used
- Cost: Calculated cost based on token usage and model pricing
Metadata
Each trace includes rich metadata to help you organize and filter traces:- Session ID: The conversation session identifier
- Tags: Component name for easy filtering (e.g.,
EnterpriseSearchPolicy,CompactLLMCommandGenerator) - Custom Metadata: A dictionary containing:
- Component Name: The class name of the component making the call
- Agent ID: The ID of the agent
- Model ID: The ID of the trained model being used
- ReAct Sub Agent Name: (For ReAct sub agents) The name of the sub-agent
Customizing Metadata
Custom components can override theget_llm_tracing_metadata() method to customize the metadata sent with each trace.