All guides

TRACEYou commented this keyword

Langfuse

An open-source platform that records every call your AI app makes, so you can debug it, manage prompts and run evaluations.

Before you start:
  • An AI app you are building
  • Python (for the quickstart)
  • A Langfuse Cloud account or Docker to self-host
Setup
15 min
Level
Intermediate
Stars
35.4k
License
MIT (except ee folders)

What it does

Langfuse is for people building their own AI applications. It records traces: a step-by-step log of every model call, retrieval and agent action your app makes, so you can see what went wrong and why.

It also lets you store and version your prompts in one place, test them in a playground, build test datasets and score results. It is not a Claude add-on; you connect it to your own code.

Install it

  1. Create a free Langfuse Cloud account (no credit card required), or self-host it with Docker using the command in the second block.
  2. Create a new project, then create API credentials in the project settings.
  3. Install the Python packages with the first block below.
  4. Put your keys in a .env file: LANGFUSE_SECRET_KEY, LANGFUSE_PUBLIC_KEY and LANGFUSE_BASE_URL (https://cloud.langfuse.com for the EU region, https://us.cloud.langfuse.com for the US).

Install the Python SDK

Terminal
pip install langfuse openai

Or self-host on your computer

Terminal
git clone --depth=1 https://github.com/langfuse/langfuse.git
cd langfuse
docker compose up

Use it

  1. Add the @observe() decorator from langfuse to the functions you want to trace. The README quickstart shows a full example with OpenAI.
  2. Run your app, then open your Langfuse project to see each call as a trace.
  3. Using another model or framework? The Langfuse docs cover the SDKs and integrations such as LangChain, LlamaIndex, LiteLLM and the Vercel AI SDK.

Good to know

The README quickstart uses OpenAI. It has no Claude-specific setup; see the docs for other model providers. If you self-host with Docker, set up log rotation so container logs do not fill your disk.

Links

Want the next one first?

One new guide a week, straight to your inbox.

More like this