Loops, Graphs & Agents
Iterate, branch, merge and orchestrate: the structures behind expert prompting.
The most capable AI workflows are not single prompts. They are loops that refine until criteria are met, trees that explore options, graphs that branch and merge with shared state, and agents that plan, act and observe. Learn each pattern, the research behind it, how to keep it under control, and how to ground it with tools, retrieval and memory.
11
modules
113
minutes total
Modules
- 1
Thinking in loops and graphs
9 minThe five shapes of AI workflow, the vocabulary of nodes, edges and state, and how to choose between them.
Start here →
- 2
Refinement loops: generate, critique, revise
11 minImprove outputs by looping through feedback, as Self-Refine and Reflexion do, without drifting into blandness.
- 3
Agent loops: plan, act, observe (ReAct)
11 minHow agents interleave reasoning with actions, how to brief one well, and the plan-and-execute variant.
- 4
Coding loops: keep going until the tests pass
10 minUse tests as the stopping condition for coding agents, keep them honest, and stay in control of the result.
- 5
Loop control: stopping conditions, budgets and drift
10 minDesign loops that finish: success criteria, caps, budgets, progress checks, oscillation detection and escalation.
- 6
Tree of Thoughts: branching and searching
10 minExplore several lines of reasoning, evaluate them, and pursue the promising ones, in a single prompt or with orchestration.
- 7
Graphs: Graph of Thoughts and agent workflow graphs
12 minBranch, merge and loop with shared state, from Graph of Thoughts to stateful agent graphs you can build and debug.
- 8
Tool use and function calling
10 minHow models call tools, how to describe tools so they're used well, and how to keep tool use safe.
- 9
RAG and grounding with sources
10 minAnswer from your documents, cite them, and say 'not found' instead of guessing.
- 10
Long context, context engineering and memory
10 minDecide what goes into the context window and where, and how agents remember across steps and sessions.
- 11
Multi-agent patterns
10 minOrchestrator-worker, pipelines, debate and reviewers: when several agents beat one, and when they don't.