apply_plan call validates and applies everything atomically.
Planning tools overview
init_plan
Creates revision-bound context metadata and returns a plan with a base revision.
merge_plans
Deterministically merges sub-agent plans and detects hard conflicts.
apply_plan
Validates all steps first; applies only if all pass.
Step 1: Initialize a plan
The orchestrator callsinit_plan at the start of a multi-agent session. This binds the plan to the current document revision and returns a plan object that each sub-agent will extend:
init_plan returns a plan structure including a base_revision field. Sub-agents must include this base revision in their own plan outputs so that merge_plans can verify all plans share the same document snapshot.
Step 2: Sub-agents create edit steps
Each sub-agent reads the document, identifies paragraphs to edit, and produces a list of edit steps. Each step must include a uniquestep_id and an operation field.
Supported operations
- replace_text
- insert_paragraph
Step 3: Merge sub-agent plans
The orchestrator collects all sub-agent plan outputs and passes them tomerge_plans:
merge_plans detects hard conflicts — for example, two agents editing the same paragraph with incompatible changes — and returns the merged plan or an error.
Step 4: Apply the merged plan
Pass the merged plan toapply_plan. It validates every step before applying any of them. If any step fails validation, none are applied:
.json file and pass plan_file_path instead of inline steps:
apply_plan is compatible with merge_plans output. You can pass the merged plan object directly to apply_plan without reformatting.Workflow summary
Related guides
Editing documents
Understand the core edit operations used in plan steps.
Golden prompts
Known-good prompt patterns for reliable agent behavior.

