Agents & Tool Use advanced 9 min read 6 flashcards

Agentic AI and ReAct

From single tool calls to multi-step agents that plan, act, observe, and recover from errors.

An agent is a model in a loop: plan, act, observe, refine. ReAct (Reasoning and Acting, 2022) gave the standard framing - interleave chain-of-thought with tool calls so the model can reason about what just happened before deciding the next step.

The ReAct trace

Thought: I need to find the user's current plan.
Action: lookup_user(user_id=42)
Observation: {plan: "free", valid_until: null}
Thought: They are on the free tier. Now I should check if they have hit the limit.
Action: messages_today(user_id=42)
Observation: 3
Thought: They are at the limit. I should suggest the upgrade.
Final answer: ...

Why interleave

Without the explicit "Thought" steps, the model treats the loop as one big tool-calling exercise and skips the reasoning. With them, error recovery improves dramatically because the model can notice a stale observation and re-plan.

Failure modes

  • Tool thrashing. The model calls the same tool with slight variations. Cap iterations and detect repetition.
  • Plan drift. Half-way through the loop the model forgets the original goal. Pin the user task at the top of every prompt.
  • Hallucinated observations. The model imagines tool results when it gets confused. Validate observations against the actual tool response.

Production patterns

  • Hierarchical agents. A supervisor agent breaks the task into sub-tasks and dispatches to specialist agents (one per tool family).
  • Self-critique loops. After producing an answer, run a separate "critique" pass that grades the answer and triggers a revision if it fails.
  • Memory layers. Short-term scratchpad in the prompt; long-term episodic memory in a vector store.

Agentic systems are powerful and brittle. Treat them like any distributed system: timeouts, retries, observability, idempotency.

Check yourself

6 flashcards for this concept

Click a card to reveal the answer.

Drill the whole track