# Promptfoo Replay: Test Saved AI Outputs Without Another Model Call

> Replay synthetic or redacted responses with Promptfoo Echo and separate JSON schema validity from correct business decisions.

Canonical article: https://modelrovia.com/guides/promptfoo-replay-saved-outputs/
Author: Modelrovia Editorial
Published: 2026-11-09
Updated: 2026-11-09

## Key takeaway

Replay saved responses through a schema check and a separate expected-value check before using the results in CI.

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](/examples/promptfoo-output-replay.yaml). 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:

~~~sh
PROMPTFOO_DISABLE_TELEMETRY=1 npx --yes promptfoo@0.125.1 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](https://www.promptfoo.dev/docs/providers/echo/) using a different task and independently specified expected answers. For the original application side of this problem, see [DeepSeek JSON output validation](/guides/deepseek-json-output-python/).

## 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

- [Promptfoo Echo provider replay guide](https://www.promptfoo.dev/docs/providers/echo/)
- [Promptfoo deterministic assertions](https://www.promptfoo.dev/docs/configuration/expected-outputs/deterministic/)

[Editorial standards](https://modelrovia.com/methodology/)
