Key takeaway
Replay saved responses through a schema check and a separate expected-value check before using the results in CI.
On this page
A response can pass JSON Schema and still route a support ticket to the wrong queue. In our three-case replay, Promptfoo accepted the correct response, rejected a structurally valid response with the wrong team, and rejected malformed JSON. The model was never called because the Echo provider replayed saved output.
Run the fixture
Download the replay configuration. It uses three synthetic replies about ticket AB-17. Each has its own expected team and ticket ID. In an empty directory with Node and npm available, run:
PROMPTFOO_DISABLE_TELEMETRY=1 npx --yes [email protected] eval -c promptfoo-output-replay.yaml --no-cache --output replay.json
The first invocation may download the package. The command above uses POSIX environment-variable syntax. We ran Promptfoo 0.125.1 on November 9, 2026 and observed one pass, two intentional failures and zero errors. The CLI returned exit status 100 and wrote the JSON report. Treat that exit status as expected for this demonstration. For a release gate, use fixtures whose expected outputs should all pass.
Understand what failed
| Saved response | Schema check | Expected-value check |
|---|---|---|
| Correct team and ticket ID | Pass | Pass |
| Allowed team, wrong for this ticket | Pass | Fail |
| Broken JSON | Fail | Fail |
The Echo provider hands each saved response to the assertions. The schema requires two fields and constrains team to the allowed queues. The JavaScript assertion checks the exact team and ID expected for that example. That second check catches semantic failure inside an otherwise acceptable structure.
The example adapts Promptfoo’s historical-output replay approach using a different task and independently specified expected answers. For the original application side of this problem, see DeepSeek JSON output validation.
Replace synthetic replies with useful regression cases
Collect a correctly handled example and one example from each failure you want to prevent. Redact personal data and credentials before keeping outputs in a project. Retain the original model/version and prompt version separately, so an old failure can be traced to the conditions that produced it.
Write expected values from an approved ticket or source record. Deriving the expected team from the same model answer makes the check circular. Where the correct action is to escalate, add an explicit escalation value to your contract and a case that requires it.
Use replay and generation at different times
Replay answers whether a change in your assertions or parser would catch known failures. A fresh-model evaluation answers whether a new prompt or model produces better responses on the same labeled inputs. Keep those outcomes separate. An improved replay score after relaxing an assertion says something about the assertion, and nothing about the quality of new model responses.
Sources & references
Written by Modelrovia Editorial. Our standards distinguish official claims from observed results.
How we research and test →

