Structured outputs and multi-step workflows
Request and validate a structured output, and design a multi-step workflow with checkpoints.
Why structure the output
Structured outputs — tables, lists with fixed fields, JSON — are easier to compare, check and reuse. They let you paste results into a spreadsheet, feed them into another prompt or process them with a script.
Asking for structured output
Describe the structure exactly and show an example:
Extract every action item from the meeting notes below.
Return JSON only, as a list of objects with exactly these fields:
- "task": string, starting with a verb
- "owner": string, a role from the notes, or null if no owner is named
- "due": date as YYYY-MM-DD, or null if no date is given
Example: [{"task": "Book the venue", "owner": "Events lead", "due": "2025-03-14"}]
Notes:
<notes>
(paste notes)
</notes>
Key points: name every field, give types, say what to do when information is missing (null), and say "JSON only" if another tool will read it. Some AI platforms offer a "structured output" or "JSON schema" setting that enforces a format; use it when available, but still validate the result.
Validate before you trust
Even well-formed output can be wrong. Check:
- Shape — valid JSON? Every field present? Correct types?
- Content — does every value come from the source? Any invented owners or dates?
- Coverage — were any items missed? (Compare counts against the source.)
Multi-step workflows
A workflow connects several prompts (and sometimes tools) to complete a larger job. Design it on paper first:
- Steps — what each prompt does, with its own instructions and output format.
- Handoffs — what passes from one step to the next (only the approved output, not the whole conversation).
- Checkpoints — where a human reviews before continuing, especially before anything is sent, published or decided.
- Failure handling — what happens if a step's output fails validation (retry once, then escalate to a person).
Example: weekly customer-feedback digest
- Classify each comment (few-shot classifier) → table.
- Validate: every comment has exactly one label → if not, flag for review.
- Summarise top themes per label with quoted evidence.
- Human checkpoint — check themes against comments.
- Draft a 150-word digest for the team using the approved themes.
Keep humans in the loop where it matters
Automating a workflow does not remove responsibility. Put review steps before outputs reach customers, affect people's records or money, or are published. Note in your workflow who reviews and what they check.
Practice exercise
Design a small workflow for a recurring task of yours.
Submit:
- A step list with the output format of each step (at least one structured output with named fields and a missing-value rule).
- Where the human checkpoint is and what the reviewer checks.
- If you ran the structured-output step: whether it validated, and any invented or missing values you found.