← Course Home
Phase 3 · Week 7
⏱ 20 minutes
Lesson 7.2
Lesson 7.2

Iteration and Testing: Making It Reliable

How Agents Fail
Watch: What AI agents actually can and cannot do — failure modes explained (15 min)

How Agents Fail — And What to Do About It

Input failure.
What happens: User provides input the agent was not designed for — wrong language, wrong format, unexpected characters.
Fix: Validate inputs early. Return a helpful error message. Never let unexpected input reach core logic without sanitisation.
Tool failure.
What happens: An API returns an error, rate limit, or timeout.
Fix: Wrap every tool call in error handling. Log the failure. Retry with backoff. If retries fail — escalate to a human or return a clear failure message.
Logic failure.
What happens: The agent reaches a decision point where none of the expected conditions are met.
Fix: Add a default case to every decision branch. Always return something — even 'I was not able to handle this request, here is why.'
Output failure.
What happens: The agent produces a response that is technically valid but factually wrong or harmful.
Fix: Add a verification step before final output is delivered. For high-stakes domains, require human review before the output reaches the end user.
Five Edge Case Tests

The Five Edge Case Tests

Slide 1

Run all five. Document results honestly in your project log.

T1 — Empty input.
What happens when the user sends nothing, or just whitespace? Does the agent crash, loop, or return a helpful message?
T2 — Unexpected format.
If the agent expects a date — what happens when it receives 'Tuesday'? If it expects English — what happens when it receives Italian?
T3 — Adversarial input.
What if a user asks the agent to do something it is not supposed to do? Does it refuse gracefully or produce harmful output?
T4 — Tool unavailable.
Disconnect the API or simulate a 503 error. Does the agent fail silently, crash, or return a useful error message?
T5 — Correct input, wrong result.
Give the agent a valid input where you already know the correct answer. Does it get it right? If not — is the error predictable?
Key Insight
You do not need to fix all failures — but you must document all of them honestly. The edge case test results become the testing section of your final README.
Slide 2
✏️ Student Reflection
Run all five edge case tests on your prototype. For each test, document: the input you used, what the agent returned, whether this is acceptable behaviour or a bug to fix, and if it is a bug — what you will do about it before Week 8. Add all results to your project log.

📝 Your Lesson Submission

Share your reflection, ask a question, or leave a comment. The bioERGOtech team will respond.

🔐

You need to be logged in to submit your reflection.

← Previous7.1 — Mentor Mid-Build Feedback Session
Next →8.1 — Finalising Your Prototype🔒 Submit reflection to unlock
🔐

Create a Free Account to Continue

Lesson 1.1 and beyond are available to enrolled members. Join the program for free to access all 21+ lessons, mentor sessions, and your completion certificate.

🎓 Join the Program — It's FreeAlready a member? Log in
Studente di un liceo del percorso «Biotecnologie e Intelligenza Artificiale»? Non creare un account da qui: iscriviti con il codice della tua scuola, così il tuo professore ti trova nel suo elenco. Se l'email con la password non ti arriva, chiedigli di rimandartela. Iscriviti con il codice della scuola