So far, every model call in this module has had a fixed shape: your code decides the steps, and the model fills in one of them. An agent flips that. You give the model a goal and some tools, and it decides the steps itself, one at a time, until it thinks it's done.
That's powerful, and it's also a distributed system with an unpredictable planner in the middle. This lesson is about the engineering around the loop: budgets, timeouts, checkpoints, and when a human must say yes. If you're arriving here directly, read the structured output and tools lesson first. Agents are just tool calling, repeated.
Tiffin's ops agent
Tiffin's operations team handles hundreds of "my rider never showed up" cases every evening. A human ops person does roughly this: look up the order, check the rider's last GPS ping, check whether the restaurant marked it ready, decide between reassigning a rider, issuing a refund, or calling the customer. Then log what they did.
The steps vary case by case. Sometimes the rider is just stuck at a red light. Sometimes the restaurant hasn't even started cooking. That variety is what makes it a candidate for an agent.