🧭 Roadmap

04. Planning loops

What is a planning loop?

A planning loop is the part of an agent system that keeps working through a task instead of stopping after one answer.

This is the basic idea:

Understand goal
   ↓
Make or revise plan
   ↓
Execute next step
   ↓
Observe result
   ↓
Decide whether to continue
   ↓
Finish or loop again

Why planning loops matter

Some tasks cannot be solved in one step.

Examples:

  • research a topic from multiple sources
  • debug a failing program
  • compare several vendors
  • collect data, summarize it, then produce recommendations

The agent needs a loop because each step changes what it should do next.

Two common styles

1. Implicit planning

The model plans internally while generating each next action.

This is simple and flexible, but harder to inspect.

2. Explicit planning

The model first writes or stores a plan, then executes against it.

This makes the workflow easier to debug and review.

Typical loop states

Many agent loops track:

  • current goal
  • completed steps
  • remaining steps
  • tool outputs
  • failure state
  • stop condition

Without these, the system can lose direction.

Common failure modes

Infinite loops

The agent keeps searching or retrying without making progress.

Premature stopping

The agent stops too early and returns an incomplete answer.

Plan drift

The system forgets the original goal and starts solving a slightly different problem.

Tool thrashing

The agent repeatedly calls tools with little value.

Practical controls

Good planning loops usually add:

  • maximum step count
  • timeout limits
  • retry limits
  • success criteria
  • human handoff conditions

These controls are essential in production.

Design principle

A loop should not just repeat.

It should improve state on every iteration.

If a loop does not produce better information, better decisions, or measurable progress, it is probably badly designed.

Next

Continue to Memory.