promptfoo with Langfuse prompt management

Teams that keep prompts in Langfuse can run promptfoo evals against those prompts without moving prompt ownership. This page covers the optional client SDK, the keys it needs, version and label references, and how to split responsibilities between the two tools.

On this page

How promptfoo with Langfuse prompt management keeps prompts in one place

A team that edits prompts in Langfuse still needs a regression check every time a prompt changes, because a wording tweak that improves one case can break another. promptfoo can load prompts from Langfuse, and Langfuse stays the prompt source while promptfoo runs the tests. The prompt text, its versions and its labels remain owned and edited in Langfuse. promptfoo reads the version or label your config points to, applies it to your test cases and grades the outputs, so the same prompt you ship is the one under test.

The supported route is the promptfoo Langfuse integration. The @langfuse/client SDK is not installed by default, so you install it alongside promptfoo on the runner, then set LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY in the environment where promptfoo runs. Those keys let the SDK fetch prompts from your Langfuse project. Check the promptfoo Langfuse integration docs for the exact reference format and the current SDK version before you pin dependencies, since the integration depends on both packages.

What stays on the runner is the evaluation itself: the test cases, assertions, grading configuration, model provider credentials and the results promptfoo writes. The integration does not move prompt ownership out of Langfuse, and it does not give promptfoo authority to edit prompts there. Decide in advance who may publish a new version or move a production label, because the eval passes or fails against whatever Langfuse serves. Confirm with your security team where the Langfuse keys are stored on the runner, since a secret key that can read prompts should be treated as a credential with the same care as your model keys.

What you need before connecting promptfoo to Langfuse

Connecting promptfoo to Langfuse involves a runtime, two packages, a Langfuse project with prompts and a key pair, and a network path from wherever evals run. Each item is independent, so the team can prepare them in parallel, but all of them must be in place before the first prompt loads. Confirm each one in the environment that will run the evals, including CI runners.

Node.js runtime version

promptfoo's current npm release requires Node.js 22.22.0 or newer, so check the version on every machine and CI image that runs evals, not only on a developer laptop. Older runner images often pin an earlier Node.js line, and a mismatch will fail before any prompt is fetched. Record the version in your pipeline configuration so the requirement stays visible when images are updated. Ask the team that owns the runner images to confirm which version they provide.

promptfoo on npm

promptfoo installed in the runner

Install promptfoo as a dependency or globally in the environment that runs the evaluation, and pin the version so a prompt test result can be reproduced later. The Langfuse loader is part of the promptfoo config, so a version that predates your Langfuse setup may not behave as the documentation describes. Confirm the pinned version against the Langfuse integration page before you write the config.

promptfoo Langfuse docs

The @langfuse/client package

The @langfuse/client SDK is not installed with promptfoo by default, so it must be added next to promptfoo in the same project or image. Without it, the Langfuse prompt reference will not resolve and the run stops with a missing-module error. Treat it as a dependency to lock and update with the rest of your Node.js packages, and confirm that its version works with the Langfuse host you plan to query.

A Langfuse project with prompts

Create or choose the Langfuse project that owns the prompts, and make sure each prompt the eval will reference already exists with the versions or labels you plan to test. promptfoo reads prompts from Langfuse and does not create them, so an empty project produces no test input. Decide who edits those prompts in Langfuse, because a label change alters what the next run tests.

A key pair scoped to the project

Generate a public and secret API key pair from the Langfuse project that holds the prompts, then provide them to promptfoo as LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY. Store the secret key in your CI secret store or a vault, never in the config file or repository, and rotate it on the schedule your security team sets. Confirm with the Langfuse administrator that the key can read prompts and cannot write to other projects.

Langfuse license key docs

Network path and Langfuse version

The runner must reach the Langfuse host over HTTPS, whether that is Langfuse Cloud or a self-hosted instance. A self-hosted instance inside a private network is often unreachable from hosted CI runners, so plan an allowed route, a self-hosted runner in the same network, or a relay. Also confirm with the platform owner which Langfuse version and host URL the environment uses, since upgrades can change the API your evals depend on.

Langfuse self-hosting

How to configure promptfoo to read prompts from Langfuse

This sequence takes a team from a working promptfoo install to a first eval that runs against a prompt held in Langfuse, with Langfuse remaining the single source of prompt text.

  1. Confirm Node.js and promptfoo versions

    The engineer responsible for the eval runner checks the Node.js version and the promptfoo version on the machine or CI image that will run evals. promptfoo's npm release 0.124.1 requires Node.js 22.22.0 or newer, so run node --version and npx promptfoo@latest --version and compare both against those minimums. Done means both commands return versions that meet or exceed the requirement, and the versions are recorded in the team's runbook so later upgrades can be traced.

  2. Install the Langfuse client beside promptfoo

    In the project that holds the promptfoo config, the engineer installs the Langfuse client SDK as a dependency next to promptfoo, since promptfoo does not install @langfuse/client by default. Run npm install @langfuse/client in the same directory where promptfoo is installed, then confirm it resolves with npm ls @langfuse/client. Done means the package appears in the dependency tree with no peer dependency errors, and the lockfile is committed so every runner gets the same version.

  3. Create a project-scoped Langfuse key pair

    A Langfuse project owner creates an API key pair scoped to the project that holds the prompts, in the Langfuse project settings. Use a key for the evaluation runner rather than a personal key, and record which project it belongs to. Done means the owner has a public key and a secret key for that project only, and the secret is stored in the team's secrets manager, not in a chat thread or a repository. Confirm the key scope matches the project where the prompts live, since a key from another project will load nothing.

  4. Set Langfuse keys in the runner environment

    The engineer sets LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY as environment variables on the machine or CI job that runs promptfoo, pulling values from the secrets store. Keep both values out of promptfooconfig.yaml and out of any committed .env file. Done means printenv shows both variables in the runner shell and git grep for the key values returns nothing in the repository.

  5. Reference a Langfuse prompt in the config

    The engineer points the promptfoo config at a prompt stored in Langfuse by adding the Langfuse prompt reference to the prompts section. Before writing the reference, confirm the exact syntax for selecting a prompt by version or by label in the promptfoo Langfuse integration documentation, since the reference format is what determines which prompt text is loaded. Keep the provider and test cases unchanged for this first run. Done means the config validates and names one prompt reference with an explicit version or label chosen by the team.

  6. Run one eval against the Langfuse prompt

    The engineer runs a single promptfoo eval with the config from the previous step, using a small test set so output is short and easy to read. Run npx promptfoo eval and open the output or npx promptfoo view to inspect the rendered prompt. Done means the run completes and the prompt text shown in the results matches the text in the Langfuse prompt version or label that was referenced. If the prompt text does not match, check the reference syntax first, then the project the key belongs to.

  7. Prove the keys are read

    As a negative check, the engineer unsets LANGFUSE_SECRET_KEY in a shell and runs the same eval again. A correctly configured setup fails to load the prompt, which shows that the runner reads the keys from the environment and that the eval does not rely on a cached or hardcoded copy. Restore the variable afterward and rerun the eval to confirm it passes. Done means the failing run is recorded, the restored run matches the Langfuse text, and the team knows that Langfuse stays the prompt source of record.

How a promptfoo run reads a Langfuse prompt and tests it

The run starts when an engineer or CI job launches promptfoo on a runner. Promptfoo uses the LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY values, read from the runner's environment, to request the prompt from the Langfuse API by version or label. Langfuse returns the prompt text, and the test inputs then go to the model under test. Grading happens locally on the runner. Check that the keys are scoped to the right Langfuse project and that the runner, not Langfuse, holds the model provider credentials.

Prompt retrieval crosses a trust boundary, while tests and grading stay on the runner.

Referencing Langfuse prompts by version or label

Referencing a specific prompt version tells promptfoo to load one fixed revision from Langfuse each time the config runs. The prompt text stays the same until someone deliberately changes the reference, so the eval history reflects changes in your models, test cases, assertions or provider settings rather than changes in the prompt. This is the better choice when you need a baseline that you can rerun during an audit, a model migration or an incident review.

  • Repeatable baselines: Results from two runs with the same version number can be compared directly, because the prompt text is identical.
  • Deliberate promotion: A new version reaches the eval only after someone edits the config, which creates a reviewable record in version control.
  • Stale risk: A pinned version can keep testing a prompt that production has already moved past, so schedule reviews of the pinned reference.
  • Rollback evidence: Keeping the old version number in the config lets you rerun the earlier prompt against current models.
  • Confirm the syntax: Check the exact version reference format in the promptfoo Langfuse integration documentation before you commit configs.

Pinned versions suit the release gate in pipelines. Confirm in your own environment how Langfuse version numbers map to the prompts your application actually loads.

Which system owns each piece of the prompt workflow

This table maps each artifact in a Langfuse-managed prompt workflow to the system that owns it, the role it plays in the eval, and who edits it. Read the last column to see the split: prompt wording changes in Langfuse, while test definitions and provider settings change in the repository.

Artifact or conceptOwned byRole in the evalWho edits it
Prompt text and versionsLangfuseSource of the prompt body that promptfoo loads at run time, pinned by versionPrompt authors and reviewers in the Langfuse UI or API
Prompt label (for example, a production or staging label)LangfuseSelects which prompt version a config resolves to when it references a label instead of a version numberPrompt owners who move labels between versions
Test cases and assertionspromptfoo config in the repositoryDefines inputs, expected behavior and graders that every prompt version must passEngineers and QA reviewing changes through pull requests
Model under test and provider settingspromptfoo config in the repositoryChooses the model, parameters and endpoint that generate outputs for the promptEngineers responsible for model selection and cost
LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEYCI secret storeAuthenticate promptfoo's Langfuse client when it fetches prompts; never committed to the repositoryPlatform or security team who rotates and scopes the keys
Eval resultsLocal output or CI artifactsRecord pass and fail outcomes per prompt version for review and comparisonRead by reviewers; generated by the run, not edited

Keeping Langfuse as the single prompt source while promptfoo runs the tests

promptfoo reads prompts from Langfuse at run time and does not write changes back. Langfuse stays the place where prompts are edited, reviewed and versioned, and promptfoo is the consumer that tests whatever version it fetches. Teams should agree on this split before the first run, because it determines who owns a prompt change. Editors work in Langfuse, reviewers approve changes there, and the test configuration in the repository holds only the reference to the prompt and the assertions that judge its output. Nobody should copy prompt text into a promptfoo file as a shortcut, since that creates a second source that drifts from Langfuse.

Because promptfoo loads a specific prompt version or label on each run, an eval result describes only the version it loaded. A passing run for a prompt labeled production says nothing about a newer draft, and a result recorded without the version is hard to interpret later. CI runs should therefore record the prompt reference used, including the version or label, alongside the commit and model settings. Confirm with your own setup how the reference appears in the output and whether your pipeline stores it, since the report format is the part teams most often leave unplanned.

The same mechanism creates a risk: a prompt change in Langfuse can alter future test results without any code change. A label moved to a new version, or an edit to a version a config points at, changes what the next scheduled or pull request run evaluates. Teams should decide who may move labels that CI depends on, and whether the labels used for testing are protected in the self-hosted deployment, which requires an Enterprise license key according to Langfuse's license documentation. Reviewing the promptfoo Langfuse integration docs for the exact reference syntax before you set these rules is the natural next step.

Security settings for the promptfoo and Langfuse connection

The promptfoo and Langfuse connection touches three systems: the Langfuse host that holds your prompts, the CI runner that holds the keys, and the model providers that receive prompts and test inputs. The cards below cover the controls that keep each of those boundaries deliberate, and the checks to confirm before the first pipeline run.

Project-scoped key pair with least access

Langfuse keys are issued per project, so create the key pair for the single project that holds the prompts promptfoo will test, not an organization-wide credential. Scope the pair to read what the evaluation needs. Record who created the pair and which runner uses it, and rotate it when a team member leaves or when a CI runner is replaced. Confirm with your Langfuse administrator how key creation and revocation are logged in your deployment.

Langfuse license key docs

Keys in the CI secret manager only

Set LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY as masked secrets in your CI system's secret store. Never place them in the promptfoo config file or the repository. Config files are committed, copied into reports and shared between reviewers, so a key in them is effectively published. Check that pull requests from forks cannot read these secrets and that job logs do not echo environment variables.

promptfoo Langfuse docs

Runner access to the Langfuse host

A self-hosted Langfuse host should accept API traffic only from the runners that run promptfoo. Restrict network paths to the Langfuse web endpoint with firewall rules, private network placement or an allow list, and confirm which runner pools can reach it. Hosted runners outside your network will need a different path. Review this with your platform team, because the Langfuse deployment itself is a set of services (web, worker, PostgreSQL, ClickHouse, Redis or Valkey and blob storage) that should not be exposed broadly.

Protected labels, RBAC and audit logs

Self-hosted Langfuse lists project-level RBAC roles, protected prompt labels and audit logs among features that need an Enterprise license key. If your evaluation prompts are production prompts, plan these before go-live. Protected labels stop unreviewed edits to the version your pipeline references, RBAC limits who can change prompts, and audit logs show who changed them. Ask your Langfuse vendor or license contact which of these your edition includes, and confirm before you rely on them.

Langfuse license key docs

Data handling at the model providers

promptfoo runs locally and talks directly to the model providers under test, so prompts, test inputs and model responses leave your runner for those providers. Langfuse is not the only data path to review. Check each provider's data retention, training and region terms against the data your test cases contain. Use synthetic or masked test inputs where production data is not required, and confirm with your privacy and compliance teams which providers are approved for this data.

promptfoo introduction

Common failures when promptfoo cannot load a Langfuse prompt

This table maps each failure symptom to its likely cause and the check to run next. Read it top to bottom when a run stops before any test executes, since the first rows usually fail earliest. The main takeaway is that most failures trace to the runner environment, not to the prompt itself.

SymptomLikely causeFix and next check
Prompt load fails with a missing module error for the Langfuse clientThe @langfuse/client SDK was not installed alongside promptfoo, and it is not included by defaultInstall @langfuse/client in the same project as promptfoo, then rerun the eval with the same config to confirm the load step passes
Authentication error when fetching the promptLANGFUSE_PUBLIC_KEY or LANGFUSE_SECRET_KEY is unset, misspelled or missing in the CI runnerPrint which variable names are present in the runner (not their values), then add both secrets to the pipeline's secret store and scope them to the job
Prompt not found, although it exists in the Langfuse UIThe keys belong to a different Langfuse project or host than the one holding the promptConfirm the project shown for the key pair matches the prompt's project, and confirm the host URL points to the same Langfuse instance where the prompt was saved
Connection timeout or refused connection in CI onlyA self-hosted Langfuse host is not reachable from the CI network, although it works from a laptopTest connectivity from the runner to the Langfuse host on its HTTPS endpoint, then check network routes, egress rules and proxy settings with your platform team
Prompt loads locally but the version or label reference fails in CIThe version number or label in the config does not match an existing prompt version in LangfuseOpen the prompt in Langfuse, list its versions and labels, and correct the reference in the config to a value that exists in that project
Promptfoo fails to start or reports unsupported syntaxThe Node.js runtime is older than the version promptfoo requiresRun node --version in the runner, compare it with the promptfoo release notes, and upgrade the runner image before retrying
Pass rate drops or baseline comparison shifts with no code changeSomeone moved a label, such as production, to a new prompt version in Langfuse, so the same reference now resolves to different textCheck the label history in Langfuse, pin the baseline to a fixed version number, and record which version each stored result used

What buyers ask about cost, effort and running this integration

Is the promptfoo Langfuse integration free to use?

The tooling itself is free to use: promptfoo's Community edition is free and includes all LLM evaluation features, all model providers and integrations, and red teaming with 10k probes per month, according to the promptfoo pricing page. Langfuse's core features and APIs are available in its MIT-licensed open source version without limits. Costs come from the infrastructure you run, the model API calls your evals make, and any paid support or Enterprise licensing you choose. Ask for a written scope that separates one-time setup from recurring hosting and support.

What drives the effort of connecting promptfoo to Langfuse?

Effort rises with four things: where Langfuse is hosted, how many prompts you need to reference, how the CI pipeline is wired, and how many teams share the keys. Using Langfuse Cloud means no servers to run, while self-hosting adds deployment, upgrades and backups. Each prompt referenced by version or label needs a clear naming convention and a test case set, and a shared CI pipeline needs key scoping and secret handling agreed up front. Ask a partner to size each of these in the written scope.

What does a self-hosted Langfuse deployment need to run?

A self-hosted Langfuse deployment runs two application containers, Langfuse Web for the UI and APIs and Langfuse Worker for asynchronous event processing. It also needs PostgreSQL, ClickHouse, Redis or Valkey, and S3-compatible blob storage. The Langfuse scaling guide lists minimum resources of 2 CPU and 4 GiB for web, worker and PostgreSQL, 1 CPU and 1.5 GiB for Redis or Valkey, and 2 CPU and 8 GiB for ClickHouse, with at least 16 GiB of ClickHouse memory for larger deployments. Confirm these figures against your expected load before sizing hardware, and plan backups for each stateful component.

Can our team set this up without a partner?

Yes, for a single project using Langfuse Cloud, one team can usually connect promptfoo to Langfuse alone. You install the @langfuse/client SDK alongside promptfoo, set LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY, and reference prompts from your config. A partner becomes useful when self-hosting, multi-team key governance, CI wiring across pipelines, or audit evidence are in scope, because those require infrastructure, access control and documented operating procedures. Compare the cost of your own engineering time against a fixed-scope engagement.

What must our team provide before the integration work starts?

Your team needs to provide access to the Langfuse project and the prompts to be managed there, a CI runner with network reach to Langfuse and to your model providers, and a named owner for the Langfuse keys. You also need a test suite or the test cases that define acceptable prompt output. If Langfuse is self-hosted, add the cloud accounts or data center capacity, storage, and DNS and certificate ownership. Ask any partner to list these inputs in the written scope so gaps surface before the build begins.

Who should own the Langfuse keys used by promptfoo?

Assign ownership of the Langfuse keys to one accountable team, store them in your secrets manager, and scope them to the projects that the evals need. Shared keys across many teams make rotation and incident response harder, and they blur who is responsible for prompt changes. Confirm with Langfuse how keys are created and rotated for your plan, since Enterprise features such as project-level RBAC and protected prompt labels require a license key on self-hosted deployments.

How much does the Langfuse Enterprise plan add to the cost?

Langfuse's self-hosted pricing page lists a free open source plan and a custom-priced Self-Hosted Enterprise plan. The Enterprise plan adds a named support engineer, solutions architect access and a support SLA, plus features that need an Enterprise license key, such as project-level RBAC, protected prompt labels, audit logs and data retention policies. The price is not published, so request a quote tied to the features and support level you need, and check whether your governance requirements can be met without it.

How DeployOpen scopes and delivers the promptfoo and Langfuse connection

DeployOpen treats the promptfoo and Langfuse connection as a fixed-scope piece of work inside your own infrastructure. We agree the Langfuse deployment, the prompt references, the keys and the test runner in writing before any build starts, then document and hand over what was delivered.

How we scope

  • Confirm which Langfuse prompts, names and labels promptfoo will test, and who owns each one.
  • Record whether Langfuse is already running or must be deployed as part of the work.
  • Define where the LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY values will be stored and who may rotate them.
  • Agree in writing which promptfoo runs, pass criteria and environments are in scope.

How we build

  • Install the optional @langfuse/client SDK alongside promptfoo in the pipeline or workstation that runs the evals.
  • Configure prompt references by version or label, and test that each reference resolves to the intended prompt.
  • Keep Langfuse as the single prompt source so tests run against the prompts teams actually edit and approve.
  • Verify runs end to end and check that secrets never appear in configs, logs or evaluation output.

How we hand over

  • Document the config files, prompt reference format, key locations and the steps to add a new prompt.
  • Walk your engineers through a test run and a failed run so they can read results and diagnose errors.
  • Record the versions of promptfoo, Node.js and the Langfuse SDK used, so upgrades can be planned.
  • Provide the written runbook and configuration as part of the agreed deliverables.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer after handover.
  • Support can cover Langfuse self-hosting upgrades when prompt references or the SDK need to change.
  • Ask any provider for a quote that lists each deliverable, what your team must provide and what recurs.
  • Confirm with the Langfuse and promptfoo release notes before you schedule an upgrade in your environment.

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.