Validate untrusted model output against a small schema before application code consumes it.
Required APIdef validate_structured_output(payload, schema, allow_extra):
return {'valid': ..., 'errors': [...]} BehaviorThink through the mechanism first if you want the extra reasoning step. It never blocks the editor.
validate_structured_output({'answer': 'yes', 'score': 2}, {'answer': 'string', 'score': 'number'}, False)typed output can cross the application boundary
validate_structured_output({'answer': 'yes'}, {'answer': 'string', 'score': 'number'}, False)missing evidence is a validation failure
2 hidden edge tests run after the visible contract passes.
Run Tests to see the contract verdicts here.