Skip to main content

Langfuse product overview

Langfuse Python SDK

MIT License CI test status PyPI Version GitHub Repo stars Discord YC W23

The Langfuse Python SDK covers the full platform: observability/tracing (OpenTelemetry-based, with OpenAI and LangChain integrations), datasets & experiments (offline evaluation and regression testing of prompt/model changes, including CI via GitHub Actions), LLM-as-a-judge and custom evaluations/scores, prompt management, and a full REST API client.

Installation

pip install langfuse

Quickstart

# env: LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, LANGFUSE_BASE_URL

from langfuse import get_client

langfuse = get_client()

# Create a span using a context manager
with langfuse.start_as_current_observation(as_type="span", name="process-request") as span:
    # Your processing logic here
    span.update(output="Processing complete")

    # Create a nested generation for an LLM call
    with langfuse.start_as_current_observation(as_type="generation", name="llm-response", model="gpt-5.6") as generation:
        # Your LLM call logic here
        generation.update(output="Generated response")

# All spans are automatically closed when exiting their context blocks


# Flush events in short-lived applications
langfuse.flush()

Docs

Metadata

Release files for langfuse 4.15.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langfuse 4.15.4
File Size Uploaded Provenance Actions
langfuse-4.15.4.tar.gz 392.3 kB Without provenance Details for langfuse-4.15.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langfuse 4.15.4
File Interpreter ABI Platform Actions
langfuse-4.15.4-py3-none-any.whl Python 3 none any Details for langfuse-4.15.4-py3-none-any.whl

Total release size: 1.1 MB

Release files / langfuse-4.15.4.tar.gz

Download URL langfuse-4.15.4.tar.gz
Size 392.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b9a36194f4e968206d919313c24ea71c6ea68e21286370b01de752d20b26e7a3
BLAKE2b-256 checksum
How to use checksums
b30cccb04968d47896e9eb7421b6e2e6e8cd510d8fa3e79337092dc734f25543
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / langfuse-4.15.4-py3-none-any.whl

Download URL langfuse-4.15.4-py3-none-any.whl
Size 706.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e75c70b1522a722a11ab6c7d88e27534a5d0c3844a1a464ac5eb548b014e9c3
BLAKE2b-256 checksum
How to use checksums
97bd8e0cadd69d0855646eda8d584ef4f38ca46cf271553af8ba7f93ae607626
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for langfuse 4.15.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

4.15.4 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page