Running promptfoo evals from n8n workflows

Schedule promptfoo evals from a self-hosted n8n workflow with the Execute Command node, gate Slack or merge steps on the pass rate, and prepare the n8n host. Scope and effort depend on your environment.

On this page

Running promptfoo evals from n8n workflows: what the integration does

If your team already runs n8n and wants LLM evals on a schedule or in response to an event, you can run promptfoo from an n8n workflow. promptfoo documents this path on self-hosted n8n version 1 or later: a workflow uses the Execute Command node to call the promptfoo CLI, which must be installed in the n8n container or on the n8n host. The workflow then reads the eval output and decides what happens next, such as posting to Slack or blocking a merge. Nothing about the integration requires a separate promptfoo server, because the CLI does the evaluation work inside the n8n environment.

The detail that matters most for planning is where the evaluation runs. promptfoo runs locally and talks directly with the model provider, so the eval does not pass through a promptfoo service. That means the n8n host needs the model credentials promptfoo uses, typically stored as environment variables in the container or host, and outbound network access to each provider endpoint the configuration calls. Confirm with your security team where those keys are allowed to live, since n8n's own credential store is a separate place from the environment that the Execute Command node sees.

Before you build the workflow, confirm the installed promptfoo version against the Node.js requirement for the release you choose, and confirm that the n8n version and its runtime can execute shell commands in the way your policy allows. The current n8n configuration also determines who can edit workflows that call the CLI, because anyone who can edit a command node can change what runs on the host. Treat the workflow as code: review changes to the commands and configuration files it references, and keep the eval configuration in version control alongside the rest of your prompt assets.

What the n8n host needs installed before the first run

Four items and one licensing check decide whether a scheduled promptfoo eval can run from n8n at all. Check them on the host or container that runs n8n, not on your laptop, because the Execute Command node runs commands where n8n runs. Work through them in order before you build the first workflow.

Self-hosted n8n version 1 or later

The promptfoo integration is documented for self-hosted n8n version 1 or later, using the Execute Command node. Confirm the exact version your instance reports before you build anything, and note the version in your runbook so later upgrades can be tested against the same workflow. Check the n8n release notes when you plan an upgrade, because a version change can affect how the node behaves.

n8n release notes

promptfoo CLI in the container or host

The promptfoo CLI must be installed where n8n executes commands, either inside the n8n container image or on the host. A separate install on your workstation does not help a scheduled run. Decide which path you use, bake the install into your image or provisioning, and record the exact promptfoo version so that a scheduled eval does not change behavior after an unplanned update.

Current npm release
0.124.1
promptfoo on npm

Node.js 22.22.0 or newer

The npm release 0.124.1 requires Node.js 22.22.0 or newer. Confirm the Node.js version on the exact host image you run, because a base image tag can differ from the version on your host or from a version you tested locally. If the runtime is older, the CLI install or run can fail in ways that look like workflow errors, so check this first when a scheduled run fails immediately.

Outbound access to the model provider

Evals run locally and call the model provider directly, so the n8n host needs outbound network access to every endpoint your config targets. Corporate egress rules, proxies and allow lists often block these calls silently. Test from the host itself with a single test case, and confirm which provider hostnames, ports and proxy settings your security team must approve before the first scheduled run.

API keys stored outside the workflow

Provider keys must reach the CLI through environment variables or a secrets mechanism on the host, not pasted into workflow nodes or exported in a shared command line. Ask who owns those keys, how they rotate, and which n8n users can open workflows that reference them. Workflow exports and execution logs can expose values if the command echoes them.

Licensing check before internal use

n8n is licensed under the Sustainable Use License, which permits use or modification only for your own internal business purposes or for non-commercial or personal use. Files with .ee in their name or directory are not covered by that license and require a valid n8n Enterprise License. Have legal or procurement confirm that your use fits these terms, and that you do not rely on .ee features without an Enterprise License.

n8n license text

How to configure the Execute Command node for promptfoo

This sequence takes a self-hosted n8n instance from a bare install to a scheduled workflow that runs a versioned promptfoo eval, captures its exit code and results file, and hands the outcome to the next step.

  1. Confirm the n8n host and version

    The platform team confirms that the self-hosted n8n instance is version 1 or later, which is the version the promptfoo documentation describes for this integration. They also confirm which Node.js runtime the n8n container or host uses, since the promptfoo CLI needs a supported Node.js version (the current npm release requires Node.js 22.22.0 or newer). Check the version with the n8n release notes before you change anything. The step is done when the team can state the n8n version, the Node.js version and the container or host name in the change record.

  2. Install the promptfoo CLI in the n8n runtime

    An engineer with shell access installs the promptfoo CLI inside the n8n container image or on the host where n8n runs, so the Execute Command node can call it. For a container, add the install to the image build so it survives restarts and rebuilds. Pin the version rather than taking whatever is latest, and record the chosen version in the configuration repository. Verify the install from the same shell n8n uses by running the version command and confirming it prints the pinned version without errors.

  3. Store model API keys outside the workflow

    The engineer places each model provider key in an n8n credential or in environment variables set on the n8n container, and never pastes it into a workflow node or a config file committed to source control. Confirm with the team which option fits its secret management practice, and check that the encryption key of the n8n instance is protected, because stored credentials depend on it. The step is done when a test run of the promptfoo command can reach the model provider without any key appearing in the workflow JSON export.

  4. Add the Schedule Trigger or webhook

    In the workflow editor, the engineer adds a Schedule Trigger for recurring runs, or a webhook trigger when a pipeline or a person should start the eval on demand. Set the schedule time zone and frequency to match the team's review cadence. Activate the workflow only after the manual test in the final step passes. The step is done when the trigger fires in a test execution and the workflow shows the trigger as the first node.

  5. Add the Execute Command node with a versioned config

    The engineer adds an Execute Command node after the trigger and enters a command that runs promptfoo eval against a config file kept under version control, for example promptfoo eval -c /path/to/promptfooconfig.yaml --output /path/to/results.json. Use absolute paths, because the working directory inside n8n may differ from the shell. Keep the config and the results path as explicit values so a reviewer can see exactly what ran. The step is done when a test execution starts the command and the node output contains the command's stdout and stderr.

  6. Parse the output and capture the exit code

    The engineer adds a Code node or an IF node after the command to read the results file, extract the pass and fail counts, and compute the pass rate. The node should also keep the command's exit code, because a non-zero exit code signals a failed run or an error that the results file alone might not show. Confirm the field names against an actual results file from a manual run, since the JSON layout is what the parsing step depends on. The step is done when a test execution returns a single item with the pass rate and exit code as named fields.

  7. Run the command manually and check the results

    Before activating the workflow, the engineer opens a shell in the n8n container or on the host, runs the same promptfoo command by hand, and checks the exit code with echo $? and the results file contents. The results should match what the Execute Command node returned in the test execution. If they differ, the cause is usually a path, environment variable or Node.js version mismatch between the shell and the n8n process. The step is done when the manual and workflow runs agree on the exit code, the pass counts and the results file location.

How the trigger, n8n host, promptfoo and the model fit together

The run starts at a Schedule Trigger or webhook on the n8n main instance, which hands the job to an Execute Command node. That node calls the promptfoo CLI installed on the same host or in the n8n container, and promptfoo sends requests straight to the model provider. The result returns to an IF node that branches on the pass rate, sending a failure to Slack or stopping a merge step. The dashed trust boundary marks what you operate, so check that the host, its credentials and the outbound model call sit where your policy expects.

Scheduled or webhook-triggered promptfoo run, with the outbound model call outside the n8n host.

How to gate Slack or merge steps on the pass rate

Start by separating two outcomes that look similar in an n8n run but mean different things. A failed command means promptfoo did not complete: the CLI was missing, the Node.js runtime was too old, a provider key was rejected or the config did not parse. A failed threshold means the eval ran to completion and the pass rate fell below the bar your team set. The Execute Command node reports the process exit code, and your IF node should branch on that first, so an infrastructure fault never looks like a prompt regression. Then read the results file the run wrote, for example the JSON output from the promptfoo CLI, and compute the pass rate from its success and failure counts in a Code node. Confirm the exact field names in the output of your promptfoo version before you hard-code them, because the structure is the thing most likely to change between upgrades.

Choose the threshold deliberately and record it next to the config. A single global number applied to every suite is easy to write and hard to defend, because a safety-oriented red team set and a formatting regression set rarely tolerate the same failure rate. Set the threshold in one place the n8n workflow reads, such as a workflow variable or an environment setting on the host, and version it with the prompts it governs. The team that owns the prompts should set this value, since they know which failures are acceptable during a deliberate rewrite and which are not. Platform or security staff can own the routing logic, but they should not pick the number on the prompt team's behalf. Ask the prompt owners to name the threshold and the person who approves changes to it.

Route the result to the step that matches the risk. A Slack notification is the lighter option: post the pass rate, the failing test names and a link to the artifact, and let a person decide. A merge request step is stricter: use the GitLab or GitHub API node to comment on or block the change only when the gate fails, and keep the branch protection rules in the source platform, not in n8n, so the gate cannot be bypassed by editing a workflow. Whichever route you choose, make sure a skipped or errored run does not post a green result, and test both branches with a deliberately failing config before relying on them. Credentials for Slack or the source platform belong in n8n's credential store, which is encrypted with the instance key, so back that key up with the rest of the host.

Which n8n fields carry which promptfoo values

This table maps each value an n8n workflow passes to promptfoo, from the trigger through the config path and results output to the Slack or merge step. Read it as a checklist: for each field, confirm who sets it and where, because most failed runs trace back to a value set in the wrong place or owned by nobody.

FieldSource or where it is setOwner
Trigger data (schedule or webhook payload)n8n Schedule Trigger or Webhook node, read in later nodes as workflow dataWorkflow author
Promptfoo config pathSet in the Execute Command node as a file path on the n8n host or container, for example a path to a promptfoo config filePlatform team with the eval repository owner
Provider API keysStored as n8n credentials or set as environment variables on the n8n container or host, never typed into the workflowSecurity or platform team
Encryption key for n8n credentialsMain instance setting that must match on every worker and webhook processor in queue modePlatform team
promptfoo CLI locationInstalled in the n8n container or on the host so the Execute Command node can call itPlatform team
Results output file or stdoutWritten by promptfoo during the Execute Command run, then read by a later node to calculate the pass rateWorkflow author
Pass rate thresholdSet as a value in an IF or Code node that compares it with the results outputEval owner who sets the quality bar
Slack or merge step inputsChannel, token or repository reference, and the pass or fail branch that receives the resultWorkflow author with the team that owns the channel or repository

Securing the n8n host and the eval credentials

An n8n host that runs promptfoo holds model API keys, workflow credentials and eval output that may contain sensitive prompts. The cards below cover the controls that protect those assets, from n8n's own encryption and export settings to who can edit shell commands and where the host can reach. Work through them before the first scheduled eval goes live.

Protect n8n credential encryption

n8n encrypts the credentials it stores with an encryption key held by the main instance. If that key is lost or changed, stored credentials can no longer be read, and if it is exposed, every stored credential is exposed with it. Record where the key lives, who can read it and how it is restored, and keep the key out of workflow exports and shared configuration files. Confirm the key handling in the n8n documentation for the version you run before you store model keys in n8n.

Queue mode docs

Share the encryption key with workers

In queue mode, the main instance hands executions to worker and webhook processor nodes, and those nodes read credentials from the database. Every one of them therefore needs the main instance's encryption key. Treat each worker as a holder of that key, and confirm that a worker added later receives the same key before it runs any eval job. Restrict which hosts can join the queue, because each one can decrypt stored credentials.

Keep model keys out of exports

Workflow JSON is easy to copy, share and commit, and a provider key pasted into an Execute Command node or a plain expression ends up in that file. Reference model keys only through n8n's credential store or host environment variables set outside the workflow. Before you export or version a workflow, search the export for key patterns and for any OPENAI_API_KEY or similar value. Set the same rule for the promptfoo config files the node calls.

Limit who edits Execute Command nodes

An Execute Command node runs whatever shell command it contains, under the account that runs n8n. Anyone who can edit that node can run arbitrary commands on the host, read its files and reach its network. Restrict editing rights to a small group, review every change to a command node the way you review code, and avoid building the command from values supplied by webhook payloads or other external input. Confirm which user account runs the n8n process and give it only the file and network access the eval needs.

Restrict outbound network paths

The n8n host needs outbound access to the model endpoints that promptfoo tests, to Slack or your Git host for the gating steps, and to package sources if you install promptfoo at run time. Allow those destinations explicitly and block the rest. Promptfoo runs its evals locally and talks directly with the LLM, so the traffic you allow is the traffic your eval generates. Confirm each destination with the team that owns the model endpoint before you open it.

Handle sensitive eval output

Eval results contain the prompts, test inputs and model responses that the suite used, and some of those may include customer data or internal content. Decide where result files are written, how long they are kept and who can open them. Keep the outputs off shared drives and out of Slack messages where possible, and send only the pass rate and failing test names to the channel. Check that the retention rules match your data classification before the first scheduled run.

Plan high availability within the license

n8n's multi-main setup, which runs several main instances for high availability, is restricted to Enterprise self-hosted deployments and is not available in the Community edition. If an eval schedule must survive a main instance failure, that requirement affects the license choice before the build starts. Confirm the license terms that apply to your use, because the Sustainable Use License limits use to internal business purposes, and files marked .ee need a valid Enterprise license.

n8n license terms

Common failures when promptfoo runs inside n8n

This table lists the failures teams most often hit when promptfoo runs from an Execute Command node in self-hosted n8n, with the likely cause and the fix for each. Read it as a checklist: match the symptom in your execution log to a row, then confirm the fix on the n8n host or worker before changing the workflow.

FailureLikely causeFix
Command not found: promptfooThe promptfoo CLI is not installed in the n8n container or host, or is not on the PATH the n8n process usesInstall the CLI in the same container or host that runs n8n, then call it by full path or confirm the PATH inside the container with a test execution
Unsupported Node.js version errorThe host runs a Node.js release older than the version promptfoo requires (22.22.0 or newer for release 0.124.1)Upgrade Node.js on the n8n host or image, restart n8n, and confirm the version from the same shell n8n uses
Authentication or provider errorsThe provider API key is set in your shell but not in the environment n8n passes to the Execute Command nodeSet the key as an environment variable on the n8n container or service, not only on the host shell, and restart n8n so the process picks it up
Run stops or exits early on long evalsThe Execute Command node or an upstream proxy or timeout closes the process before a large eval or red team scan finishesReduce eval size for scheduled runs, split the suite into smaller configs, and confirm the timeout settings in your n8n and proxy configuration
Pass-rate gate reads nothing or fails unexpectedlyThe workflow parses console text or a summary that changed between promptfoo versions, so the IF node receives an empty or unexpected valueWrite results to a file with an output flag, parse the JSON file in a Code node, and pin the promptfoo version you tested
Output parsing errors in the Code nodestdout mixes progress messages with JSON, or the output file path is relative to a different working directorySend progress to stderr where possible, use an absolute output path, and validate the parsed object before reading fields
Queue-mode worker cannot run the evalThe worker image lacks the promptfoo CLI, even though the main instance has it installedInstall the CLI in every worker and webhook processor image, and test an execution routed to a worker rather than the main instance
Credentials fail only on workersThe encryption key from the main instance is not shared with worker nodes, so they cannot decrypt stored credentialsSet the same encryption key on the main instance, all workers and webhook processors, then rerun a scheduled test on a worker

Questions teams ask before running promptfoo from n8n

What does it cost to run promptfoo evals from n8n, and what drives the effort?

Most of the cost is labor, not licenses. promptfoo is MIT licensed, so the CLI itself has no license fee, but you still pay for model API usage during eval runs, for the people who prepare the n8n host, and for the time spent designing thresholds and workflows. Effort rises with the number of workflows, how many eval suites run per schedule, how carefully credentials are handled, and how many environments (test, staging, production) the setup must cover. Ask any partner for a written quote that separates one-time setup from recurring upkeep such as upgrades and suite maintenance.

How long does a promptfoo and n8n setup take?

Duration depends mainly on the environment. A single self-hosted n8n instance with the promptfoo CLI already installed and a small eval suite is the simplest case. Timelines lengthen when the host needs approved software installed through change control, when n8n runs in queue mode with workers that each need the right tooling, or when pass-rate thresholds must be agreed with model owners and security reviewers. No duration is fixed by the sources for this topic, so ask for a timeline tied to your written scope and your change process.

What must our team provide before the work starts?

Plan to provide four things before the build begins:

  • Shell or administrative access to the n8n host or container, and to any worker nodes if you use queue mode
  • API keys for the model providers the evals call, stored under your own secrets policy
  • The eval suites, prompts and expected outputs the pass-rate gate will check
  • Named owners for threshold decisions and for the Slack channel or merge step the gate controls

Confirm with your n8n and model provider administrators which accounts and keys will be used.

Can our own team set this up without a partner?

Yes, if your team already runs n8n and can install the promptfoo CLI in the n8n container or host. The promptfoo documentation describes the Execute Command node approach, so the core steps are documented. A partner adds value when the team lacks n8n administration experience, needs the work documented for an audit, or must align credential handling and threshold design with security and compliance reviewers. Confirm the documented steps with promptfoo and n8n before deciding.

Is promptfoo free to use with n8n, and what does the MIT license cover?

promptfoo is licensed under the MIT license, and its Community edition is free and includes all LLM evaluation features, all model providers and integrations, and red teaming with 10k probes per month. Running it from n8n does not change that licensing. Model provider charges still apply to your API calls. Have your legal team confirm the MIT terms against your internal policy before deployment.

What do n8n license and plan tiers mean for this use?

n8n uses the Sustainable Use License, which permits use for your own internal business purposes and free non-commercial use. Files with .ee in their name or directory need a valid n8n Enterprise License. The pricing page lists a free self-hosted Community edition. SSO, LDAP, environments with Git and log streaming are included only in the Business and Enterprise plans, and multi-main high availability is limited to Enterprise self-hosted deployments. Confirm with n8n which edition and license terms fit your organization before you plan the host.

When do we need promptfoo Enterprise or the self-hosted promptfoo server?

You need them when the workflow outgrows a single operator's machine. The self-hosted promptfoo app stores data in a local SQLite database that cannot be shared across replicas, has no RBAC, horizontal scaling, built-in authentication or SSO, and is not recommended for production use. Enterprise adds team sharing, access control, SSO and continuous monitoring, and On-Premise runs those features in your infrastructure. Ask promptfoo whether these features match your access and audit requirements.

How DeployOpen scopes and delivers n8n and promptfoo integrations

DeployOpen plans and builds self-hosted n8n and promptfoo setups inside infrastructure you control, so the eval schedule, pass-rate gate and host configuration are reviewed by your own security and platform teams. Engagements start from a written scope that names the workflows, hosts, notifications and handover items before any build work begins.

How we scope

  • Written scope names which n8n workflows run promptfoo, the eval configs they call and the schedule for each.
  • We confirm the n8n edition, hosting model and whether the instance is single-main or queue mode before design.
  • Scope records the pass-rate threshold, the Slack or merge step it gates and who owns the decision to change it.

How we build

  • We install and verify the promptfoo CLI on the n8n container or host, pinned to the Node.js version it requires.
  • We build Execute Command nodes with the working directory, environment variables and secret references set explicitly.
  • We test failing and passing runs end to end, including how a gate behaves when promptfoo exits with an error.

How we hand over

  • You receive exported workflow definitions, the host setup steps and a record of installed promptfoo and Node.js versions.
  • Documentation covers credential locations, encryption key handling and how to rotate API keys used by evals.
  • Handover includes a walkthrough of the gate logic so your team can adjust thresholds without a rebuild.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer after handover.
  • Upgrades to n8n and promptfoo are planned against their release notes and tested on a staging instance first.
  • Changes to scope, schedules or gates are agreed in writing before the work starts.

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.