Lab: Build the returns agent with Priya's approval
Module 9 · Lab · About 70 minutes · Needs: lessons 1 to 4 of this module (tools, the loop with limits, state and checkpoints, frameworks)
What you are building
This lab joins the four lessons into the returns agent Priya asked for: a LangGraph graph that reads orders, checks the 30-day window in code, and proposes start_return, which runs only after Priya approves it. Each tool returns a structured error instead of crashing. Every model call passes a step, time and cost check first. State is saved to SQLite after every node, so the paused return survives a restart. Each run keeps a short trace of what happened. You finish by running three scenarios: Aisha's in-window smart bulbs (order 6150, approved), her robot vacuum (order 5521, refused as out of window), and an order number that does not exist (recovered).