Agents and AutomationLesson 11 of 72

Module 2 · The machinery: transcript, tools, loop

A schema constrains the shape, not the truth

In this lesson

  • 9 min read
  • 7 reading sections
  • Knowledge check
  • Lesson 2 of 11 in this chapter

This chapter’s goalTrace any agent run from its message list (tool definitions going in, tool results coming back) and explain from the transcript alone why the model chose each step.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 8Free · no account needed
Lesson steps

How the guarantee is produced

When you ask a provider for JSON matching a schema, most of them do not ask politely and hope. They constrain the sampler. At each step the model produces a distribution over the next token, and the runtime masks out every token that would make the partial string impossible to complete into a valid document. If the schema says the next thing must be a key from a fixed set, only those tokens survive the mask.

That is why structured output is reliable in a way prompt instructions are not. It is also exactly why the guarantee is narrower than people assume. Masking operates on the grammar. It knows what shapes are legal. It knows nothing about invoices.

Tool calling is the same machinery wearing a different name: a schema per tool, the model emits an object matching one of them, and your harness dispatches on it.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the Context Engineering exam.

Stuck on something?Ask Mai, your AI tutor

How to cite: Addaly (2026) ‘A schema constrains the shape, not the truth’, in Agents and Automation. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/agents-and-automation/structured-output-and-schemas (Accessed: 27 November 2026).