Awesome Testing

Agent lesson 05 · Control lifecycle events

At which event can a rule see enough—and still prevent the effect?

Shared teaching scenario · fictional product data

Research three laptops under €900, verify current evidence, and write laptop-comparison.md. Do not purchase anything or contact a vendor.

01 · Smallest useful mechanism

Hooks add deterministic behavior at named lifecycle boundaries.

Pre-action hooks can validate, redact, deny, or require approval before execution. Post-action hooks can verify outcomes and record audit evidence. Session and completion hooks can enforce cleanup or acceptance checks. Hooks complement—not replace—permissions, sandboxing, schemas, and application authorization.

Attach a check at the earliest event that has enough evidence to decide and still has enough control to prevent or transform the effect.

02 · Experiment

Test the prediction

Deterministic browser simulation

The control lifecycle events experiment uses inspectable, repeatable teaching data. It does not claim to be a live agent trajectory.

Loading the experiment…

03 · Production-minded practice

Prove the mechanism under failure

Use your own stack or a contained mock environment. Do not point failure drills at real accounts, people, or irreversible services.

  1. Build

    Map budget, permission, provenance, output, completion, and audit checks to named lifecycle events with allow, deny, transform, recover, or record behavior.

  2. Break it on purpose

    Deliver the same completion event twice, then make the purchase guard unavailable while a forbidden cart call is pending.

  3. Evidence of completion

    Replay does not duplicate effects, the high-risk call fails closed, and the trace distinguishes hook failure from a model or tool failure.

Your learning artifact

Write the argument you would defend

Stored only in this browser. No account required; course reset does not delete it.

04 · Check your understanding

Which boundary can prevent a protected write?

Optional referenceDeep dive / reference chapterOpen the complete essay, diagrams, mathematics, exercises, glossary, and sources when you want more depth.

Next: Hooks provide attachment points. The next lesson builds the full tool acceptance boundary around them.