Agent Loops & ReAct
Implement the agent loop from scratch (decide, act, observe, repeat) with stop conditions, budgets and recovery from failed actions.
4 objectives 6 steps about 110 min
Learn it step by step
Read the lessons in order, try the practice checks, then prove the skill with the knowledge check.
This skill page is a public outline. Its lessons and knowledge check appear here as subject-matter experts approve them.
Learning objectives
- Implement a framework-free agent loop that alternates model calls and tool executions until a final answer or a stop condition.
- Enforce step, time and token limits and detect loops or repeated failing calls.
- Recover from tool errors and malformed calls without losing the task, and report a clear failure when recovery is impossible.
- Explain how ReAct-style prompting relates to native tool calling and to reasoning models that interleave thinking with tool calls, and how a framework's agent abstraction maps onto the same loop.
Lesson plan
6 steps, about 110 min · 5 of 5 lessons available so far
- What Makes Something an Agent, and Where Agents Pay Off Concept · 15 min
- The Loop in Sixty Lines Worked example · 25 min
- From ReAct Prompts to Native Tool Calls and Reasoning Models Concept · 15 min
- Lab: Limits, Loop Detection and Timeouts Lab · 25 min
- Recovering from Failed Actions Lab · 20 min
- Check: Predict the Next Step Knowledge check · 8 questions
Practise it
Build a framework-free agent with a calculator, a search stub and a file-reader tool; enforce a 10-step and token budget, inject three failure types (bad arguments, a tool exception, a timeout) and show that it recovers or stops with a clear message in each case. Then rebuild it with one agent framework and note what the framework hides.
Build it from scratch
Practice builds that exercise this skill by re-creating a real technology.
- Build your own AI Chat BotIntermediate · 6–12 h
References
Hard prerequisites
Unlocks
On these roadmaps
Progress and evidence for this skill are shared across all of them.