flâneur — a map of the web's best reading

langfuse API documentation

python.reference.langfuse.com · 72,613 words · saved by 1 readers

The SDK was rewritten in v3 and released in June 2025. Refer to the v3 migration guide for instructions on updating your code. Please see our docs for detailed information on this SDK. Main client for Langfuse tracing and platform features. This class provides an interface for creating and managing traces, spans, and generations in Langfuse as well as interacting with the Langfuse API. The client features a thread-safe singleton pattern for each unique public API key, ensuring consistent trace context propagation across your application. It implements efficient batching of spans with configurable flush settings and includes background thread management for media uploads and score ingestion. Configuration is flexible through either direct parameters or environment variables, with graceful fallbacks and runtime configuration updates. Create a new span for tracing a unit of work. This method creates a new span but does not set it as the current span in the context. To create and use a spa

langfuse API documentation langfuse Langfuse Python SDK — observability, evaluation, and prompt management for LLM applications. Capabilities: Tracing / observability : @observe decorator, Langfuse.start_observation / start_as_current_observation context managers, OpenTelemetry-based; integrations for OpenAI ( langfuse.openai ) and LangChain ( langfuse.langchain.CallbackHandler ). Trace attributes : propagate_attributes (top-level function) sets user_id, session_id, tags, and metadata on all spans in a context. Datasets & experiments : Langfuse.get_dataset , Langfuse.run_experiment for offline

Explore this link on the map →

related reading