Why agents need structured output
What it is
A structured output is a model reply in a fixed, machine-readable shape, usually JSON: named fields with typed values. Agents need it wherever code reads the reply:
- tool requests: a tool name and its inputs;
- routing: which category a request belongs to;
- plans: a list of steps with dependencies;
- extraction: fields pulled out of a document;
- verdicts: a judge's score and its reason.
Why it matters
Code cannot branch on a paragraph.
- 'I think this is probably a billing question' needs fragile text matching.
{"category": "billing"}needs one line. - A fixed shape can be checked, counted, stored and compared between versions.
- One malformed reply in a chain of ten steps breaks the whole task, so the shape has to hold every time, not most of the time.
In the real world: A ticket router that searched replies for the word 'billing' misrouted every ticket that said 'this is not a billing issue'; a one-field JSON output fixed it.
Parsing free text with regular expressions because 'the model usually writes it the same way'. It will not, the first time the input is unusual, and the failure will be silent.
Practise it: Design an AI Customer Support Agent