How promptfoo generate assertions bootstraps checks for an existing suite
A team with test cases and prompts but few assertions usually needs a starting set of checks before a regression run tells it anything useful. The promptfoo generate assertions command is aimed at that gap. Based on the promptfoo documentation, it reads the prompts and test cases already in your configuration and uses a model to propose assertions for them. Confirm the exact flags, the output location and the provider the command calls in the current CLI help before you script it, because options can change between releases. The command speeds up the first pass across the suite, so the review that follows is where the real effort goes.
The output of the command is a draft that needs review before it grades anything. Each generated assertion is a claim about what a good answer looks like, and that claim can be too loose to reject a bad answer or so tight that it fails correct ones. Check every assertion against a few outputs you know are wrong, a few you know are right, and the expected behavior written in the test case. Assign a reviewer who knows the product and the prompt's purpose, since that person is usually better placed to say what a wrong answer looks like. Keep the accepted assertions in version control next to the test cases so each change can be reviewed and traced.
Generation helps most when the suite is large enough that writing each assertion by hand is slow, the prompts are stable, and a reviewer is available to check the output. Writing by hand is still the better start when the team has not yet agreed what a correct answer means, when the check depends on a business rule or regulated wording that only a domain owner can state, or when one safety-critical behavior matters more than broad coverage. In those cases, write a few assertions by hand first, confirm they fail on known bad outputs, and use generation later to widen coverage. Ask whoever runs the platform which model the command will call and where prompts and test data will be sent, since evals run on your machine but model calls go to the provider you configure.
Which options for promptfoo generate assertions fit your suite
This table compares the choices that shape assertions from promptfoo generate assertions: the model that drafts them, the test cases that feed it, where output lands and whether checks are deterministic or model-graded. Read each row for when the option fits and how much review it adds. The main takeaway is that every generated assertion needs a human check against known bad answers before it gates anything.
| Decision | When it fits | Review effort it adds |
|---|---|---|
| Provider that writes candidates | Fits when an approved, stronger model is available for drafting. Keep the drafting model separate from the app under test. | Moderate. Reviewers check that assertions reflect your policy, not the drafting model's habits. |
| Existing test cases as input | Fits when the suite already has representative cases with clear expected outcomes. | Higher if inputs are thin or narrow, because generated checks mirror the examples you feed in. |
| Output to a separate file | Fits when reviewers must approve each candidate before it runs in CI or gates a release. | Highest up front. Someone reads every candidate and merges only the ones that catch bad answers. |
| Output written straight into config | Fits for a throwaway exploration branch or a small suite whose behavior the team knows well. | Lower now, higher later. Unreviewed checks can pass weak answers and enter the baseline unnoticed. |
| Deterministic checks | Fits format rules, required fields, banned strings, length limits and exact values. | Low. The logic is readable, but confirm each pattern or threshold matches the intended rule. |
| Model-graded checks | Fits tone, faithfulness or policy wording that code cannot express reliably. | Higher. Reviewers must check the grading rubric and test it against known good and bad answers. |
| Flags and defaults | Confirm exact option names and defaults in the current promptfoo documentation before scripting them. | Low on paper, but a wrong flag can silently change the provider or the output path. |
Running promptfoo generate assertions on an existing suite
This sequence runs the assertion generator against a suite you already have, keeps its output apart from your working config, and merges only the checks a reviewer has confirmed would fail a bad answer. The result is a review record showing which generated assertions were accepted, edited or rejected, and why.
Confirm the Node.js and promptfoo versions
Run
node --versionandpromptfoo --versionon the machine that will run the generator, then write both values in the review log. The npm release 0.124.1 requires Node.js 22.22.0 or newer, so an older Node.js install should block the run before any assertion is produced. Check the promptfoo npm package page for the current release, and runpromptfoo generate assertions --helpto confirm the options your version supports. Done when both versions are recorded and the help output matches the command your team plans to use.Back up the config and test files
Copy the config file, every prompt, provider and test file it references, and any CSV or spreadsheet sources into a dated backup folder or a branch your team can restore from. Commit or tag the current state so later diffs show only generator changes. Run
promptfoo evalagainst the copy and save the pass and fail counts as the baseline. Done when the backup lists every referenced file and the baseline results are saved next to the review log.Select a small representative test subset
Choose a set of test cases that covers your main input types, known edge cases and the failure modes your reviewers care about most, such as refusals, formatting errors or regulated content. Place them in a copy of the config that points only at this subset, so the generator works from a small, representative set. Keep the set small enough that one reviewer can read every proposed assertion against its test case in one sitting. Done when the subset config runs with
promptfoo evaland every selected test ID is recorded in the review log with the reason it was chosen.Run the generator into a review folder
Run
promptfoo generate assertionsagainst the subset config and direct its output to a review folder, keeping the live config untouched. Confirm which model provider the generator calls, because the test inputs are sent to that provider, and check that the provider is approved for the data in these tests. Record the exact command, the provider, the timestamp and the output path in the review log. Done when the review folder holds the generated assertions and the live config file still matches its backup checksum.Read each proposed assertion against its test
For each proposed assertion, open its matching test case and ask two questions: would a clearly wrong answer to this input fail, and would a correct answer pass. Flag assertions that only check length or style, keywords a bad answer could still contain, and model-graded checks that depend on a judge model your team has not reviewed. Mark each assertion accepted, edited or rejected in the review log with a one-line reason and the reviewer's name. Done when every proposed assertion has a decision and a reason, with no blank rows in the log.
Merge accepted assertions into the live config
Copy only the accepted and edited assertions into the live config, and leave rejected ones out. Keep the change limited to assertion blocks so the diff shows exactly what the generator contributed. Compare the diff against the review log, confirming that each accepted row appears once and that no rejected row appears. Done when the diff matches the log line for line and the change is committed with a message that cites the review log entry.
Run a dry eval and log results
Run
promptfoo evalon the full suite with the merged assertions and compare the results against the baseline from the second step. Investigate every case that moved from pass to fail, and decide whether the assertion is too strict or the output is actually bad. Also write one deliberately wrong output for a covered case by hand and confirm that the new assertions reject it. Done when the comparison and the bad-output check are recorded, with the eval ID, commit hash, reviewer names and date in the review trail.
How generated assertions move from draft to trusted check
The flow starts with the test cases and prompts already in your suite. The assertion generator reads them and proposes candidate assertions, which stay as drafts until a person reviews them. The human review gate is the key hand-off: a reviewer runs each candidate against known good answers and known bad answers. A candidate should pass the good answers and fail the bad ones before it is kept. Rejected candidates go back for editing or deletion. Accepted candidates merge into the suite and then run in local or CI evals.
Generated assertions join the suite only after a human review gate.
Testing whether promptfoo generate assertions output rejects bad answers
A generated assertion that passes on the current model output shows only that it matches that output. It may still pass wrong answers. An assertion built from good answers often keys on surface features such as a keyword, a JSON shape or a length range, and a fluent wrong answer can carry those same features. The core risk is a false pass: the eval goes green, the assertion is counted as coverage, and nobody learns that the check would have accepted a bad answer. Treat every generated assertion as untested until you have seen it fail on purpose.
Build a small set of deliberately poor answers for each prompt that the generated assertions cover. Include wrong facts that keep the correct format, output that omits a required field such as an identifier, status or citation, unsafe or off-policy text that breaks your content rules, and truncated output that stops mid-sentence or mid-object. Give each bad answer its own test case and label it with the failure it represents, so a failing result points to the weak check. Run every generated assertion against every bad answer and confirm that each one fails. Check the promptfoo documentation for the current way to supply fixed outputs to a test, so the same bad answer is graded identically on every run.
A green run on current outputs proves little on its own, because those outputs are the cases the assertion was written to match. The test for each assertion is whether it rejects the deliberately poor answers. If an assertion accepts even one of them, narrow it, replace it, or pair it with a separate check and review that check with a person. Store the bad-answer set in the same repository as the suite, so later changes to prompts, models or providers are tested against the same failures. Before the assertions go into a suite that others rely on, ask the suite owner to confirm which failure types each assertion is meant to catch and which bad answer demonstrates it.
Review failures that let bad answers through
Generated assertions usually look complete on the first run, so the review has to find the ones that pass bad answers. Each card names a failure a reviewer can see in the results and the fix to apply before the suite is trusted. Check every generated assertion against a few answers you already know are wrong.
Loose string and regex checks
A generated regex or contains assertion often matches a keyword the answer uses anyway, such as a refusal that repeats the question or an apology that mentions the product name. Reviewers should see passes on answers that are wrong or empty. Run each check against a deliberately bad answer, such as an empty string or a refusal, and confirm it fails. Tighten patterns to the exact value, identifier or format the answer must contain.
Checks tuned to today's wording
Generated assertions are built from the output the model gave when the suite was created, so they often copy its exact phrasing, sentence order or citation style. The symptom is a suite that passes today and fails correct answers after a harmless prompt or model change. Replace phrase matches with checks on the facts the answer must contain, such as the amount, date or entity. Then rerun the suite on a paraphrased answer to confirm it still passes.
Judges with unstated criteria
llm-rubric assertions grade against whatever the judge infers from a short sentence, so they can reward length, confident tone or agreement with the question. A rubric that never states what a failing answer looks like will pass most outputs. Write pass and fail conditions into the rubric, pin the judge model, and hand-grade a sample of answers to measure whether the judge agrees with you.
Duplicated assertions inflate coverage
Generation often produces several assertions that test the same behavior under different wording, so the assertion count rises without any new check. A high count of passing assertions can hide that only two or three behaviors are covered. Group the generated assertions by the behavior each one tests, delete the duplicates, and list the behaviors that remain uncovered so the team can see the suite's actual coverage.
Format checks without correctness
An is-json or schema check confirms the answer has the right shape, but it says nothing about whether the values inside are right. A structured answer with wrong figures passes every format assertion. Pair each format check with a content assertion that compares a field to the expected value in the test case. Include at least one test where the format is right and the value is wrong, and confirm the suite fails it.
Thresholds that hide failures
When a run keeps failing, the quickest fix is often a lower threshold or a looser score, and the suite turns green without any answer changing. Thresholds loosened after a failed run turn the suite into a record of passes. Set each threshold from the review findings, record who changed it and why in version control, and make sure a regression against the previous run still fails the build.
Where generated assertions run: laptop, CI or self-hosted server
On a laptop, the promptfoo CLI runs as a local process and talks directly to the model provider you configure, so prompts, outputs and API keys move only between your machine and that endpoint. This is the fastest place to draft assertions for an existing suite, and it is where most drafts get reviewed first. Reviewers usually need to see the generated checks fail a few known bad answers, which a passing run alone does not show.
- What reviewers need: the config file, the provider and prompt used for generation, and a record of which generated checks were kept, edited or dropped.
- Where files live: generated assertions are written to the config or output path you name on the command line, inside the project folder, so they can be committed to version control.
- Who holds the keys: provider credentials sit in environment variables or a local
.envfile, which must stay out of the repository. - Drift between machines: two developers using different models or versions can generate different checks, so pin the provider and the promptfoo version in the project.
- Local results: results from local runs stay on that machine unless you export them, so copy anything the audit trail needs into a shared location.
Confirm the exact generation flags with promptfoo generate assertions --help in the version your team pins, and check that your provider terms allow test data to be sent from developer machines.
In a CI pipeline, promptfoo runs on a runner that your platform provisions, reads the config from the repository and calls the model provider from that runner. Generation fits best when a job proposes new checks in a merge request that a person reviews before merging. The pipeline then becomes the record of when, with which settings and by whom the assertions were produced.
- What reviewers need: the job log showing the command and provider, the promptfoo version, and a diff of the generated assertions in the merge request.
- Where files live: generated output sits in the runner workspace and disappears when the job ends unless you save it as a pipeline artifact or commit it to a branch.
- Secrets: provider keys should come from the CI secret store, scoped and masked for the job, and never written into the config file.
- Network access: the runner needs outbound access to the model endpoint, which restricted networks may block, so confirm egress rules with your platform team.
- Runtime version: the npm release requires Node.js 22.22.0 or newer, so pin the runner image to a version that meets that minimum.
Confirm with your CI platform team how long artifacts are retained, who can read the secret variables and whether generated test data may leave your network through the runner.
The self-hosted promptfoo app is an Express server that serves the web UI and API, and it can be deployed with Docker, Docker Compose or Kubernetes with Helm. It gives a team one shared place to view evals, but its storage and access model limit what it can safely hold. Data is kept in a local SQLite database that cannot be shared across replicas, and the app has no RBAC, no horizontal scaling and no built-in authentication or SSO, which is why the self-hosting documentation notes it is not recommended for production use.
- What reviewers need: confirmation that the server is a single instance with no role separation, so anyone who can reach it can see every stored result.
- Where data lives: the SQLite file sits on the persistent volume of one container or pod, so back up that volume before any upgrade or node change.
- Identity: because the app has no built-in SSO, access control must come from a reverse proxy or network layer you operate, and that design needs its own security review.
- Scaling: a second replica would get its own database, so keep one instance and schedule restarts with the team that uses it.
- Paid alternative: the Enterprise tier adds SSO and teams-based access control, so compare it with your requirements before you commit to a design.
Before a team depends on it, confirm the volume and backup schedule, the proxy authentication, who can reach the server from your network and whether a production deployment fits your requirements.
Security and data handling when generated assertions use a model
Generating assertions sends content from your suite to a model, and the assertion files it writes then decide what passes in your pipeline. The cards below cover where that data goes, how the generator's credentials are handled, how changes are reviewed and recorded, and what the self-hosted app does not provide for access control.
Data sent to the generator's provider
Prompts, test data and model responses leave your environment when the generator calls its configured provider. Promptfoo itself runs locally and talks directly to the LLM, but the provider that writes assertions is a separate network destination. Before running the command, confirm which provider is set, whether that provider is approved for the data in your suite, and whether the suite contains customer records, credentials or personal data that should be removed first.
promptfoo introductionGenerator provider credentials
The API key for the generator's provider is a secret that can spend your model budget, so keep it out of assertion files and repositories. Load it from your CI secret store or a local environment variable, give generation its own key with a spending limit where the provider offers one, and rotate it on a fixed schedule and whenever someone with access leaves. Check that run logs and exported eval files do not echo the key.
Review assertion changes in git
Generated assertions are text in files under version control, so treat each generated change as a code change that needs review. Open a merge request, read the diff against the existing assertions, and run the suite against an answer you know is wrong. An assertion that passes a bad answer is a defect, and a reviewer should be able to see it in the diff before it reaches your main branch. Require at least one reviewer who owns the application's expected behavior.
Record who accepted each assertion
Accepting a generated assertion is a decision about what your suite will enforce, so record the generator model, the approver and the date with each accepted change. Put these in the commit message or merge request, along with the eval run that showed the assertion rejecting a bad answer. Git history keeps the author and diff, but it does not record which model produced the text, so that detail has to be written down by the team.
Self-hosted app lacks access control
The self-hosted promptfoo app has no RBAC or SSO, built-in authentication, and it is not recommended for production use. Anyone who can reach the server can view and change eval data, so keep it on a network your team controls or place it behind an access layer you run. The Enterprise edition lists team access control and SSO, and On-Premise runs that functionality on your own infrastructure. Those features are not described as covering the assertion generation command, so confirm that with the vendor before relying on them for this workflow.
self-hosting docsWhat does it cost to generate and review assertions with promptfoo?
Is the promptfoo Community edition free for generating assertions?
The promptfoo Community edition is free, and the MIT license covers the software itself. It includes all LLM evaluation features, all model providers and integrations, and red teaming with 10k probes per month, with community support. Enterprise is sold at custom pricing and adds team sharing, SSO, custom roles, continuous monitoring and priority support with SLAs. Before you plan around the free tier, confirm on the promptfoo pricing page that the features you need and the volume of runs you expect are covered. For most teams, the larger spend will be model provider usage and reviewer time rather than the tool license.
What drives the cost of generating and reviewing promptfoo assertions?
Cost comes from four places: model calls, people, infrastructure and any services you buy.
- Model calls cover the generation step and every eval run that grades outputs with an LLM. Your model provider bills these, because promptfoo runs locally and talks directly with the model.
- People are usually the largest variable. Someone with domain knowledge must decide which generated assertions reject bad answers.
- Infrastructure covers CI runners and any self-hosted promptfoo server you run.
Effort rises with the number of prompts, the number of generated assertions, the variety of answer types (free text, structured output, retrieval-grounded answers) and the number of rework rounds a reviewer needs. Effort falls when expected answers are already written down and reviewer criteria are agreed before generation starts.
How long does reviewing generated promptfoo assertions usually take?
There is no fixed duration, so check any number you read elsewhere against your own suite. Review time depends on how many assertions are generated, how many survive first-pass screening, how complex the application's answers are, and whether reviewers can judge correctness without repeatedly asking the application owners. Fixing assertions that pass bad answers often takes more than one round, and each round adds time. Ask any provider to state the review timeline in the written scope, with the milestones that trigger the next step. DeployOpen agrees timelines in writing before fixed-scope work starts, so the scope document is where the duration should appear.
What does our team need to provide for an assertion review?
Plan for the client team to provide the following before work starts:
- Access to the existing promptfoo config, prompts, providers and test files, held in version control.
- A model provider account and API key for generation and eval runs, with a usage budget that your team sets.
- A representative set of inputs with known good and known bad answers, labeled by someone who knows the domain.
- A named reviewer who signs off on each assertion and has authority to reject them.
- A CI runner or environment where the suite can run, if the suite will gate changes.
- Written criteria that define a bad answer in your domain.
These people are usually the slowest dependency, so request their time and approvals early in the scope.
Can our internal team generate and review assertions without a partner?
Yes. The promptfoo software is MIT licensed and the Community edition is free, so an internal team can generate and review assertions on its own. You need an engineer comfortable with the promptfoo CLI and Node.js 22.22.0 or newer, which the 0.124.1 npm release requires, plus a reviewer who understands what a wrong answer costs in your domain. The hardest part is usually reviewer time and the discipline to reject assertions that pass bad answers, not the tooling. A partner adds value when those people are unavailable, when the suite needs an independent review before a compliance assessment, or when the team wants a second set of eyes on assertions it has already accepted. Decide by comparing the reviewer hours you can commit with the scope you need.
Which promptfoo assertion costs are one-time and which recur?
One-time work includes the initial scope, the first generation run, the first review pass, building the reviewed assertion files and wiring the suite into CI. Recurring costs include model provider usage on every eval run that calls a model, CI runner time on each commit or scheduled run, re-review whenever prompts, models or application behavior change, and any Enterprise subscription or retainer you choose. Generation is typically a periodic step, while eval runs repeat constantly, so the recurring line is usually the larger one over time. Ask for the recurring assumptions in writing: runs per week, which models grade outputs, and who owns the budget. DeployOpen offers ongoing support, upgrades and continuous testing as retainers, scoped in writing.
What should a written scope for assertion work include?
A written scope should name the application and prompts under test, the number of test cases and suites in scope, and the model providers used for generation and grading. It should also say who labels expected answers and who signs off on each assertion. Deliverables to request include the reviewed assertion files, a record of rejected assertions with reasons, the CI integration and a retest after changes. Add the review criteria, the client responsibilities, the milestones, the exclusions (such as changes to the application itself) and who pays model usage. DeployOpen agrees scope, deliverables and timelines in writing before work starts, and a quote follows from that written scope. DeployOpen does not publish a price list.
Limits to confirm before you rely on generated assertions
The generator's output is only as dependable as the setup around it. Each card below is a question to answer from the vendor documentation or from a test run in your own environment before you accept the assertions it writes.
Command syntax and assertion types
Confirm the exact promptfoo generate assertions syntax, flags and output format in the version you install, since commands can change between releases. Also check which assertion types the generator can emit for your test shape, and whether it can produce rubric-style checks. Run the command against a copy of your config first and read what it writes before you point it at your main suite. Do not assume a flag from an older tutorial still works.
Generator provider and model pinning
Find out which provider and model the generator calls by default, and whether your config or a command flag can pin it. An unpinned generator can change between runs or versions, which changes the checks you review and the wording of any rubrics. Confirm the generator uses a provider your data policy approves for the application under test. Record the pinned model name in your repository so reviewers know which model wrote each check.
Large and multi-turn test sets
Check whether the generator reads every test case in a large suite or samples some of them. Multi-turn conversations need care: confirm whether the generator sees the full transcript, which variables carry earlier turns, and what the expected outcome for the final reply should be. Long inputs can exceed the model context window, so run the command on a set at your real size and compare the output with a hand-reviewed sample. Note any cases that were skipped or summarized.
Merging with hand-written assertions
Confirm whether generated output is appended to existing assert blocks, replaces them, or lands in a separate file. Duplicate checks can slow a suite and can hide a missing case behind a near-copy. Check that a rerun does not silently remove assertions a reviewer wrote by hand. Keep hand-written checks in version control, diff the generated output against them, and decide which file is the source of truth before the first regeneration.
Node.js and promptfoo version support
Confirm the feature is documented for the promptfoo version you run and for your Node.js runtime. The npm release 0.124.1 requires Node.js 22.22.0 or newer, so an older runtime in a CI image will fail before the command runs. Read the release notes for the version you install, pin both versions in your pipeline image, and re-run the generator after every upgrade, because flags and output format may change.
promptfoo releasesCost and rerun behavior
Each generation run calls the model provider, so confirm what is billed per run and whether the command can reuse earlier output. Model output can differ between runs on the same input, so compare two runs before you treat one result as the baseline. Ask whether test content leaves your environment only through the provider you chose. Agree on who reruns the generator, and when, so the assertion set does not drift without review.
How DeployOpen scopes and delivers assertion bootstrapping
Most DeployOpen engagements are fixed-scope, so the scope for generated assertions is agreed in writing before work starts. We run the work inside your own infrastructure, where promptfoo runs locally and talks directly with the models under test, and we document the review of each generated check so your team can maintain it.
How we scope
- Inventory the existing suite: prompts, providers, test cases and the assertions already in use.
- Agree which tests receive generated assertions and which must stay hand-written, such as known regressions and business rules.
- The written scope names the generation provider, the review gate and the retest criteria before work starts.
How we build
- Run promptfoo generate assertions against a copy of the suite so the live configuration stays untouched during review.
- Check each generated assertion against a deliberately bad answer to confirm it actually fails.
- Remove or tighten assertions that accept vague, empty or off-topic output, and record why each change was made.
How we hand over
- Reviewed assertions delivered in version control, with each check tied to the test case it protects.
- A review log listing rejected, edited and accepted assertions, with the bad-answer examples used to test them.
- A short runbook for your team on rerunning generation, reviewing new output and retiring stale checks.
How we support
- Ongoing support is available as a retainer that covers promptfoo upgrades and review of newly generated assertions.
- Retest after each change to prompts, models or providers, using the same bad-answer examples as the original review.
- Confirm in the written scope what support and response terms apply before work starts.

