Skip to content

Chapter 2 of 8

Reasoning, Planning, and Tool Use

Modern LLM-based agents extend their capabilities far beyond text generation through tool use — the ability to invoke external tools such as APIs, code interpreters, databases, and web browsers. Function calling is the underlying mechanism: the LLM outputs structured JSON matching a predefined tool schema, which the system then executes, rather than producing free-form text. Structured output following a JSON or XML schema is parseable by code, in contrast to free-form natural language output. This tooling capability allows agents to perform actions like reading files, querying databases, and calling APIs in service of higher-level goals.

The ReAct pattern combines reasoning and acting by interleaving chain-of-thought reasoning with tool calls and observations. The agent thinks step-by-step, takes an action, observes the result, and continues reasoning. Related prompting strategies enhance this capability: chain-of-thought prompting asks the agent to show its reasoning step by step; tree-of-thought prompting explores multiple reasoning paths simultaneously and selects the best one; the plan-and-solve strategy separates planning from execution by first asking the LLM to produce a plan and then executing it step by step. Structured planning, where the agent outputs an explicit numbered plan in JSON before executing, enables plan validation and editing.

Effective tool use requires careful architecture. A tool registry catalogs all available tools with their descriptions, parameters, and schemas, while dynamic tool selection allows the agent to choose the most appropriate tool based on the current task. Tool-augmented generation enhances LLM output by allowing it to call tools mid-generation to retrieve facts or verify information. Zero-shot tool use enables an agent to correctly use a tool it has not been specifically trained on, based only on the tool's description, while few-shot prompting provides example interactions that demonstrate proper tool usage. To avoid overwhelming the context window, agents often employ an observation budget, limiting how much output from each tool call the agent processes.

All chapters
  1. 1Foundations of AI Agents
  2. 2Reasoning, Planning, and Tool Use
  3. 3Agent Memory and Knowledge
  4. 4Multi-Agent Systems and Inter-Agent Protocols
  5. 5Frameworks for Building Agents
  6. 6GitHub Copilot and AI Coding Tools
  7. 7Safety, Alignment, and Security
  8. 8Evaluation, Benchmarking, and Production Operations

Drill it

Reading is not remembering. These come from the AI Agents deck:

Q

What is a standalone AI agent?

An autonomous software system that perceives its environment, reasons about goals, and takes actions without continuous human intervention.

Q

What are the four core capabilities of an AI agent?

Perception (sensing environment), Reasoning (planning and deciding), Action (executing tasks), and Learning (improving over time).

Q

What distinguishes an AI agent from a simple chatbot?

An AI agent can autonomously plan, use tools, maintain state across interactions, and take multi-step actions, whereas a chatbot typically only responds to indi...

Q

What is the agent loop (observe-think-act)?

A cycle where the agent observes the environment, thinks/reasons about what to do, acts on that decision, then observes the result and repeats.