Your prompts live in source code. A product manager wants to tweak the system message. That tweak turns into a pull request. The pull request waits for review. The review waits for deployment. The deployment waits for a sprint. Three days pass. The prompt change was two sentences.

If this sounds familiar, you are not alone. Most teams building on LLMs have run into the same wall. Prompts are text, not logic. But the systems around them treat every change like a code change. That mismatch costs hours and creates bottlenecks.

Langfuse solves this. It is an open-source prompt management and observability platform with 25,465 GitHub stars (and climbing fast). It pulls prompts out of your codebase, gives them version control, a playground, evaluation datasets, and production-grade caching. All in one workflow.

Let me walk through what it does, why it matters, and how to get started.


The Prompt Management Problem

Prompt engineering is not a one-shot activity. It is a continuous loop. You write a prompt, test it, ship it, monitor it, and then revise it when real-world usage reveals problems. This loop runs dozens of times per month on a mature LLM product.

Most teams handle this loop badly. Here is what typically happens:

Prompts get hardcoded. The system prompt sits in a Python file or a config YAML. Changing it means opening the repo, editing the file, committing, and deploying. Non-technical team members cannot participate.

Version history disappears. When prompts live in code, you get git diffs. But git diffs do not tell you which prompt version produced which outputs. There is no link between prompt versions and production behavior.

Testing is ad hoc. Engineers copy-paste prompts into ChatGPT or the OpenAI playground, eyeball the results, and call it tested. There is no structured evaluation. No datasets. No regression testing.

Rollbacks are painful. A bad prompt ships. You need to revert. That means another commit, another deployment cycle. Minutes of bad outputs can stretch into hours of bad outputs.

None of this scales. And none of it should be necessary.


What Langfuse Offers

Langfuse is built around three pillars that work together: prompt management, observability, and evaluation. The prompt management piece is what I want to focus on here, but it gains its real power from how it connects to the other two.

Prompt Management

Prompts live in Langfuse, not in your codebase. You create, edit, and version them through a web UI or via SDK/API calls. Your application fetches them at runtime.

Key capabilities:

  • Text and chat prompts. Langfuse supports both flat text prompts and multi-message chat prompts (system/user/assistant roles). You choose the type when you create a prompt.
  • Variable templating. Use {{variable}} syntax to inject dynamic values. The SDK compiles templates on the fly. A prompt like "Summarize this {{documenttype}} in {{wordcount}} words" becomes a reusable template with typed inputs.
  • Zero-latency caching. Prompts are cached client-side in the SDK. After the first fetch, the prompt lives in memory. The SDK uses a stale-while-revalidate pattern. When the cache TTL expires, it serves the stale version immediately and refreshes in the background. Your users never wait for a network call to fetch a prompt.
  • Fallback prompts. If both the local cache and the Langfuse API are unavailable, you can configure a hardcoded fallback. This gives you 100% availability, even during outages.

Version Control and Deployment

Every edit to a prompt creates a new version. Versions get auto-assigned IDs. On top of that, you assign labels to control which version your application uses.

Labels are flexible. Use them for environments (production, staging), tenants (customer-a, customer-b), or experiments (variant-a, variant-b). The latest label always points to the most recently created version.

Fetching a prompt by label looks like this in Python:

from langfuse import get_client

langfuse = get_client()

# Get the production version
prompt = langfuse.get_prompt("movie-critic", label="production")

# Get a specific version
prompt = langfuse.get_prompt("movie-critic", version=3)

# Get the latest version
prompt = langfuse.get_prompt("movie-critic", label="latest")

Deployment becomes a label swap. To ship a new prompt version, assign the production label to it in the UI. Your app automatically picks it up on the next cache refresh. No code change. No deployment. No engineer involvement.

Rollback is the reverse. Assign production back to the previous version. Done in seconds from the UI.

Diff view. Langfuse shows you exactly what changed between versions. This is critical for debugging. When a prompt regresses, you can compare the current version against the last known good one and spot the difference fast.

Protected labels. Project admins can lock labels so only authorized users can modify or delete them. This prevents accidental production changes and enforces review workflows.

The Playground

The Langfuse Playground lets you test prompts interactively without writing code. It connects directly to your LLM provider (OpenAI, Anthropic, Google, and others) using API keys you configure in project settings.

You can:

  • Open any managed prompt in the playground and iterate on it.
  • Compare variants side by side. Set up multiple prompt versions with different system messages, temperatures, or models. Run them all and compare outputs immediately.
  • Add variables. Inject test values for your {{variable}} placeholders to simulate real inputs.
  • Test tool calling and structured outputs. Define JSON schemas for tool calls and response formats. Validate that your prompt produces the right shape of output.
  • Save back to Prompt Management. When you land on a prompt you like, save it directly from the playground. It becomes a new version.

This tight loop between editing, testing, and saving eliminates the context-switching that kills prompt iteration speed.

Evaluation and Datasets

This is where Langfuse separates itself from simple prompt stores. Evaluation is baked in.

Datasets. Create curated sets of test inputs and expected outputs. Datasets are versioned, so you can run experiments against a frozen snapshot and get reproducible results.

Experiments. Run a prompt version against a dataset and compare results side by side. Langfuse supports both UI-based experiments (no code required) and SDK-based experiments for programmatic evaluation pipelines.

LLM-as-a-Judge. Configure automated evaluators that score outputs using another LLM. Define rubrics, scoring criteria, and thresholds. Langfuse runs the judge and records the scores.

Human annotation queues. Route uncertain or high-stakes outputs to human reviewers. They annotate directly in the Langfuse UI.

Custom evaluations. Push your own numeric, boolean, or categorical scores via the API or SDK. Plug in any external evaluator.

Linked traces. When you link a prompt to a trace, Langfuse tracks quality, cost, and latency metrics per prompt version. You can see exactly how version 5 compares to version 4 across all production traffic. This closes the loop. You change a prompt, ship it, and then measure whether it actually improved things.


Why Prompt Management Matters More Than You Think

You might read all this and think: "We just have three prompts. We don't need a whole platform for that."

Fair. But consider what happens as your LLM app matures:

Prompt count grows. A single chatbot might start with one system prompt. Six months later, it has separate prompts for summarization, extraction, classification, routing, and follow-up questions. Each has multiple versions. Each needs to work together.

Team size grows. One engineer writing prompts becomes a product team that wants to iterate on tone, format, and behavior. Non-technical stakeholders need to participate in prompt iteration without filing Jira tickets for every two-word change.

Compliance requirements appear. You need to know which prompt version was active at a specific date. You need audit trails. You need rollback capability. These are table stakes for regulated industries.

Cost and quality drift. A prompt change that makes outputs 10% longer can increase your API costs by 10% or more. Without version-linked metrics, you discover this weeks later in a billing report instead of hours later in a dashboard.

Prompt management is not a nice-to-have. It is infrastructure. The same way you would not run a database without backups or a web service without monitoring, you should not run an LLM app without prompt versioning and observability.


Getting Started: A Practical Walkthrough

Option 1: Langfuse Cloud (fastest)

  1. Sign up at cloud.langfuse.com. EU and US regions available.
  2. Create a project. Generate API keys in project settings.
  3. Install the SDK:
pip install langfuse
  1. Set environment variables:
LANGFUSE_SECRET_KEY="sk-lf-..."
LANGFUSE_PUBLIC_KEY="pk-lf-..."
LANGFUSE_BASE_URL="https://cloud.langfuse.com"  # or us.cloud.langfuse.com
  1. Create your first prompt:
from langfuse import Langfuse

langfuse = Langfuse()

langfuse.create_prompt(
    name="support-classifier",
    type="chat",
    prompt=[
        {"role": "system", "content": "You are a {{tone}} support agent for {{company}}."},
        {"role": "user", "content": "Classify this request: {{user_message}}"},
    ],
    labels=["production"],
)
  1. Use it in your app:
prompt = langfuse.get_prompt("support-classifier")

# Compile with variables
messages = prompt.compile(tone="friendly", company="Acme Corp", user_message="My order is late")

# Pass to your LLM
response = openai.chat.completions.create(
    model="gpt-4o",
    messages=messages,
)

That is it. Your prompt is now managed, versioned, and cached.

Option 2: Self-Hosted (full control)

Langfuse is open source. You can run it on your own infrastructure with Docker.

  1. Clone the repository:
git clone https://github.com/langfuse/langfuse.git
  1. Follow the self-hosting docs. The standard deployment uses Docker Compose with PostgreSQL and Redis.
  1. Configure your environment variables and start the services.
  1. Access the UI at your configured host. Create projects and API keys just like cloud.

Self-hosting gives you full data sovereignty. Your prompts and traces never leave your network. The trade-off is operational overhead. You manage updates, backups, and scaling yourself.

Using the JS/TS SDK

The JavaScript SDK works the same way:

npm i @langfuse/client
import { LangfuseClient } from "@langfuse/client";

const langfuse = new LangfuseClient();

// Create a prompt
await langfuse.prompt.create({
  name: "support-classifier",
  type: "chat",
  prompt: [
    { role: "system", content: "You are a {{tone}} support agent for {{company}}." },
    { role: "user", content: "Classify this request: {{user_message}}" },
  ],
  labels: ["production"],
});

// Fetch and compile
const prompt = await langfuse.prompt.get("support-classifier");
const messages = prompt.compile({ tone: "friendly", company: "Acme Corp", user_message: "My order is late" });

Linking Prompts to Traces

This is the step most people skip. Do not skip it.

Linking prompts to traces means every LLM call in production records which prompt version produced it. This gives you per-version metrics for cost, latency, and quality.

In Python:

from langfuse import observe, get_client

langfuse = get_client()

@observe(as_type="generation")
def call_llm(user_input):
    prompt = langfuse.get_prompt("support-classifier")
    langfuse.update_current_generation(prompt=prompt)
    # your LLM call here

Once linked, navigate to your prompt in the Langfuse UI and click the Metrics tab. You will see charts broken down by version. This is how you know whether version 7 is actually better than version 6.


The Workflow in Practice

Here is what a mature prompt iteration cycle looks like with Langfuse:

  1. Product identifies a problem. Support classification accuracy dropped from 94% to 89% last week.
  1. Engineer opens Langfuse. Checks the Metrics tab on the classifier prompt. Sees the drop started when version 5 shipped.
  1. Engineer opens the diff. Compares version 5 to version 4. Spots that a system message change made the prompt too permissive.
  1. Engineer creates version 6 in the UI. Rewrites the system message. Opens it in the playground. Tests with representative inputs. Results look good.
  1. Engineer runs an experiment. Points version 6 at the evaluation dataset. Compares scores against version 5. Accuracy improves across the board.
  1. Engineer ships version 6. Assigns the production label to version 6. The app picks it up on the next cache refresh. No code deployment. No pull request.
  1. Team monitors. The Metrics tab shows the accuracy recovering over the next 24 hours. Cost per request stays flat. Latency is unchanged.
  1. If version 6 caused a problem, the engineer assigns production back to version 4. Rollback in under 10 seconds.

This cycle took hours instead of days. The product manager could review the prompt change in the UI without understanding git. The engineer never touched the application code. And every decision was backed by data, not guesswork.


Integrations

Langfuse connects to the tools you already use:

  • OpenAI SDK (Python and JS) via @langfuse/openai and langfuse.openai
  • LangChain via callback handlers
  • Vercel AI SDK
  • LiteLLM for multi-provider routing
  • 50+ framework integrations including LlamaIndex, Haystack, CrewAI, and AutoGen
  • OpenTelemetry for vendor-neutral tracing

Prompt management works across all of these. Fetch a prompt from Langfuse, compile it, and pass it to whichever framework or SDK you prefer.


Open Source and the Ecosystem

Langfuse is MIT-licensed and actively maintained. The GitHub repository has 25,465 stars and 2,547 forks. It is a YC W23 company with a sustainable open-core model. The open-source version is full-featured. Enterprise add-ons cover features like SSO, audit logs, and advanced RBAC.

The community is active. There are GitHub Discussions for Q&A, a public roadmap where you can request features, and regular changelog updates. Recent releases include versioned dataset experiments, protected prompt labels, and Cursor plugin support for agentic prompt migration.


When You Should Start Using It

Start now if any of these are true:

  • You have more than three prompts in your codebase
  • Non-engineers want to edit prompts
  • You have shipped a prompt change that broke production
  • You cannot answer the question "which prompt version caused the regression?"
  • You are manually copying prompts between ChatGPT and your code
  • Your prompt iteration cycle takes more than a day

Langfuse is free to self-host. The cloud tier has a generous free plan for small teams. The SDKs are lightweight and the integration is minimal. You can get prompts managed in under an hour.


Final Thought

The LLM application stack is still young. We are all figuring out the right abstractions. But one thing is already clear: prompts are not code. They are configuration. They are content. They are product decisions that change frequently and need fast feedback loops.

Treating them like code works for a prototype. It breaks at production scale. Langfuse gives prompts the infrastructure they deserve: version control, deployment workflows, testing, observability, and evaluation. All in one place. All open source.

25,465 stars agree. Maybe it is time to see what the fuss is about.


Langfuse is available at github.com/langfuse/langfuse. Docs at langfuse.com/docs. Cloud signup at cloud.langfuse.com.