Skip to main content

> tpl_air_037

Planner-Executor Contract

Formal interface and state machine contract governing decomposed multi-step agentic systems, standardizing task decomposition DAG schemas, step precondition validation, intermediate state scratchpads, dynamic replanning triggers upon tool failures, and deterministic loop-termination bounds.

TEMPLATE // INSPECT: TPL-AIR-037MODIFIED: 2026-09-19
CATEGORYGenerative AI, RAG & Agents
VERSIONv1.0.0
RISK LEVELMEDIUM
ARTIFACT CLASSDOC
FORMATSDOCX, PDF, MD, MERMAID, SVG
AI & EXECUTIVE SUMMARY

Agent orchestration contract standardizing task decomposition DAGs, scratchpads, tool failure replanning, and loop bounds.

Important Tech Document Template & Operational Notice

TinyCTO.tv Tech Document Template Notice: This template is a general educational and operational starting point. It is not legal, tax, accounting, investment, procurement, regulatory, security or certification advice. Requirements vary by jurisdiction, organization, contract and risk. Review and adapt it with qualified professionals before relying on it.

Problem Solved

Monolithic single-prompt agents attempt to reason and execute tools simultaneously, resulting in chaotic hallucinations, forgotten intermediate steps, unhandled API error loops, and catastrophic non-deterministic execution failure.

When to Use

  • Architecting complex, multi-step autonomous AI workflows requiring distinct planning, tool execution, and reflection stages
  • Implementing LangGraph or Temporal state machines where an agent must decompose a large goal into an acyclic task graph
  • Establishing deterministic error-handling and dynamic replanning when tools fail or return unexpected results

When NOT to Use

  • For simple, single-turn conversational chatbots without multi-step tool dependencies
  • For registering individual API endpoints and tool parameter schemas (use TPL-AIR-035)

5 Template Sections & Structural Outline

1. 1. Separation of Concerns: The Dual-Brain Architecturestandard, enterprise

Decoupling the high-reasoning Planner (generates the execution DAG) from the fast Executor (invokes tools and captures outputs). Preventing context pollution and tool hallucinations.

Guidance:Never allow the executor to alter the macro-plan; execution deviations must be passed back to the planner as reflection events.
2. 2. The Plan DAG Schema and Precondition Contractsstandard, enterprise

Formal Pydantic schema for task decomposition: Step ID, sequential dependencies, target tool name, required input parameters, expected schema of the result, and timeout bounds.

Guidance:Enforce strict DAG validation; reject cyclical task dependencies before the executor starts.
3. 3. Intermediate State Scratchpad and Memory Persistencestandard, enterprise

Centralized state blackboard (LangGraph State / Postgres / Redis): Storing completed step outputs, scratchpad notes, raw tool payloads, and token consumption metrics.

Guidance:Prune verbose tool payloads before feeding context back to the planner; keep the scratchpad concise to conserve tokens.
4. 4. Dynamic Replanning Triggers and Error Recovery Thresholdsstandard, enterprise

Handling execution friction: When a tool returns 4xx/5xx errors or unexpected schema, the state machine triggers a "Replan Event", providing the planner with error context to formulate an alternative sub-DAG.

Guidance:Cap dynamic replans at a strict maximum of 2 iterations per goal to prevent infinite reasoning loops.
5. 5. Deterministic Guardrails: Step Budgets and Termination Proofsstandard, enterprise

Fail-safe termination: Hard ceilings on execution (e.g. Max 10 steps, Max 50,000 tokens, Max 120 seconds execution time). Deterministic exit states: SUCCESS, PARTIAL_SUCCESS, REPLAN_EXHAUSTED, TIMEOUT.

Guidance:Every plan must terminate deterministically; an open-ended "while true" agent loop is a critical defect.

Completion Instructions

1. Review blank document. 2. Adapt worked scenario to company scale. 3. Validate against review checklist.

Independent Review Checklist

  • All mandatory sections completed
  • No secrets or passwords included
  • Executive sponsor sign-off obtained
WORKED SCENARIO SHOWCASE

Planner-Executor Contract - Worked Case Study

Fictional Entity: Multi-Step Autonomous Financial Compliance Agent Auditing Global Supplier Invoices

Real-world production case study demonstrating complete operational adoption for Multi-Step Autonomous Financial Compliance Agent Auditing Global Supplier Invoices.

Key Highlights & Outputs:
  • Decomposed complex 8-step auditing goal into a validated DAG with explicit dependency gating
  • Handled ERP API rate-limit failure via automated dynamic replanning using cached secondary endpoints
  • Enforced a strict 10-step ceiling preventing runaway agent execution loops and budget overruns

Frequently Asked Questions

Why is decoupling the Planner from the Executor strictly necessary in agentic workflows?

When a single prompt attempts to simultaneously reason about high-level strategy and execute low-level tool parameters, the context window quickly becomes cluttered with tool outputs, causing the model to forget its original goal or hallucinate fictitious arguments. A dual-brain architecture assigns planning to a high-reasoning model and execution to an efficient tool-calling loop.

How does dynamic replanning operate when an intermediate tool invocation fails?

If an executor tool call returns an unrecoverable error (e.g., API 500 or resource not found), the executor does not retry blindly. It captures the error signature, halts the local DAG branch, and dispatches an exception event back to the Planner. The Planner evaluates the scratchpad, discards the blocked branch, and generates an alternative sub-DAG.

What prevents Planner-Executor architectures from burning thousands of dollars in infinite loops?

Production agent contracts enforce strict deterministic resource bounds: 1. A maximum step budget (e.g. 10 steps), 2. A hard token expenditure ceiling (e.g. 50k tokens), 3. A wall-clock timeout (e.g. 120 seconds), and 4. A maximum replanning limit (2 replans). If any threshold is breached, the state machine forcibly aborts with an EXHAUSTED status.

Download Tech Document Pack

Auth Required
Free instant downloads require a quick sign in or registration.
Complete Tech Document Pack (.zip)
12 Files

Download all blank templates, worked scenarios, and verification manifests in a single verified archive.

Individual Artifacts (.zip)
TPL-AIR-037-Planner-Executor-Contract-Blank-EN.docxDOCX
all11.5 KB
TPL-AIR-037-Planner-Executor-Contract-Example-EN.docxDOCX
all11.6 KB
TPL-AIR-037-Planlayici-Yurutucu-Sozlesmesi-Bos-TR.docxDOCX
all11.6 KB
TPL-AIR-037-Planlayici-Yurutucu-Sozlesmesi-Ornek-TR.docxDOCX
all11.7 KB
TPL-AIR-037-Planner-Executor-Contract-Blank-EN.mdMD
all2.5 KB
TPL-AIR-037-Planner-Executor-Contract-Example-EN.mdMD
all2.6 KB
TPL-AIR-037-Planlayici-Yurutucu-Sozlesmesi-Bos-TR.mdMD
all2.5 KB
TPL-AIR-037-Planlayici-Yurutucu-Sozlesmesi-Ornek-TR.mdMD
all2.7 KB
TPL-AIR-037-Planner-Executor-Contract-Blank-EN.pdfPDF
all98.3 KB
TPL-AIR-037-Planner-Executor-Contract-Example-EN.pdfPDF
all99.0 KB
TPL-AIR-037-Planlayici-Yurutucu-Sozlesmesi-Bos-TR.pdfPDF
all100.1 KB
TPL-AIR-037-Planlayici-Yurutucu-Sozlesmesi-Ornek-TR.pdfPDF
all100.8 KB
Verified SHA-256 · Zero Macros Verified Archive
Every download includes an authoritative MANIFEST.json

Authoritative Sources