DEPLOYEDAI-era interview training
RankBootstrapping
XP 0 / 250
0
0%
Ready
Applied AI / Forward Deployed Engineer · Agents & Tool Use · Lesson 2 of 3

The agent loop: ReAct, planning & memory

7 min

An agent is an LLM in a loop that can use tools to pursue a goal over multiple steps, deciding its own next action. The canonical pattern is ReAct (Reason + Act):

  1. Thought: the model reasons about what to do next.
  2. Action: it calls a tool.
  3. Observation: it gets the tool's result.
  4. Repeat until the goal is met, then produce a final answer.
  • Planning: for complex tasks, have the agent draft a plan / decompose into sub-tasks first, then execute — improves reliability.
  • Memory: short-term = the running context; long-term = external store (vector DB / scratchpad) the agent reads and writes across steps.
  • Termination: you must cap steps/iterations and cost — agents can loop forever or thrash.
Mental modelAn agent is an intern with a to-do list and a phone: it thinks, makes a call (tool), reads the reply, updates its plan, and repeats — until the task is done or it hits the limits you set.

◆ Lock it in

  • Agent = LLM in a loop using tools toward a goal; ReAct = Thought → Action → Observation, repeat.
  • Add planning for complex tasks and memory (short-term context + long-term store).
  • Always enforce step, time, and cost limits — agents can loop.
Feynman drill — say it out loudExplain the ReAct loop and why an agent needs a hard stop condition.
Step 1 rate your confidence · Step 2 pick your answer
What does the 'Observation' step in a ReAct agent loop refer to?
Step 1 — how sure are you?