Blog · Guardrails

Testing workflows whose output changes every run

November 30, 2026 · The Murmurator team

The standard testing contract is: given this input, expect exactly this output. It has worked for decades because software is deterministic.

Put a language model in the middle and the contract breaks. The same input produces a different summary each time — both correct, neither matching a stored string. Teams hit this, conclude the workflow can't be tested, and ship on the strength of having watched it work.

There's a lot of testable surface left. It just isn't the output string.

Test the structure, not the prose

Most agentic steps produce something with a shape, even when the wording varies. Assert on the shape:

  • The output parses as the declared schema
  • Required fields are present and non-empty
  • Enums contain a legal value
  • Numbers are within a plausible range
  • IDs referenced in the output exist in the input

This catches a large share of real failures — truncated generations, malformed JSON, invented category values, hallucinated record IDs. None of it depends on the exact words.

Where you can, constrain the output format at the boundary so violations are impossible rather than detected. Then the test is verifying the constraint is wired up, which is a cheaper test.

Test the tool calls

For agentic workflows, this matters more than the text. The actions taken are the part with consequences.

Run against recorded fixtures with side effects stubbed, and assert on the call trace:

  • Only tools from the expected set were called
  • No write tool was invoked on a read-only path
  • The number of calls is within a ceiling
  • Arguments reference entities from the input, not invented ones
  • Calls that should be gated were gated

A test asserting that the triage workflow never calls delete_ticket is valuable, stable across model versions, and completely indifferent to how the summary was phrased.

This is also where injection tests belong. Feed a ticket whose body contains instructions to exfiltrate data, and assert the call trace is unchanged. That test is worth more than any amount of reading output.

Test invariants, not values

Properties that must hold regardless of wording:

  • Every entity mentioned in the summary appears in the source
  • A classified priority of urgent co-occurs with at least one urgency signal in the input
  • Total spend for a run stays under the cap
  • The run terminates within N steps
  • On the error path, the partial state is cleaned up

Property-based thinking suits this well: generate varied inputs, assert invariants rather than outputs.

Golden sets with graded scoring

For quality rather than correctness, keep a set of representative inputs with known-good expectations, and score rather than match.

Scoring options, from cheap to expensive: exact match on structured fields; overlap metrics for extraction; a model-based judge with a rubric for subjective quality; periodic human review of a sample.

Two cautions about model-based judging. It's genuinely useful for regression detection and genuinely unreliable as an absolute measure — a score of 8.1 means little, while a drop from 8.1 to 6.4 on a fixed set means something. And the judge is itself non-deterministic, so pin its version and treat judge changes as a reason to rebaseline.

Track the score over time. The question is never "is this good" but "is this worse than last week."

Freeze what you can

Non-determinism you don't need is non-determinism you shouldn't have:

  • Record and replay model responses for CI. Real calls in the test suite are slow, expensive, flaky, and change under you when the provider updates.
  • Pin model versions in tests. Treat a version bump as a deliberate change with its own evaluation run.
  • Fix seeds and temperature where the provider supports it. This reduces variance; it rarely eliminates it, so don't build tests that assume it did.
  • Stub the clock and IDs. Ordinary hygiene, and it removes noise that would otherwise be blamed on the model.

With replay, most of the suite becomes deterministic and fast. Reserve live calls for a smaller nightly job.

Test the failure paths hardest

The paths most likely to be wrong are the ones nobody demos:

  • The model returns malformed output
  • A tool call times out
  • A connection's credentials have been revoked
  • The input is empty, enormous, or in an unexpected language
  • The model calls the same tool in a loop
  • A gate times out with no response

For each: does the run fail safely, is partial state cleaned up, is someone told? These tests are fully deterministic — you control the failure — and they cover the scenarios that produce incidents.

What good coverage looks like

A suite for an agentic workflow, roughly in order of value:

  1. Schema and structural assertions on every model output
  2. Call-trace assertions, including a no-forbidden-tools test
  3. Injection cases asserting the trace is unchanged
  4. Failure-path tests with deterministic stubs
  5. Invariant checks on limits, termination and cleanup
  6. A scored golden set, tracked over time
  7. A small live smoke test on a schedule

Nothing here asserts on a generated sentence, and together they cover the failures that actually happen. "It's non-deterministic, so we can't test it" is a conclusion drawn from the first item on the old checklist rather than from the list of things that go wrong.

Where this lives in Murmurator

We built evals around this list. An eval replays one step of a workflow from a real run, with the steps before it held to their recorded outputs and every tool that posts, sends or writes stubbed and recorded. Its checks are the ones above: exact fields and allowed values for structure, called and not_called for the call trace, a stubbed tool that fails: for the error paths, and a judge rubric, on a model you can pin, for the parts no matcher reaches. Automatic Evals replays them on every new version, which is the "worse than last week" question asked on every change instead of every week.

It doesn't cover all of the list. Inputs aren't generated for you, so property-style testing is as many fixtures as you write, and a run's spend cap and step limit are enforced by the engine rather than checked by an eval. The rest of the list is a good guide to what's worth an eval in the first place.

Turn one person's AI process into the company's.

Murmurator is invite-only. Already invited? Sign in and build something real.