API lesson 03 · Constrain structured output
Shared system · deterministic provider fixtures
Harbor Support Drafting API. One bounded request moves through typed items, tools, state, budgets, and evidence without live provider calls.
01 · Smallest useful mechanism
Structured-output modes constrain generated shapes. Applications still validate provider-supported schema subsets, domain invariants, source evidence, permissions, and safe handling of refusals or incomplete generations.
A valid object is a candidate for business logic, not proof that the business claim is correct.
02 · Experiment
Deterministic protocol fixture
This workbench uses inspectable provider-event fixtures and injected failures. It does not make live calls or execute external effects.
Protocol workbench · harbor-schema-v1
Question to consider
Complication
The candidate is schema-valid but references another customer and an expired policy.
What would you do?
Choose the approach you would be prepared to defend in a design review.
Consider the trade-offs first.
Choose an answer, then run the scenario. You’ll see what the system checks, what happens under the complication, and where the control boundary holds or breaks.
03 · Implementation brief
Your learning artifact
Stored only in this browser. No account required; course reset does not delete it.
04 · Check your understanding
Primary sources · verified 2026-08-02
Teams often remove defensive validation after enabling a strict mode, then execute plausible but unauthorized or internally inconsistent values.
Common mistake: Strict structured output makes hallucinations impossible. It can guarantee supported structural constraints, not truth, freshness, authorization, or correspondence to external evidence.
Transfer exercise: Generate a schema-valid return decision whose deadline predates the purchase and whose customer ID belongs to another account.
Next: Tool calling uses the same structured boundary, then adds the possibility of a real external effect.