The AI Agent Factory

Lab 11: diagnose and fix four failed runs

Status
stable
13 min read
Owner
Panaversity
Approved
Panaversity ·

In this lab you help Dave Kowalski, the controller at Brightline Wholesale Supply, the book's example company. Its AP Worker, an AI Worker, failed four times in one week. AP means accounts payable, the bills a company owes. The worker drafts replies to vendors, which Maria, the office manager, sends. It also runs two recurring jobs on its own. One is the Thursday pre-run note, the summary Dave reads before he approves each Friday's payment run. The other is a duplicate check on each invoice email.

In the week of January 11, 2027, four things went wrong, as this chapter's opening tells. The duplicate check never started. Three replies to vendors gave every vendor the same terms, wrong for two of them. The pre-run note read last year's closed register. And five replies said a file was attached when none was. Dave's first reaction was "Switch to the most expensive model, and Maria, rewrite every brief from scratch." In the lab you find each failure's real cause instead, and fix only that.

Why it matters. A change made before the cause is known can break what already worked, and the fault comes back.

Where you work. Most of the lab is in a folder on your computer. Download brightline-lab-ch11.zip from the Labs companion, unzip it, and open the files in any text editor, such as Notepad or TextEdit. Step 4 also uses a spreadsheet app. Step 6 runs one task in Claude and one in ChatGPT Work, so it needs a paid Claude plan and a ChatGPT plan that includes Work, such as Plus or Pro. If you have only one of them, run it there, and mark the other "not run". No server is needed. Every record in the lab is invented. Never practice on real financial data.

You can also do the lab with the Claude or ChatGPT desktop app. Open the folder in the app, and ask it to read LAB.md, the lab's instruction file, and start. You make every decision and give every answer, and the app writes your answers down.

How long. About six hours in total: the eight steps below add up to 350 minutes, and the optional part of step 8 adds about 15 more. Take them in two sittings: steps 1 to 4, then steps 5 to 8. Each step ends with a file saved, so you can stop after any step.

What the lab gives you.

  • What went wrong in the week of January 11, day by day
  • The four task records, one for each failure
  • The three briefs as they were, for the Thursday note, the duplicate check and Jordan's replies, and each vendor's payment terms
  • The closed 2026 register and the live 2027 register
  • The usage report for Maria's account that week
  • The worker's early-payment discounts, with the invoices behind them
  • Maria's log of her corrections to the Thursday note, and two replies to the same kind of dispute
  • The worker's Role Contract as Draft 7: the one-page definition of its job (Chapter 2)
  • Answer keys, to open only when a step says so

What you do. Do the steps in order. LAB.md gives the full directions, one Part for each step. Read each Part when you reach its step, not all at once.

  1. Predict, then contain (LAB.md Part A, 45 minutes, in the folder). Before you open any of the lab's input files, write for each failure the check you would run first, and what result would prove your first guess wrong. Then contain each failure: what you stop, what access you remove until the cause is known, and what you check outside the conversation. You save: results/prediction.md and results/containment-log.md.
  2. Diagnose (Part B, 45 minutes, in the folder). Read the four task records. For each failure, name the cause, the line in the record that shows it, and the one-minute check that tests it. Write each check that a person skipped. You save: results/diagnosis.md.
  3. Check usage (Part C, 30 minutes, in the folder). Use the usage report to explain why the duplicate check stopped and why the Thursday note still ran. Then propose who owns the budget for recurring jobs. You save: results/usage-check.md.
  4. Investigate the discounts (Part D, 30 minutes, in a spreadsheet). Work out the early-payment discounts again, and find each wrong figure and its cause. Then rewrite the brief so the arithmetic is a calculation. You save: results/discount-check.md.
  5. Fix the briefs (Part E, 55 minutes, in the folder). Rewrite the three briefs, one change at a time, and say which lever each change pulls: the brief, the inputs or the permissions. Give each recurring job a success signal, and a failure path, the steps the job takes when something goes wrong. You save: results/fixed-briefs.md and results/success-signals.md.
  6. Run and port (Part F, 60 minutes, in Claude and ChatGPT Work). Run the fixed Thursday brief as a one-off task in Claude, as of January 14, 2027. Then port it: run the same brief in ChatGPT Work. Write what a live scheduled version would need on each AI vendor. You save: results/thursday-note-run.md and results/port-notes.md.
  7. Make the fixes last (Part G, 45 minutes, in the folder). Turn Maria's log into a promotion table, and plan a baseline, a metric and a run of the old and new setups side by side. You save: results/promotion-table.md and results/baseline.md.
  8. The Role Contract (Part H, 40 minutes, in the folder). Write Draft 8 of the AP Worker's Role Contract. Add the success signals, the failure paths, read-only access to the Remittances folder, the reviewer's checks and a named owner for the usage budget. Look back at your prediction. If you choose, apply what you learned to your own field: write the success signal, the failure path and the usage owner for one job you run often. You save: role/ap-worker-role-contract.md, and results/my-workflow.md if you did the optional part. The lab is not finished until the Role Contract is saved.

Domain expert and builder. The AP expert gives the vendor terms, the register's normal size and age, and what counts as a correct pre-run note. The builder writes the checks and the failure paths.

Exam notes

These notes are not part of the lab. CCAO-F, Anthropic's Claude Certified Associate: Foundations, follows an exam guide written in July 2026, and its questions are about Claude only. Where this chapter teaches today's products and the guide expects a different answer, the note gives the answer that scores. Learn both. Certification and Portfolio Roadmaps has more.

  • Choosing a model. The exam guide expects you to fit the model family to the job: Haiku for high volume, speed and low cost, Sonnet for balanced everyday work, and Opus for the hardest reasoning. It does not examine effort settings. This chapter says a stronger model would have fixed none of its four failed runs, which is true of those runs. On the exam, when a scenario shows the task is beyond a lighter model, or that volume and cost matter most, switching family is the right fix. (D-004)
  • Fixing a weak output. The exam guide expects you to improve the prompt first: add context, examples, the format you want or a role. Then you update the project's instructions or knowledge so that the fix stays. This chapter starts with stop, inspect the task record and contain, because it deals with runs nobody watched. On the exam, those steps apply only when a scenario describes an automated run. In a chat or a project, revise the prompt first. (D-008)

Artifact checklist

  • results/prediction.md: written before you opened the lab's input files, with your look back from step 8
  • results/containment-log.md and results/diagnosis.md, covering all four failures
  • results/usage-check.md and results/discount-check.md
  • results/fixed-briefs.md, results/success-signals.md, results/thursday-note-run.md and results/port-notes.md
  • results/promotion-table.md and results/baseline.md
  • role/ap-worker-role-contract.md, Draft 8
  • Optional: results/my-workflow.md, one job from your own field

On this page