# Planning, Reflection and Long Tasks

> Techniques that help agents tackle multi-step tasks: explicit plans, to-do lists, self-checking and verification against the real world. Free notes, key...

Canonical: https://www.internhack.in/roadmaps/tracks/ai-engineer/agent-planning
Last updated: 2026-11-28

Techniques that help agents tackle multi-step tasks: explicit plans, to-do lists, self-checking and verification against the real world.

Advanced · about 5 hours · difficulty 4/5

Learn first: [The Agent Loop](https://www.internhack.in/roadmaps/tracks/ai-engineer/agent-loop), [Reasoning Models and Thinking Budgets](https://www.internhack.in/roadmaps/tracks/ai-engineer/reasoning-models)

Reasoning models already plan internally, but long tasks still benefit from **explicit structure** that survives many steps and context resets.

### Useful patterns

- **Plan then act**: ask the agent to write a short plan or checklist first, then execute it step by step and update it as it learns. A visible plan also helps humans supervise.
- **ReAct style interleaving**: think, act with a tool, observe the result, think again. Most modern tool loops already work this way.
- **Verification**: the strongest signal is external. Run the tests, query the database, render the page, check the file exists. Prefer "prove it worked" over "does this look right?".
- **Reflection and critique**: a second pass (same or different model) reviews the output against the goal and lists problems. Useful for writing and code, but it costs tokens and can rationalize mistakes.
- **Decomposition**: break a big goal into sub-tasks, possibly handled by sub-agents with fresh context.

### Long-running tasks

When a task exceeds one context window, the agent needs **durable progress**: a notes file, a task list, git commits, or a database row per step. Compaction (summarizing old history) keeps the loop going but loses detail, so write important facts to storage deliberately.

### Good enough to move on

You can make an agent produce a plan, execute it with verification after each step, and resume from saved progress after being stopped halfway.

## Key concepts

- **Plan-then-execute**
- **ReAct interleaving**
- **External verification**
- **Self-critique and reflection**
- **Task decomposition**
- **Context compaction**
- **Durable progress files**

## Mini project

Give an agent a coding task in a small repo with a test suite. Require it to write a plan, run tests after every change, and keep a progress.md file so a fresh run can resume the task.

## Check yourself

Why is running the test suite a better check than asking the model whether its code is correct?

## Free resources

- [ReAct: Synergizing Reasoning and Acting](https://arxiv.org/abs/2210.03629) (arXiv)
- [Anthropic: Building effective agents](https://www.anthropic.com/engineering/building-effective-agents) (Anthropic)

Previous: [Designing Tools for Agents](https://www.internhack.in/roadmaps/tracks/ai-engineer/agent-tool-design) · Next: [Memory and Context Engineering](https://www.internhack.in/roadmaps/tracks/ai-engineer/agent-memory)

## More in Building AI Agents

- [The Agent Loop](https://www.internhack.in/roadmaps/tracks/ai-engineer/agent-loop)
- [Designing Tools for Agents](https://www.internhack.in/roadmaps/tracks/ai-engineer/agent-tool-design)
- [Planning, Reflection and Long Tasks](https://www.internhack.in/roadmaps/tracks/ai-engineer/agent-planning)
- [Memory and Context Engineering](https://www.internhack.in/roadmaps/tracks/ai-engineer/agent-memory)
- [Model Context Protocol (MCP)](https://www.internhack.in/roadmaps/tracks/ai-engineer/mcp)
- [Agent SDKs and Frameworks](https://www.internhack.in/roadmaps/tracks/ai-engineer/agent-frameworks)
- [Multi-Agent Systems](https://www.internhack.in/roadmaps/tracks/ai-engineer/multi-agent-systems)
- [Computer Use and Browser Agents](https://www.internhack.in/roadmaps/tracks/ai-engineer/computer-use-agents)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [AI Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/ai-engineer)
