Intermediate~14 minHazelJS
Planner–Executor
Produce an explicit plan artifact, then execute under validation—via loop stages or split agents.
- Authors
- editorial-team
- Published
- Last reviewed
Problem
Interleaved planning and acting makes progress hard to audit and easy to side-effect early.
Context
Tasks that benefit from a reviewable plan before writes.
Forces and constraints
- Plans improve auditability
- Stale plans need re-planning
- Plan-only steps still cost tokens
Recommended design
Use options.loop stages plan → execute → critique → validate, or split plannerAgent / executorAgent in a pipeline/graph. Gate write tools until a plan is accepted (HITL optional).
Minimal pseudocode
await runtime.execute('ops', goal, {
maxSteps: 12,
loop: {
maxIterations: 2,
stages: ['plan', 'execute', 'critique', 'validate'],
},
});Failure modes
- Executor ignores plan
- Plan never validated before writes
- Infinite re-plan without maxIterations
Security considerations
- Write tools disabled during plan-only stages
Observability signals
- Persist plan artifact on AgentRun timeline
Evaluation approach
Plan quality rubrics + tool-trace vs plan steps.
Trade-offs
- Extra latency vs safer execution