5 Agent reasoning and planning
This chapter covers
- How LLMs reason and plan
- Instructing agents to reason and plan
- Advanced planning with agents
- Utilizing the sequential thinking MCP server
Reasoning, for an LLM, involves two distinct cognitive operations. Decomposition is breaking a problem into smaller subproblems (what are the pieces of this task). Planning is choosing the sequence, dependencies, and approach for solving those subproblems (in what order, with what tools, and how the pieces connect).
Both operations are necessary, and they can fail independently. An agent can decompose a task correctly and then plan badly, or plan correctly over a poor decomposition, and the resulting failure looks different in each case. Naming the distinction matters because the fix depends on which operation broke.
Without both, agents are limited in their ability to use agency to make decisions, carry out actions, and achieve goals. As we will see, the quality of both operations often starts with the LLM powering the agent and the reasoning structures we build around it.
5.1 Understanding LLM reasoning and planning
Decomposition and planning are easiest to see with a stylized example. To achieve “leaving home,” a simple plan might be to get dressed, check the toaster, grab keys, leave.