Demo: a refund request routed to human approval
On This Lesson 3 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
add a side-effect tool that only creates a pending request. Prepares MID-069-LAB1.
Draft outline details
Step by step
- Define
request_refund(orderId, reason); it inserts aPENDINGrefund request. - Add an idempotency key (order id plus reason hash); a repeat returns the existing request.
- Build the approval endpoint used by a support agent; only that role can execute the refund.
- Add loop limits (steps, time, cost) and show the loop stopping.
- Planned mistake: let the tool call the payment API directly "to save a step"; the test "no side effect without approval" fails. Fix by moving execution behind approval.
- Show the audit record: requester, approver, arguments.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.