Want to learn evals? buildevals.com →

// USE CASE · STRUCTURED OUTPUT VALIDATION

The JSON parsed. That does not mean it is right.

Structured-output evals run property checks on the answers your agents emit and watch the shape itself, so a missing field, a renamed key or a quietly narrowed enum raises an alert instead of a downstream exception.

THE PROBLEM

Schema drift breaks the system next door

The agent's output feeds code: a parser, a workflow, a database. When a model update renames a field or drops one, the agent looks fine and the consumer breaks. The error report comes from the wrong service.

// HOW RUNAGAIN DOES IT

01Property checks on live output

The structured-output eval scores each sampled run's JSON answer against your property checks, with heuristic scorers like valid_json, json_diff and regex available for the simple cases.

02Shape-drift detection

Beyond pass or fail, structured_output.changed watches the output shape over time and flags when it shifts, catching the model update that reshaped your data before a parser does.

03Scoped where structure matters

Run strict checks only on the agents and routes that emit machine-consumed output, scoped by agent or metadata, with sampling for the rest.

04Gate it before it ships

The same checks run as experiment scorers, so a prompt or model change that breaks the schema fails in CI instead of in production.

00:01.2  span.start plan · model=claude-fable-5
00:01.9  tool.call web_search("return policy france")
00:02.8  tool.result 200 · 4 documents · 1.2kb
eval.inline faithfulness 0.94 ✓
00:03.1  tool.call db.query(orders.recent)
00:03.7  tool.result 200 · 12 rows
00:04.0  span.start generate
eval.inline grounding 0.41 ✗ · cited 30-day, source says 14-day
00:04.6  drift.check baseline Δ +0.9% ok
00:05.1  span.end run_a91f · 4.21s total
00:01.2  span.start plan · model=claude-fable-5
00:01.9  tool.call web_search("return policy france")
00:02.8  tool.result 200 · 4 documents · 1.2kb
eval.inline faithfulness 0.94 ✓
00:03.1  tool.call db.query(orders.recent)
00:03.7  tool.result 200 · 12 rows
00:04.0  span.start generate
eval.inline grounding 0.41 ✗ · cited 30-day, source says 14-day
00:04.6  drift.check baseline Δ +0.9% ok
00:05.1  span.end run_a91f · 4.21s total

Structured checks scoring inline as runs stream through.

FREQUENTLY ASKED

How do I validate that my agent always returns valid JSON?

Attach a structured-output eval (or the valid_json heuristic scorer) as an online eval on the relevant agent. Every sampled run gets a score, failures alert to Slack, and the trace shows the offending output.

What is shape drift?

A change in the structure of the output rather than one bad value: fields appearing or disappearing, types changing, keys renamed. RunAgain tracks the shape over time and alerts when it diverges.

Can schema checks block a deploy?

Yes. Run them as scorers in a CI-gated experiment with runagain-eval and a threshold, and a schema-breaking change exits non-zero before merge.

BUILT ON THESE SOLUTIONS

More use cases: llm cost tracking · reduce llm costs · time-travel debugging · regression testing in ci · prompt a/b testing · hallucination detection · conversation tracing · llm-judge calibration · tool-call failure analysis · tracing coding agents · agent & llm alerting

Be first to run again.

Book 30 minutes and see the loop on your own agents, or write to tamas@runagain.ai.