Running promptfoo in Travis CI

A working .travis.yml for promptfoo evals on Node.js 24, with provider keys kept in Travis environment variables and result artifacts kept out of the build log. Covers the setup sequence, the checks that confirm each step, and where the first run usually fails.

On this page

Running promptfoo in Travis CI for LLM evals

A team that changes prompts, models or retrieval logic needs its LLM evals to run automatically before a change merges. In Travis CI, promptfoo runs as a command-line tool inside the build job, sends test requests directly from the build machine to your model provider, and requires Node.js 22.22.0 or newer. The Travis CI guide for promptfoo recommends Node.js 24 LTS, so set the node_js version in .travis.yml to 24 unless you have a reason to pin an older release that still meets the minimum. Each job installs promptfoo, reads a config file from the repository, runs the eval, and exits with a status code that Travis CI uses to pass or fail the build.

The job does not cover everything around LLM testing. It does not start a hosted promptfoo server, so there is no shared web UI, team access control or central history between builds. Each Travis job also starts with a fresh machine, so results disappear unless you copy them somewhere durable, and the promptfoo self-hosting notes describe a SQLite database that cannot be shared across replicas, which is one reason a shared server is a separate decision. Confirm with your security team which provider keys the job will hold, which repository branches can read them, and whether pull requests from forks receive secrets. Those answers decide the rest of the configuration.

What you need before the first Travis job runs

Most first-run failures in Travis CI come from missing access, the wrong Node.js runtime, or a build that cannot reach the model provider. Work through these five items before you write the job, so the first run tests promptfoo rather than your setup.

Travis CI access and plan

Confirm that your organization has an active Travis CI plan with the repository enabled and build minutes available for eval runs. Eval jobs call paid model APIs and can run for a long time, so check concurrency limits and the time a single job may run before you schedule them. Travis CI publishes its current plan limits, and those limits change, so confirm them with Travis CI before you rely on them.

promptfoo Travis CI guide

Node.js 24 runtime in the build

promptfoo requires Node.js 22.22.0 or newer, and the Travis CI guide recommends Node.js 24 LTS. Pin the runtime in .travis.yml with the node_js key so that every build uses the same version, and record that version in your evaluation reports. A runtime drift between builds can change results and make regressions hard to trace.

Provider accounts and spend limits

Create a dedicated API account or project for CI with each model provider you test, separate from personal and production keys. Set a monthly spend cap and a rate limit on each account so a looping job or an unexpectedly large suite cannot run up the bill. Ask each provider how usage limits and billing alerts work for API keys, because these controls differ by vendor.

Network egress to the model provider

The promptfoo CLI runs on the build machine and calls the model provider directly, so the Travis CI worker must be able to reach that provider's API endpoint over HTTPS. If your organization routes outbound traffic through a proxy, an AI gateway or a private endpoint, add that address to the job configuration and test it with a single small eval first. Confirm with your network team whether the build environment has any egress restrictions.

Repository layout for promptfoo configuration

Keep promptfooconfig.yaml, test datasets and prompt files in a known path in the repository, and reference them explicitly in the job. Decide which files trigger an eval run, such as changes under the prompts directory, so that unrelated commits do not spend API budget. Store no provider keys in these files, because the configuration will be read by everyone with repository access.

Licensing and edition choices

The promptfoo npm package is MIT licensed, and the Community edition is free and includes all LLM evaluation features, all model providers and red teaming with 10k probes per month. You do not need a paid edition to run evals in Travis CI. Confirm with your procurement team whether a paid Enterprise or On-Premise edition is needed for team sharing or SSO before you design the pipeline around those features.

promptfoo pricing page

How to add the .travis.yml step by step

This sequence takes a Travis CI build from a bare repository to a job that runs promptfoo evals on Node.js 24, gates the build on a pass rate, and keeps the results as a downloadable artifact instead of in the log.

  1. Set the language and Node.js version

    In the repository root, create or edit .travis.yml and set language: node_js with Node.js 24 as the runtime version. The promptfoo Travis CI guide requires Node.js 22.22.0 or newer and recommends Node.js 24 LTS, so pin a version at or above that minimum. Commit the file on a test branch and open a build. Done when the first job log shows the Node.js version Travis selected, and printing node --version in a before_install or script line returns a v24 release.

  2. Install promptfoo in the build

    Add an install step, typically npm install promptfoo or npm ci if you commit a lockfile, so the build uses a known release. Pin the version in package.json instead of relying on whatever is latest on the day the build runs, and confirm the version you pinned matches the one you tested locally. Done when the log prints the installed promptfoo version and the command exits with status 0.

  3. Store provider keys as secret environment variables

    In the Travis CI repository settings, add each model provider key (for example, the key your eval config reads) as an environment variable and mark it as secret so the value is hidden in the web interface and logs. Keep keys out of .travis.yml and out of promptfoo config files, which are committed to version control. Done when the variable appears in settings with its value masked, and a temporary [ -n "$OPENAI_API_KEY" ] && echo set || echo missing check prints set without revealing the value. Substitute the variable name your config uses.

  4. Run the eval with a pass-rate gate

    Add a script step that runs npx promptfoo eval against your config and sets the pass threshold that should fail the build. Use the threshold mechanism documented for promptfoo, and confirm the exact option name against the current promptfoo docs for your release before relying on it. Choose whether a failing eval should block merges or only report, and decide that with the team before enabling the gate. Done when a deliberately broken test case causes the job to fail and a passing config leaves the job green.

  5. Write results to a dedicated output path

    Direct the eval output to a file outside the log, such as an output/ directory, using the output flag supported by your promptfoo version. Eval results can include prompts, model responses and test data, so treat the file as sensitive and avoid printing it to the console. Done when running the eval locally produces the file at the expected path and the CI job creates the same path without writing its contents to the log.

  6. Upload the results as a build artifact

    Configure Travis CI to keep the output directory as an artifact using its artifacts upload feature, and confirm your Travis plan and storage settings allow it. Restrict uploads to the results folder so credentials or caches are not included. Check retention and access in your Travis account, since artifact visibility follows the repository's access rules. Done when a finished build offers the results file for download, and opening it confirms the eval results are present.

  7. Confirm the exit code and failure path

    Review the final job status and the exit code of the eval step together. A zero exit code should mean the gate passed, and a non-zero code should fail the build and still upload the artifact so reviewers can see which cases failed. Ask the team to confirm that artifact upload runs on failed builds in your configuration, and test it with a deliberately failing run. Done when a failed eval marks the build red, the artifact is still available, and no key value appears anywhere in the log.

Choosing how the job runs evals

The trigger decides how often the eval job reaches your provider account and how early a regression appears. Running on every push to every branch gives the fastest feedback to whoever changed a prompt, but each push that touches nothing relevant still spends time and money. Running only on pull requests into protected branches puts the result where reviewers already look, although a failure may arrive later than the author expects. Many teams combine both: a lighter check on pull requests and a fuller run on the main branch after merge.

  • Every push: earliest signal for the author, highest number of provider calls over a month.
  • Pull requests only: results sit next to the review, with fewer runs on experimental branches.
  • Protected branch after merge: confirms the merged state, but a regression reaches the main branch before anyone sees it.
  • Branch filters: limit which branches start the job, so forks and scratch branches do not spend provider credits.
  • Draft or skipped builds: decide whether drafts run at all, since Travis CI can skip builds through commit message markers.

Confirm the trigger, branch and pull request settings for your repository in the Travis CI account, including whether pull requests from forks receive secrets.

How provider keys map to Travis environment variables

The promptfoo Travis CI guide stores provider keys as Travis CI environment variables, so the job reads each key from the environment at run time and the key never appears in the repository. Each key your promptfoo config depends on needs exactly one variable name in the Travis repository settings, and that name must match what the config or the provider expects, such as OPENAI_API_KEY for OpenAI-based providers. Before you add anything, open your config and list every apiKey reference, every env lookup and every provider that reads a key from the environment, then confirm the exact variable names against the provider documentation for each one. A single mismatched name fails the run with an authentication error that looks like a bad key, so check the spelling and case first.

Keep keys out of .travis.yml and out of any promptfoo config file you commit. Inline values in promptfooconfig.yaml, a .env file checked into Git, or a key pasted into a command in the script section will all end up in the repository history and, for many teams, in build logs. Reference variables by name instead, and add local .env files to .gitignore. Also review what your job prints: promptfoo output and the debug logs of provider SDKs should not echo keys, but you should confirm this in a test run on a non-production key rather than assume it.

Travis distinguishes public variables from secret variables. Variables you define in the repository settings can be marked as secret, which hides their values in the settings page and in build logs. Use secret variables for every provider key and any token used to publish results. Public variables are visible to anyone who can view the repository settings or the job configuration, so reserve them for non-sensitive values such as a model name or a threshold. Confirm the current behavior for pull requests from forks in the Travis documentation before you rely on secret variables for fork builds, because that is where most accidental key exposure happens.

Mapping promptfoo settings to Travis CI

This table maps each promptfoo setting in a Travis CI job to the Travis element that carries it and the place where you set it. Use it to see which values belong in the repository, which belong in Travis environment variables, and which behaviors you must check in your own pinned version before relying on them. The main takeaway is that the Node.js version, provider keys and build status come from different places, so each one needs its own confirmation.

promptfoo elementTravis CI elementWhere it is setWhat to confirm
Node.js runtime (22.22.0 or newer)node_js version list.travis.yml under language: node_jsPinned promptfoo release supports the Node.js 24 image Travis provides for your OS
Config file pathRepository checkout and job scriptRepository root, passed to the eval commandDefault config file name in your promptfoo version, and pass the path explicitly
Provider API keysRepository environment variablesTravis repository settings, marked as hiddenEach provider SDK reads the exact variable name you define
Eval output fileScript step writing a results filescript section of .travis.yml or a wrapper scriptOutput flag and file format names in your promptfoo version
Artifact destinationTravis artifact upload or external storageDeploy or after_script steps in .travis.ymlArtifact upload options, retention and access for your Travis plan
Build failure on regressionsNon-zero exit status of the script stepscript section of .travis.ymlExit code promptfoo returns on failed assertions and on errors
Log exposure of keys and promptsJob log outputVerbose flags and echo commands in scriptDebug output omits provider keys and full prompt or response text

How the Travis job, promptfoo and the model provider connect

The flow starts when Travis starts a build on its hosted VM, which installs Node.js 24 and runs the promptfoo CLI. Provider keys reach the job only as Travis environment variables, and the CLI calls the model provider API over HTTPS. The trust boundary sits between the Travis-hosted build and the provider, so check that keys stay masked and that results go to an artifact store you control rather than the build log.

Provider keys flow into the promptfoo job, which crosses the trust boundary to the model provider.

Keeping keys, outputs and artifacts out of exposure

Travis CI build logs are readable by anyone who can see the repository, and promptfoo outputs carry prompts and model responses. The cards below cover where provider keys live, how they stay out of logs, which branches can reach them, and where results are stored.

Store provider keys as Travis variables

Provider keys such as the API key for each model platform belong in Travis CI environment variables, set in the repository settings rather than in .travis.yml. Mark each variable as secret so the value is hidden in the job log. Create a separate key for CI with a narrow scope, so a leak from the build does not expose your interactive developer keys. Confirm how your Travis CI plan handles variable visibility before relying on it.

Travis CI guide

Keep keys out of debug output

Steps that print the environment, run set -x, or echo a config file can write a key into the log even when the variable is masked, because masking matches the exact value only. Avoid printenv and verbose flags in the promptfoo job, and do not interpolate keys into command lines that Travis echoes. Review any debug step you add before it reaches a shared branch.

Limit which builds can read secrets

Decide whether pull requests from forks and branches outside your organization may read secret variables. A build triggered by an untrusted contribution that runs your promptfoo config could send your keys to an endpoint the contributor controls. Restrict secret access to trusted branches, and confirm in your Travis CI settings how forked pull requests are treated, since this behavior depends on your configuration.

Cap provider key scope and spend

A CI key should only reach the models your evals call and should carry a spending limit or budget that your provider lets you set. Rotate the key on a schedule and after any suspected exposure. Ask each provider what limits, usage reports and alerts it offers for API keys, because a leaked key that cannot be capped is a billing risk as well as a data risk.

Treat eval outputs as sensitive

promptfoo result files can contain the full prompts, test data, retrieved documents and model responses, which may include personal or confidential data from your application. Decide what each run records before publishing, and avoid attaching JSON or HTML results to public builds or pull request comments. Ask your data owners to confirm what test inputs are allowed in CI.

Send artifacts to storage you control

Build logs and Travis artifacts are visible to people with repository access, so result files belong in storage your team controls, such as an object store with restricted access and a retention rule. Upload only the reports reviewers need, set an expiry, and confirm the access list for that storage. Reference the stored location in the build summary rather than the file contents.

Where result artifacts should go instead of the build log

Keep eval results out of the Travis CI build log. Travis CI logs are short-lived and can be visible to anyone with access to the repository or build page, depending on your project's visibility settings. Promptfoo output can contain the prompts sent to the model and the responses that came back, including customer data, internal instructions or red team attack payloads. Treat the result file as a record that needs its own retention period, access list and deletion rule, separate from the log. Write the output to a file on the build machine with the --output flag, for example promptfooconfig.json results saved as JSON, and choose JUnit or HTML only when a reviewer needs that format. Confirm the exact output flags for your promptfoo version against the Travis CI guide and the CLI reference before you hard-code them.

After the job finishes, upload the file with a step that writes to storage your organization controls, such as an object store bucket in your own cloud account or a file share your security team administers. Use a short-lived, write-only credential for the upload, set a lifecycle rule that expires old results, and restrict read access to the people who review evals. Travis CI's deploy and artifact-style steps depend on the provider you choose, so check which options your Travis plan and provider support. Do not assume the promptfoo self-hosted server is the shared store. Its documentation says it is not recommended for production use, stores data in a local SQLite database, and has no RBAC or built-in SSO, so results written there stay on one instance and are not available to other pipelines or replicas.

Why the first Travis run fails and how to fix it

This table maps the symptoms most teams see on a first promptfoo run in Travis CI to their likely causes, fixes and the lines to check in the job log. Read it top to bottom when a build fails, starting with the Node.js version, since it causes the most install errors. Confirm each fix against your own Travis configuration before changing provider settings.

SymptomLikely causeFixWhat to check in the job log
Install fails with an engine or version errorThe job runs a Node.js version below 22.22.0, the minimum promptfoo requiresSet the language version in .travis.yml to Node.js 24, the version the promptfoo guide recommendsThe node version printed at the start of the job, and the engines message from npm
Provider calls fail with authentication errors only on pull request buildsTravis does not expose secret environment variables to builds from forked pull requestsRun evals only on branch builds for trusted changes, or use a separate, low-limit key for pull requests after a review decisionWhether the job is a pull request build, and whether the provider key variable is empty
Requests time out or are refused by the model endpointThe build runner cannot reach the provider endpoint, often because of a corporate egress rule or a private gatewayConfirm outbound access from Travis runners to the provider or gateway host, or use a self-hosted runner inside your networkConnection errors naming the host, and DNS or TLS messages printed before the first test
Build passes even though assertions failedThe promptfoo command does not return a failing exit code, or a later step overrides itKeep the eval command as the last step that decides the result, and set the pass-rate threshold explicitlyThe summary line with pass and fail counts, and the exit code printed after the eval step
Results file is missing from the job's artifactsThe output path in the command does not match the path declared for artifact upload, or the file was written to a different working directoryWrite results to a fixed path under the build directory and reference that same path in the artifact settingsThe working directory printed at the start of the step and the output path passed to the eval command
Job stops partway through a large suiteThe suite runs longer than the Travis job time limit, or concurrency is too low for the number of casesSplit the suite across jobs, reuse the response cache, and lower the number of cases per run where quality allowsElapsed time per step, the last test progress line before the stop, and any timeout message from Travis

Questions teams ask before running promptfoo in Travis CI

Does the free promptfoo Community edition cover runs in Travis CI?

Yes. 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. Running the CLI from a .travis.yml job uses that same open-source tool, so a CI job does not need an Enterprise license. What the Community edition does not include is the shared server features: team sharing, SSO, role-based access control and continuous monitoring are part of Enterprise. Confirm the current limits on the promptfoo pricing page before you plan monthly probe volume, because a scheduled red team run across several models can use the allowance quickly.

What drives the effort and cost of setting up promptfoo in Travis CI?

The main drivers are the size of the eval suite, the number of model providers under test, how many branches and pull requests trigger jobs, and how much of the pipeline your team already runs on Travis CI. Most of the spend is labor: someone configures the .travis.yml, sets provider keys as environment variables, decides which results are kept as artifacts, and sets the pass-rate gate. Recurring costs are the LLM API calls made by each run and any Travis CI build minutes your plan charges for. Ask a partner for a quote that lists the repositories in scope, the providers, the expected trigger events and whether red team scans run in the same pipeline.

How long does the first working promptfoo job take in Travis CI?

The time depends on how many test cases exist, how many providers you call, whether your team already has evals written, and how quickly provider accounts and keys become available. A suite that is already in a repository and a provider account with API access move much faster than a first evaluation built from scratch. DeployOpen does not quote a duration here. Ask for a timeline in the written scope, and confirm with your team how long provider access and key approval typically take inside your organization, since that step often sets the schedule.

What does the work need from our team before it starts?

Three things are needed early. The first is read and write access to the repository and its Travis CI settings, so the .travis.yml and environment variables can be added. The second is Travis CI administrator rights for the repository or organization, because provider keys are stored as Travis CI environment variables and should be marked so they are not printed in logs. The third is accounts with the model providers under test, with API keys issued to a service identity rather than an individual. Also agree on who receives the result artifacts and where they are kept, since reports can contain prompts and model outputs.

Can our own engineers set up promptfoo in Travis CI without a partner?

Yes, a team with CI experience and a working promptfoo suite can write the .travis.yml, configure Node.js 24 and add environment variables without outside help. The promptfoo Travis CI guide requires Node.js 22.22.0 or newer and recommends Node.js 24 LTS, so the job should pin that version. Where teams usually need more time is the security side: keeping keys out of build logs, deciding what artifacts are stored and for how long, and setting a pass-rate gate that does not block every merge on a flaky model-graded check. A partner is useful when those decisions need review against your own security and compliance requirements.

Which build outputs should we store outside the Travis CI log?

Store the promptfoo result file and any HTML or JUnit report in an artifact location you control, rather than relying on the build log. Build logs are often visible to a wide group of developers and can be retained for long periods, while eval outputs can include prompts, retrieved documents and model responses that may hold sensitive data. Decide the storage location, retention period and access list before the first run. Confirm with your security team which of these outputs are allowed to leave the pipeline.

When does Enterprise or On-Premise promptfoo matter for Travis CI teams?

Enterprise matters when several teams need shared results, teams-based access control, SSO, custom roles, continuous monitoring or a central guardrail dashboard. On-Premise runs the Enterprise functionality on your own infrastructure with complete data isolation and a dedicated deployment engineer. The self-hosted open-source 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, so a team that needs a shared, governed results store should compare those limits against its requirements. Pricing for Enterprise is custom, so ask the vendor for a quote based on your scope.

How DeployOpen scopes and delivers a promptfoo Travis CI setup

DeployOpen approaches Running promptfoo in Travis CI as a fixed-scope piece of delivery work. We agree the eval and red team jobs, the provider key handling and the artifact storage in writing before any build changes are made, then deliver the pipeline into the CI environment your team already operates.

How we scope

  • Confirm which promptfoo suites run on each commit, branch or scheduled build in your Travis CI setup.
  • Agree the Node.js version, which the Travis CI guide sets at 22.22.0 or newer, with Node.js 24 LTS recommended.
  • Document which provider keys the jobs need and where each one is stored as a Travis CI environment variable.

How we build

  • Write the .travis.yml with pinned Node.js, dependency install and promptfoo eval steps for your configs.
  • Test that provider keys are never printed to the build log and that forked or untrusted builds cannot reach them.
  • Configure result artifacts to be written outside the build log to storage your team controls, and verify retrieval.

How we hand over

  • Deliver the .travis.yml, configuration notes and a short runbook covering keys, rotation and artifact locations.
  • Walk your engineers through a failing eval run so they can read results and diagnose the pipeline themselves.
  • Record the agreed scope, decisions and known limits in writing so later changes start from a clear baseline.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer after handover.
  • Retainers can cover promptfoo version upgrades and checks after Node.js or Travis CI platform changes.
  • Ask any provider to confirm current Travis CI plan limits and hosted build behavior for your account before quoting.

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.