Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.
Langfuse + Burr
This shows how to trace a Burr application to Langfuse
using the LangfuseBridge hook.
What gets logged:
- One Langfuse trace per application execution call (
run/step/iterate/stream_result/...) - One span per step, with the action's inputs/read state as observation input and its result/written state as observation output
- One span per span opened through Burr's tracing API (
__tracer) - Attributes logged via
__tracer.log_attribute(s)as observation metadata - Burr's
app_idmaps to the Langfuse session andpartition_keyto the Langfuse user (both overridable)
If you also install an OpenTelemetry LLM instrumentor (e.g.
opentelemetry-instrumentation-openai), LLM calls show up as generations nested
inside the corresponding Burr steps, with prompts/completions/token usage.
Running
pip install "apache-burr[langfuse]" openai opentelemetry-instrumentation-openai
export LANGFUSE_PUBLIC_KEY="pk-lf-..."
export LANGFUSE_SECRET_KEY="sk-lf-..."
export LANGFUSE_HOST="https://cloud.langfuse.com" # or your self-hosted URL
export OPENAI_API_KEY="sk-..."
python application.py
Then open your Langfuse project -- you will see one trace per .run() call, with
the step spans, tracer spans, and (if instrumented) OpenAI generations nested inside.
See application.py for the full code, and the
integration docs for
configuration options (custom session/user IDs, disabling state capture, passing
your own Langfuse client).
Note on langfuse v4+
Langfuse SDK v4+ only exports LLM-relevant spans by default. LangfuseBridge
handles this automatically when it constructs the client. If you construct the
Langfuse client yourself, pass the provided filter:
from langfuse import Langfuse
from burr.integrations.langfuse import LangfuseBridge, burr_span_export_filter
client = Langfuse(should_export_span=burr_span_export_filter)
bridge = LangfuseBridge(langfuse_client=client)