Lesson 5 of 7
Planning, Loops & Multi-Agent Teams
Big goals need plans. Learn how agents break tasks down, check their own work and team up.
Learn it
Agents break a big goal into smaller steps — just like decomposition in computational thinking.
A good agent checks its own work before finishing.
Some systems use a team: a planner, a worker and a checker agent.
Key terms
- Plan-and-execute
- Make a plan first, then carry out each step.
- Reflection
- The agent reviews and improves its own output.
- Step limit
- A maximum number of loop iterations for safety.
- Orchestrator
- An agent that hands tasks to other agents.
A research agent team
- 1Planner: Splits 'Report on renewable energy' into 4 sub-questions.
- 2Researcher: Searches and summarises each one.
- 3Writer: Drafts a 300-word report.
- 4Checker: Verifies every fact has a source; sends back 1 fix.
- 5Done: Final report delivered within 12 steps.
Loop with a safety limit
pythonMAX_STEPS = 10
for step in range(MAX_STEPS):
action = agent.next_action()
if action == "finish":
break
agent.run(action)
else:
print("Stopped: step limit reached — ask a human")The for/else runs the else only when the loop wasn't broken — a clean way to handle 'gave up'.
Try it
Order the plan-and-execute cycle
- 1Execute step 1
- 2Check result and adjust plan
- 3Reflect on the final output
- 4Write a numbered plan
- 5Deliver answer
- 6Receive goal
Challenge
Write a numbered plan your agent would make for one real goal. Add a step limit, a stop condition, and a reflection question the agent asks itself before finishing.
Pick whichever way suits you — every mode earns the same bonus XP.
Write at least 40 more characters to submit.
Mark your own work
Guided walkthrough — 0/1 clues revealed
- Clue 1 locked — reveal it only if you get stuck.
Each clue costs 4 XP (never below 18 XP). You'd earn 35 XP right now.