Ship a Safe Agent

Join the course waitlist

Founding price $149 (regular $199) for the first 50 buyers or through Nov 8. The waitlist gets first access when checkout opens.

No spam, only course updates. Unsubscribe anytime.

Module 2 of 8 · Full course

Trust the output

Schemas with one repair, then fail. Act, ask or skip thresholds in code, not prompts.

What you will build

By the end you will have a refund pipeline that rejects malformed model output, gives the model exactly one chance to repair it, and then routes every valid refund to act, ask or skip using limits in code.

Why it matters

A model that replies "Sure! Here is the refund:" before the JSON, or sends the amount as the string "48.00", breaks naive parsers in production every day. Worse, a retry loop that keeps asking until the output parses can run forever and cost real money. The fix is boring and reliable: a strict parser, one repair, then fail.

Inside this module

  1. 1.Parse strictly
    Turn raw model text into a typed Refund or a list of every error.
  2. 2.A scripted text model
    Make every model reply predictable so every path can be tested.
  3. 3.One repair, then fail
    Give the model exactly one chance to fix its output, using the parser's own error messages.
  4. 4.Act, ask or skip
    Route each valid refund by limits in code, never by the model's opinion.

Every step comes with the exact code diff, a run command, the expected output, a common mistake, a production note and a checkpoint. Then 2 graded exercises (parseAddressChange, handleRefund) checked by npm test, a solution branch, and a 3-question quiz. TypeScript, scripted model, no API key.

Locked

This lesson unlocks with the full course

The full course is delivered as private GitHub repos with the lessons, exercises and solutions. After you buy, you get a read-access invite, so you need a GitHub username.

Checkout opens soon. The waitlist gets first access at the $149 founding price (regular $199), for the first 50 buyers or through Nov 8. No spam, only course updates.

Join the course waitlistStart Module 1 free