Course Content
Agents & Tools Interview Prep
6 sections · 40 lessons
How do planning and feedback loops improve task execution?
What you need to know
The loop
- Plan — list steps and dependencies.
- Execute — run the next step (often a tool call).
- Observe — read the tool result and check it against expectations.
- Decide — continue, retry, replan, or escalate.
- Repeat — until done or a budget is hit.
Mapping signals to decisions
| Signal from the tool | Likely cause | Decision |
|---|---|---|
| Timeout, HTTP 503 | Temporary | Retry with backoff (executor, max 2) |
| Validation error ("date must be YYYY-MM-DD") | Bad arguments | Model fixes arguments and retries |
| Empty result ("no hotels found") | Plan assumption wrong | Replan the remaining steps |
| Permission denied | Out of scope | Escalate or tell the user |
| Same failure twice | Stuck | Stop; report what is known |
The table is why tool results must be informative. A tool that returns [] for both "nothing matched" and "API is down" makes correct feedback impossible.
Limits that keep it bounded
- Max retries per step (e.g. 2).
- Max replans per run (e.g. 2).
- A global step and cost budget.
- A rule: the same failing action twice ends the run.
A real-life example
A travel agent plans a weekend trip for a family of four from Hyderabad to Coorg:
- Search trains to Mysuru. 2. Search a cab from Mysuru to Coorg. 3. Search homestays in Coorg. 4. Build the itinerary.
Feedback 1: the train search returns "Waitlist 48" for every train. Expected: confirmed seats. The agent replans: search flights to Mangaluru instead, with a cab from there. One replan.
Feedback 2: the homestay API returns HTTP 503. The executor retries after 2 seconds; it succeeds.
Feedback 3: the homestay search returns places with 3 rooms but the user profile says the grandparents need a ground-floor room. The validator flags it, and the agent re-queries with ground_floor=true.
The run finishes in 9 tool calls. Without feedback, the agent would have produced an itinerary built on waitlisted train tickets.
Follow-up questions to expect
- "Who decides between retry and replan?" — The executor handles transient errors automatically; the model decides on logical failures, guided by clear error messages.
- "How is this different from ReAct?" — ReAct re-decides after every step with no explicit plan; plan-plus-feedback keeps a plan and changes it only when signals say so.
- "What if the user changes their mind mid-run?" — Treat it as the strongest feedback signal: replan from the current state.