# Planning

> Planning is breaking a job into steps before or during an agent's run. The steps can be fixed in your code, written by the model before it starts, or kept as a list the agent updates as results come in.

Decide when your agent writes a plan first, and when it changes the plan.

Track: Agents
Card: https://buildsparkai.com/planning
Plain text: https://buildsparkai.com/planning.md
Last checked: 2026-10-28

## What it is

On Agent loop , the model picks the next step each turn. Planning is the bigger picture: the steps for the whole job. There are three ways to hold them.

## Why it matters

**Cost.** Picking one step at a time costs a model call for every tool call. [LangChain's post](https://www.langchain.com/blog/planning-agents) says that with a plan written first, the larger model is called only to plan, re-plan and write the final reply.

**Quality.** A long run loses track. [Anthropic's context engineering guide](https://www.anthropic.com/research/effective-context-engineering-for-ai-agents) says a to-do list keeps context and dependencies that would otherwise be lost across dozens of tool calls.

**Risk.** Small mistakes add up over many steps. [Anthropic's Building effective agents](https://www.anthropic.com/research/building-effective-agents) warns of compounding errors, and recommends showing the agent's planning steps. A plan you can see is a plan a person can check before anything acts.

## Try today

Take one task your agent runs in more than three tool calls. Before it runs, have it write its steps as a numbered list, each marked read or act. After each result, ask: is the next step still right? Then compare the list with the trace.

## Common mistake

Following the first plan to the end after a result shows it's wrong. A plan is written before the results. Check it after each one, and drop the steps that no longer fit.

## Self-check

Every refund request goes through the same four steps, in the same order. Who should set the steps?

Your code, as fixed steps

## Understand it: three ways to plan, and when to change the plan

5 min, optional

The tools differ. The questions stay the same: who writes the steps, where they're kept, and what makes them change.

### One step at a time

On [Agent loop](/agent-loop), the model picks each next step. [LangChain's Plan-and-Execute post](https://www.langchain.com/blog/planning-agents) names two downsides: a model call for each tool call, and planning only one sub-problem at a time. That's fine for short tasks. [Agent loop's "Loop, or a single prompt?"](/agent-loop#u-which) table still decides whether you need a loop at all.

### Fixed steps in code

[Anthropic's Building effective agents](https://www.anthropic.com/research/building-effective-agents) describes workflows as AI models and tools running through predefined code paths. Prompt chaining splits a task into fixed subtasks, and you can add checks in code between steps (gates) to keep it on track. Use this when you can name the steps in advance. Anthropic suggests agents for open-ended problems where you can't hardcode a fixed path.

### A plan written first, then re-planned

[LangChain's Plan-and-Execute post](https://www.langchain.com/blog/planning-agents) describes a planner that writes a multi-step plan. The steps run. Then a re-planning prompt decides to finish or write a follow-up plan. [OpenAI's reasoning guide](https://developers.openai.com/api/docs/guides/reasoning-best-practices) describes a reasoning model as "the planner" that writes a multistep solution, then picks a model for each step, depending on whether that step needs more intelligence or a faster answer.

### A to-do list in the run's state

[Anthropic's context engineering guide](https://www.anthropic.com/research/effective-context-engineering-for-ai-agents) describes structured note-taking, like a to-do list, that tracks progress across complex tasks. [LangChain's Deep Agents overview](https://docs.langchain.com/oss/python/deepagents/overview) gives the agent a `write_todos` tool for a task list during the run. It has been opt-in since v0.7. The overview lists long multi-step tasks, less capable models, and progress shown in a UI as where a task list helps. The list is state for this run. It is not long-term [Memory](/memory).

### Planners built into frameworks

Examples, in alphabetical order. They are not ranked. [Google's Agent Development Kit](https://adk.dev/agents/llm-agents/) can attach a planner. One uses the model's built-in thinking. `PlanReActPlanner` asks the model to write a plan, then act, with reasons, for models without a thinking feature. [Microsoft's Semantic Kernel](https://learn.microsoft.com/en-us/semantic-kernel/concepts/planning) retired its Stepwise and Handlebars planners and now uses function calling as the main way to plan and run tasks. The point for you: planning has moved inside the loop, so the plan you can see and check is the one you ask for.

### Show the plan before anything acts

[Anthropic's Building effective agents](https://www.anthropic.com/research/building-effective-agents) recommends showing the agent's planning steps, and pausing for a person at checkpoints. Coding agents do the same. [GitHub's Copilot cloud agent](https://github.blog/changelog/2026-04-01-research-plan-and-code-with-copilot-cloud-agent/) can write an implementation plan for you to approve before it writes code. [Working with a coding agent](/coding-agent) covers that. [Permissions & human sign-off](/permissions-hitl) covers who says yes.

### When to re-plan, and how often

Re-plan after a result changes a fact the plan relies on, or after a step fails. Don't re-plan because a result asks for new steps. [Prompt injection](/prompt-injection) covers that. Each re-plan is another model request, so it counts toward your turn limit on [Agent loop](/agent-loop). [Failure modes](/failure-modes) covers a loop that keeps re-planning without progress.

### Test it

Add three cases to your saved checks. The reply comes after the lookups. A result that shows the work is done drops the act. A result that asks for a new step doesn't get one. [Agent evaluation](/agent-evaluation) covers how to score whole tasks.

### Check yourself

**Name one job for fixed steps, one for a plan written first, and one result that should change a plan.**

Answer:

Fixed: the same refund steps every time. Plan first: a support ticket that needs a search, a lookup and maybe a ticket. Change it: a lookup shows a ticket is already open, so drop 'file a ticket'.

## Practice and deep

Example: made up to show the idea.

Read one plan checked for you, fix a plan with a hint, then handle a result that asks for a new step.

A plan, and one change

Step
Plan before the run
After step 2

1
Search the docs: "export attachments" · read
Done. export.md: "Attachments are not included in the CSV."

2
Look up the account · read
Done. Ticket #4127 about this is already open

3
File a ticket · acts, waits for a person's OK
Dropped. A ticket is already open

4
Reply with the new ticket number
Reply: cite export.md and give ticket #4127

Steps 1 and 2 read and change nothing, so they run first. Step 3 acts, so it waits for a person's OK. Step 2 found an open ticket, so the plan dropped step 3 and changed step 4 to give that ticket's number. Re-planning happened once, after the result that changed a fact.

Fix the order
A customer asks, 'Is single sign-on on my account?' The model's plan: 1 · Reply yes or no. 2 · Search the docs: 'single sign-on'. 3 · Look up the account.

What's wrong with this plan?

Hint: A reply can only use results that came back before it.

A · It has too many steps
B · The reply comes too early
C · It should file a ticket first

## Sources

- [Anthropic, Building effective agents (published Dec 19, 2024)](https://www.anthropic.com/research/building-effective-agents)
- [Anthropic, Effective context engineering for AI agents (published Sep 29, 2025)](https://www.anthropic.com/research/effective-context-engineering-for-ai-agents)
- [GitHub Changelog, Research, plan, and code with Copilot cloud agent](https://github.blog/changelog/2026-04-01-research-plan-and-code-with-copilot-cloud-agent/)
- [Google, Simple agents with LlmAgent](https://adk.dev/agents/llm-agents/)
- [LangChain, Deep Agents overview](https://docs.langchain.com/oss/python/deepagents/overview)
- [LangChain, Plan-and-Execute Agents (published Feb 13, 2024)](https://www.langchain.com/blog/planning-agents)
- [Microsoft, What are Planners in Semantic Kernel](https://learn.microsoft.com/en-us/semantic-kernel/concepts/planning)
- [OpenAI, Reasoning best practices](https://developers.openai.com/api/docs/guides/reasoning-best-practices)

Vendor and framework docs. The examples in Understand it don't rank them.
