Roddy Ventures

Build Lab / Build Your First AI Agent / Lesson 8

Build Your First AI Agent · Lesson 8 of 10

Debug and Improve the Agent

Repair the most important failure with the smallest change and retest, using ChatGPT as your building partner while you make and verify the final decisions.

What You’re Building

Repair the most important failure with the smallest change and retest.
Time: 10 minutes. Keep your work in one document so each module builds on the last.

Why It Matters

Debugging is controlled comparison. Changing the role, job, input and format together makes it difficult to know which change helped. Fix the cause you can observe, then verify that previously passing behavior still works.

Build It

Open a fresh ChatGPT chat for this module. Copy the ChatGPT Coach Prompt below, replace every bracketed field with your saved work, and send it. Answer one question at a time. Ask ChatGPT to explain unfamiliar words, but keep the final decisions and checks yourself. Save the useful result in your working document.

  1. Pick one failed test, prioritizing unsupported facts or boundary violations.
  2. Classify the likely cause using the checklist below.
  3. Identify the exact instruction or input field that allowed the failure.
  4. Make the smallest change and save a new prompt version.
  5. Rerun the failing case with identical input, then all five tests. Keep the change only if it improves the targeted behavior without breaking another case.

Success looks like this: you saved the requested artifact, can explain it in plain language, and checked it against this lesson’s Test It section. If that is not true yet, do not mark the checkpoint complete.

ChatGPT Coach Prompt

Act as my ChatGPT debugging partner. I will paste one failed agent test, its expected behavior, actual output, and prompt version. Classify the likely cause as job, boundary, input, context, process, output, or quality. Cite the evidence, propose the smallest change, and define the same-input retest plus full regression check. Do not stack several guesses into one edit.

Agent Debugging Checklist

AGENT DEBUGGING CHECKLIST
Failure observed:
Evidence from input/output:
Likely cause (choose one first):
- job definition
- responsibilities
- boundaries
- inputs
- missing-information handling
- knowledge/context
- process
- output format
- quality rules
Exact old instruction:
Smallest proposed change:
New prompt version:
Same-input retest result:
Full five-test regression results:
Keep / revert / investigate:
Known limitations after the change:

Example

Spreadsheet Cleanup Helper turns product code 00127 into 127. Category: process/output format. Small fix: “Treat identifier fields as text; preserve leading zeros and never infer missing values.” Retest the same sample, then a normal row, a blank identifier, an ambiguous date and a duplicate. The worker should propose changes for review, not silently overwrite the source spreadsheet.

Test It

Apply one change and record before/after evidence. A fix passes only when the targeted failure is resolved and the full suite still satisfies your acceptance criteria. If a serious failure remains, record the limitation and continue improving before relying on the worker.

Troubleshooting

If a change makes the prompt contradictory, remove the conflict instead of adding emphasis. If the model lacks needed information, fix the input contract rather than demanding confidence. If the task remains unreliable, narrow the job; do not hide failures behind polished formatting. If ChatGPT gives too much at once, reply: ‘Stop. Ask me one question at a time and wait for my answer.’ If it assumes facts, point to the unsupported sentence and ask which supplied evidence supports it. Start a fresh chat with the saved prompt and context when the conversation becomes confused.

Checkpoint