← Back to changelog
July 4, 2024

Query Traces via SDKs

Picture Marc KlingenMarc Klingen

The Langfuse Python and JS SDKs now support fetching traces and observations from the Langfuse API. Use them for custom analysis, few-shotting or fine-tuning workflows.

Since the very beginning, all Langfuse Tracing data has been open and accessible via the Langfuse API. Today, we're excited to finally release the SDK methods to conveniently query traces, observations, and sessions directly from the Langfuse API.

pip install langfuse
from langfuse import Langfuse
langfuse = Langfuse()
 
# Fetch list of traces, supports filters and pagination
traces = langfuse.fetch_traces()
 
# Fetch a single trace by ID
trace = langfuse.fetch_trace("traceId")
 
# Fetch list of observations, supports filters and pagination
observations = langfuse.fetch_observations()
 
# Fetch a single observation by ID
observation = langfuse.fetch_observation("observationId")
 
# Fetch list of sessions
sessions = langfuse.fetch_sessions()

See docs to learn more.

Was this page useful?

Questions? We're here to help

Subscribe to updates