Using Langfuse prompts in Promptfoo evaluations

Point Promptfoo at the Langfuse prompt versions you ship so evaluations and red-team runs test what production actually uses. This page covers the langfuse:// reference, variable mapping, CI gating and the failure points to plan for.

On this page

Using Langfuse prompts in Promptfoo evaluations without copying prompt text

Keep the Langfuse prompt as the only copy that evaluations read. When prompt text lives in a self-hosted Langfuse and also in a Promptfoo config, the two copies drift apart the first time someone edits one and forgets the other, and the evaluation then passes or fails against a prompt nobody deploys. Promptfoo can reference Langfuse-managed prompts directly with the langfuse:// prefix followed by the prompt name and version, so the config points at a prompt rather than containing one. Promptfoo test variables are inserted into the Langfuse prompt's variables, which means each test case supplies inputs while the instructions, templates and structure stay under Langfuse versioning.

Before you rely on this pattern, confirm three things in your own environment: that your Promptfoo version supports the langfuse:// reference in the version you pin in CI, that the Langfuse host and API keys in the Promptfoo environment point at your self-hosted instance, and that the variable names in each test match the variable names defined in the Langfuse prompt exactly. A mismatch is the most common way this setup fails quietly. The Langfuse Promptfoo integration page sets out the configuration details, and that page should be the reference for the exact syntax.

Promptfoo runs on the machine or CI runner where you start it and calls the model provider directly, so prompt text and test data travel from that runner to the model endpoint, not through a Promptfoo service. Decide which runners hold the Langfuse API keys and which model credentials they can reach, and scope those keys to the project that owns the prompt. The Langfuse prompt remains the single source of truth: promote a version with a label, and have the evaluation resolve that version, so a change to the production prompt is tested before it ships.

What you need before connecting Promptfoo to Langfuse

The integration depends on four things lining up: a reachable Langfuse host, a project key pair, a named prompt version, and a Promptfoo runtime that can call your model providers. Confirm each one before writing the first config, because a missing piece usually surfaces as a failed fetch in CI rather than a clear error.

Self-hosted Langfuse instance and API keys

Promptfoo reads prompts from the Langfuse host you operate, so the instance must already be running and serving the prompts you intend to test. Create a project API key pair in the Langfuse UI and keep the public and secret keys in your secret store, not in the repository. Confirm the keys belong to the project that holds the prompt, since keys are scoped to a project.

Langfuse Promptfoo docs

A prompt with a stable name and version

The langfuse:// reference points to a prompt by name and version or label, so the test run is only meaningful if that reference is fixed. Decide whether CI pins a numeric version or a label such as production, and record which one. Check that the prompt's variables match the variable names your Promptfoo test cases will supply, because mismatches produce empty or wrong prompts without failing the run.

Node.js 22.22.0 or newer

The current promptfoo npm release, 0.124.1, requires Node.js 22.22.0 or newer, so the CI image and any developer workstation must meet that floor. Pin the Node version in your CI configuration to avoid silent drift when runner images change. Run the CLI once locally with the same version to confirm the install before debugging anything in the Langfuse integration.

promptfoo on npm

Network path to the Langfuse host

The runner that executes the CLI must reach your Langfuse host over HTTPS, and the Langfuse host must accept requests from that runner's network. Hosted CI runners often sit outside a private network, so confirm whether they need an allowlist entry, a VPN, or a self-hosted runner inside your environment. Test the path with a simple authenticated request before the first evaluation run.

Model provider credentials in CI secrets

Promptfoo calls the model providers directly, so the evaluation runner needs the provider API keys in addition to the Langfuse keys. Store every credential in the CI secret store, scope each to the minimum project or key needed, and mask them in logs. Promptfoo runs locally on the machine that starts it, which means the runner itself is the place where these keys are exposed.

CLI as the integration path

Use the promptfoo CLI for this integration. The self-hosted promptfoo app stores data in a local SQLite database that cannot be shared across replicas, has no RBAC or built-in SSO, and is not recommended for production use. Plan your CI jobs around the CLI and its exit codes, and treat any shared web UI as a separate decision with its own review.

promptfoo self-hosting

How to wire a Langfuse prompt into a Promptfoo config

This sequence connects one versioned Langfuse prompt to a Promptfoo eval so the test run exercises the exact prompt text you plan to deploy. The result is a local eval whose rendered prompt you have checked against Langfuse.

  1. Create and label the prompt in Langfuse

    Create the prompt in your self-hosted Langfuse instance, add the variables it needs, and save it as a version with a label such as the environment you deploy to. Record the prompt name and the version number, because the Promptfoo reference depends on both. Done means the prompt appears in the Langfuse UI with the expected variables and version, and you can open that exact version and read its text.

  2. Export Langfuse keys and host as environment variables

    Create a project API key pair in the Langfuse project that holds the prompt, then export the public key, secret key and host URL of your self-hosted instance in the shell that runs Promptfoo. Keep the secret key out of the Promptfoo config file and out of version control, so the config can be committed. Done means that a quick authenticated request from the same shell returns your prompt, which confirms the keys and host point at the right project.

  3. Reference the prompt with langfuse:// in the config

    In the promptfoo configuration file, add the Langfuse prompt to the prompts list using the langfuse:// prefix followed by the prompt name and the version, as shown in the Langfuse Promptfoo documentation. Pair it with the model provider you already use for evals. Done means that Promptfoo parses the config without errors when you run its validation or dry-run command, and it lists the Langfuse prompt as a test target.

  4. Map test variables to the prompt variables

    Define the test cases in the same config with a vars block for each case. The variable names must match the variables in the Langfuse prompt exactly, because Promptfoo inserts its test variables into the Langfuse prompt variables. Start with one or two representative inputs. Done means each test case lists every variable the prompt expects, and no case leaves a placeholder unfilled.

  5. Run a single eval locally

    Run one eval from your machine with a single test case and a single provider so that any error is easy to trace. Promptfoo runs locally and calls the model provider directly, so the run needs your provider credentials in the environment. Done means the run completes and the output shows a result row for the test case, with no fetch or authentication errors from Langfuse.

  6. Confirm the rendered prompt matches Langfuse

    Open the eval output in the Promptfoo viewer or inspect the results file and find the fully rendered prompt for your test case. Compare its wording and the substituted variable values with the version you opened in Langfuse in the first step. Done means the text matches, including the version number. If it does not match, check the version reference and the label before running the full suite.

How a Promptfoo run pulls the prompt from Langfuse

The run starts on a CI runner or a workstation, where the promptfoo CLI reads the config and resolves a langfuse:// prompt reference against your self-hosted Langfuse API. Test variables are inserted into the retrieved prompt version, and the rendered prompt goes straight from the runner to the model provider. Results are written back as a local report. The check to make is the trust boundary: Langfuse and the runner stay inside your network, while the provider call crosses it.

Prompt retrieval stays inside your network, while the rendered prompt crosses to the provider.

How test variables map to Langfuse prompt variables

This table compares each element of a Promptfoo test against its Langfuse counterpart, so you can see where names must match exactly. Read it top to bottom before writing your first config, because a single mismatched variable name leaves a placeholder unrendered and the test runs against an incomplete prompt.

ElementWhere it livesWhat must matchCommon failure
Prompt referencePromptfoo config prompts entrylangfuse:// prefix, prompt name and version or label as published in LangfuseWrong name or version fails to load, so the run targets a different prompt than you intended
Test variablesPromptfoo tests vars blockKeys are inserted into the Langfuse prompt variables by nameA key spelled differently from the Langfuse variable leaves its placeholder unrendered
Langfuse prompt variablesPrompt template in LangfuseVariable names in the template, case and punctuation includedRenamed template variable without updating the Promptfoo test vars
Version or label pinPromptfoo prompt referenceExplicit version for reproducible runs, or a label such as production for the live promptA label moved to a new version silently changes what CI tests
Output checksPromptfoo assert blockAssertions read the model response that the rendered prompt producedChecks written against an unrendered or partially rendered prompt pass or fail for the wrong reason
Expected valuesPromptfoo test assert valuesExpected output matches the output format defined in the prompt version under testOutput format changed in Langfuse but assertions still expect the old format

Pinning a version or following a label in CI

The choice between an explicit prompt version and a label decides what a CI run actually proves. A pinned version in the Promptfoo config, referenced as langfuse:// followed by the prompt name and version number, fixes the exact text under test. The gate then produces the same result for the same prompt and model settings until someone edits the pin, which suits release gates and audit evidence. The cost is that a pin does not follow what is live. If the team promotes a newer version in Langfuse and forgets to update the config, CI keeps testing an outdated prompt while production serves a different one.

A label such as production works the other way. The config names the label, so each run resolves whatever version currently carries it. This keeps tests aligned with the deployed prompt without a code change, but it also means a test result can change without any commit in your repository. Use labels for smoke and regression suites that should track what users receive, and keep a small set of pinned cases for the versions you signed off. Confirm with your Langfuse and Promptfoo versions that the label syntax resolves the way your team expects before you rely on it in a gate.

A promotion in Langfuse should trigger a rerun. Wire a pipeline trigger to the event your team uses for promotion, such as an API call or webhook from the prompt management workflow, so the evaluation runs against the newly labeled version before it serves traffic. Protecting the production label in Langfuse, so only authorized roles can move it, is the control that makes this trustworthy. Protected prompt labels require a Langfuse Enterprise license key on self-hosted instances, so confirm whether your plan includes it before you design the promotion path around that control.

Running prompt checks in CI and red teaming before release

Once Promptfoo reads the Langfuse prompt version you plan to ship, the same configuration can run as a merge gate, a stored report and a scheduled red-team pass. These cards cover the decisions that connect those three uses and the limits to confirm before you rely on them.

Gating a merge on assertions

Run promptfoo eval in your CI pipeline against the prompt version your branch references, and fail the job when assertions do not pass. Decide up front which assertions block a merge and which only warn, because a blocking check that flakes will train engineers to rerun builds instead of reading failures. Pin the Langfuse prompt version in the config so a pull request tests exactly what it changes, and confirm that your CI runner can reach your self-hosted Langfuse host and the model provider.

Langfuse Promptfoo docs

Storing reports as build artifacts

Export each evaluation result as a build artifact so reviewers can see which prompt version, variables and assertions produced a failure. Keep the prompt reference and model name in the artifact metadata, since a report without them cannot be tied back to a Langfuse version later. Check your retention settings for CI artifacts, because eval outputs can contain copies of user-like inputs and model responses that your data handling rules may cover.

Scheduling red-team runs

Run red-team scans on a schedule against the prompt version currently labeled for production, not only on feature branches. A nightly or weekly job catches regressions caused by model provider changes, which a merge gate will not see because the prompt text has not changed. Record the schedule owner and the label the job reads, so a change in production labeling does not silently change what gets tested.

Probe budget on Community edition

The promptfoo Community edition includes red teaming with 10k probes per month and community support. Count probes per scheduled run and per pull request before you set job frequency, because a frequent gate plus a nightly scan can exhaust the monthly allowance early. Confirm with the vendor whether the limit applies per account or per organization, and what happens when it is reached.

Promptfoo pricing

Framing tests with OWASP and NIST

The promptfoo red-teaming documentation references the OWASP LLM Top 10 and the NIST AI Risk Management Framework as frameworks that support systematic testing before deployment. Map your red-team categories to those references so the scan results can answer governance questions about coverage. Treat the mapping as a testing structure, not as evidence of compliance, and confirm with your assessor which mapping they accept.

Promptfoo red teaming docs

Aligning tests with EU AI Act duties

The promptfoo red-teaming documentation also references the EU AI Act as a framework supporting pre-deployment testing. If your prompts feed a system in scope of that regulation, identify which obligations your test evidence would support, such as risk testing before release, and confirm the interpretation with your legal or compliance team. Keep the red-team reports, the tested prompt version and the approval record together so the evidence can be produced on request.

Why Promptfoo cannot resolve or render a Langfuse prompt

This table lists the failures that stop a Promptfoo run from loading a Langfuse prompt, with the likely cause and the fix for each. Read it top to bottom when a run errors before any model call, then check the CI row if results differ between your laptop and the pipeline.

FailureLikely causeFix
Connection refused or authentication errorWrong Langfuse host URL, or public and secret keys copied from a different project or instanceConfirm the host is your self-hosted base URL, then regenerate keys in the target project and set them in the environment Promptfoo reads
Prompt not foundThe langfuse:// reference uses a prompt name or version that does not exist in this projectCheck the exact prompt name and version or label in the Langfuse UI, then update the langfuse:// reference in the Promptfoo config
Variables render as blank or raw placeholdersPromptfoo test variable names do not match the variables defined in the Langfuse promptAlign variable names in the test cases with the Langfuse prompt, and run one test case to confirm the rendered text
Node.js error at startupNode.js older than 22.22.0 installed locally or on the CI runnerInstall Node.js 22.22.0 or newer on every machine and runner, and pin the version in the pipeline image
TLS certificate or proxy failureSelf-hosted Langfuse uses an internal certificate authority or sits behind a corporate proxy the Node.js process does not trustConfirm the CA bundle is available to Node.js and that the proxy allows the Langfuse host, then test the connection from the runner before the eval
Different results between local and CI runsDifferent Promptfoo, Node.js or SDK versions, different keys or environments, or a prompt label that moved between runsPin the Promptfoo version, reference a fixed prompt version rather than a moving label, and compare the resolved prompt text in both environments
Prompt loads but output looks wrongModel provider settings in the Promptfoo config differ from the settings used in the Langfuse playgroundCompare provider, model and parameters in both places, and record which prompt version each eval run used

Questions teams ask before connecting Promptfoo to Langfuse

How much does it cost to connect Promptfoo to Langfuse?

The Promptfoo Community edition is free and includes all LLM evaluation features, all model providers and integrations, and red teaming with 10k probes per month, with community support, according to the promptfoo pricing page. Promptfoo Enterprise and On-Premise are custom priced. Langfuse's self-hosted open source version is free to use under the MIT license, but the infrastructure is not: you pay for compute, PostgreSQL, ClickHouse, Redis or Valkey, blob storage, and the staff who run them. The Self-Hosted Enterprise plan on the Langfuse pricing page is also custom priced and adds a support SLA. Ask any quote to split one-time work (configuration, CI wiring, prompt naming) from recurring items (hosting, upgrades, retainers).

How long does a first working Promptfoo and Langfuse config take?

The duration depends mainly on how many prompts you reference, how many variables each prompt takes, and how complex your CI pipeline is. A small set of prompts with one provider and a single test suite is a short exercise. Each additional prompt version, provider matrix, red-team suite or gating rule adds configuration and review work. Ask for a written scope that lists the prompts, the labels or versions to test, the providers, and the CI system before accepting any timeline. No fixed duration is given here because none has been researched for this work.

What does the team need to provide before the work starts?

Three things unblock most engagements:

Can our internal team connect Promptfoo to Langfuse on its own?

Yes, a team with CI experience and access to the Langfuse API can do the basic connection, because the integration uses the langfuse:// prefix with a prompt name and version inside a Promptfoo config. The harder parts are deciding which prompt versions gate a release, mapping test variables correctly to Langfuse prompt variables, handling API keys in CI, and keeping red-team coverage current. Whether an internal team has the time and skills is the real question. Promptfoo's self-hosted app stores data in SQLite, has no RBAC or SSO and is not recommended for production, so an internal team that wants a shared, governed setup should plan that separately. DeployOpen can take on the whole build, a fixed-scope part of it, or a retainer for ongoing testing.

Does the promptfoo test run send our prompts and outputs to Promptfoo?

According to the promptfoo documentation, the software runs completely locally: evals run on your machine and talk directly with the LLM. That means the prompt text fetched from Langfuse and the model responses flow between your CI runner, Langfuse and your model provider. Promptfoo itself is not documented as a relay for that traffic. Confirm where your CI runners execute, which model providers receive the prompt content, and whether the Langfuse host is inside your network before you approve the design.

Do we need a Langfuse Enterprise license for this integration?

No Enterprise license is needed to reference prompts from a self-hosted Langfuse instance in a Promptfoo config, because core features and APIs are available in the MIT-licensed open source version. An Enterprise license key is needed for features such as protected prompt labels, project-level RBAC and audit logs. If you plan to protect the production label so that only approved people can change it, check the Langfuse license key documentation before the design is fixed.

Will Promptfoo's ownership change affect this setup?

OpenAI announced its acquisition of promptfoo on 9 March 2026, and the founders state that promptfoo will remain open source and continue to support a diverse range of providers and models. The software is MIT licensed, so the code you depend on can be reviewed and pinned. Pin the CLI version in your CI, record the Node.js requirement (Node.js 22.22.0 or newer for the npm release 0.124.1), and review the licensing and roadmap statements when your plan is renewed, since terms for paid tiers may change.

How DeployOpen scopes and delivers this integration

DeployOpen plans, builds, tests and hands over the Langfuse and Promptfoo wiring inside your own infrastructure, so the prompt versions your evaluations test are the ones your applications run. Engagements are fixed-scope, with the scope, deliverables and timeline agreed in writing before work starts.

How we scope

  • We confirm which Langfuse prompts, labels and versions the Promptfoo suites must reference before any config is written.
  • We document the variable mapping between Promptfoo test variables and each Langfuse prompt's variables.
  • We agree in writing which CI pipelines, red-team runs and evaluation suites are in scope, and what is excluded.

How we build

  • We configure Promptfoo to reference Langfuse prompts through the langfuse:// prefix, pinned to the versions you approve.
  • We wire evaluation and red-team runs into your CI pipeline, with secrets for both tools kept in your own secret store.
  • We confirm the Promptfoo runtime, including Node.js version, runs locally or in your environment, without sending data outside your control.

How we hand over

  • We deliver the Promptfoo configs, variable mapping notes and CI job definitions as versioned files in your repository.
  • We write a runbook covering how to add a prompt version, rerun evaluations and read failing results.
  • We walk your engineers through the suite and the retest results, so your team can extend the checks independently.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers, covering Promptfoo and Langfuse version changes.
  • We can retest the integration after prompt, model or pipeline changes, as set out in the written scope.
  • Support scope, response expectations and fees are confirmed in the written agreement rather than assumed.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.