Beginner level · Module 5: Structured AI Outputs · Lesson 1 of 3
Why Agents Need Structured Outputs
Learners see how free-text answers are hard for programs to use and check, and how a fixed structure makes outputs reliable and auditable.
In this lesson you will
- Explain the benefits of structured outputs
- Read and write simple JSON
Key concepts
free textJSON objectfield (key) and valuemachine-readableauditability
The lesson
A free-text answer is easy for people to read but hard for programs to use: where is the deadline, which source was used, should a person check this? A structured output puts each piece of information in a named field.
JSON is the common format: {"answer": "Fees are due by 14 March.", "sources": ["fees-2026"], "needs_human": false}. Keys are names in quotes; values can be text, numbers, true/false, lists or nested objects.
Structured outputs make agents auditable: a program can check that every answer has a source and that money questions are flagged for a person.
Step by step
- Read three free-text answers and extract the same facts into JSON by hand.
- Check your JSON with a validator in the notebook.
- Identify which facts were missing from the free-text answers.
- Draft the fields for the project answer format.
Practice activity
Draft the project assistant's answer format as a JSON example.
Expected result: A valid JSON example with fields for answer, sources, confidence and needs_human.
Check your understanding
-
Why are structured outputs useful for agents?
Show answer
Programs can read and check them reliably.
-
Write a JSON value for true/false.
Show answer
true or false (without quotes).
Further learning
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.