Lesson 3 of 9 · 4 min read
Structured Outputs and Constrained Decoding
Structured outputs constrain a model's generation so its output matches a schema, typically by masking tokens that would break the grammar at each step. That guarantees syntax and, for supported schema features, types and enums. It does not guarantee semantics: a valid refund call can name the wrong order or an amount larger than the charge. A harness checks three layers (parse, schema, meaning), repairs with a bounded, specific error, and handles truncation at the token limit.
free sign-in, no card required
Practise it as an interviewer asks it
What is tool calling, and what actually happens when a model 'calls a tool'?Design the tool definitions an agent sees for an order-management API.Implement a tool-calling loop with validation, a step budget and error results in 45 minutes.Search-and-replace blocks, unified diffs or whole-file rewrites: choose an edit format.Tool arguments fail validation 3% of the time under load. Diagnose it.Wrap your internal REST API as MCP tools: one tool per endpoint?