Use this prompt when you have multiple agents that have independently produced execution plans and those plans overlap, conflict on resource usage, contradict each other on ordering constraints, or pursue incompatible goals. This prompt resolves those conflicts into a single coherent, safe, and executable merged plan. It is designed for multi-agent system builders and AI reliability engineers who need a deterministic recovery step when concurrent planning produces divergence. The ideal user is integrating this prompt into an agent harness that detects plan conflicts programmatically—by comparing resource claims, dependency graphs, or goal vectors—and then invokes this prompt as a structured recovery path before any agent takes action on a conflicting plan.
Prompt
Concurrent Agent Plan Merge Conflict Resolution Prompt

When to Use This Prompt
Defines the precise conditions for deploying the plan merge prompt and the critical boundaries where it should not be used.
The required context for this prompt includes the full text of each conflicting plan, a description of the shared execution environment (available tools, resources, and their capacities), and the original goal or task that spawned the plans. Without this context, the merge cannot reason about resource constraints or goal alignment. The prompt expects plans to be provided in a structured format that identifies actions, their preconditions, the resources they consume, and their expected outcomes. If your agents produce plans as unstructured natural language, you must first normalize them into a comparable schema before invoking this merge prompt. The merge output should be validated against safety invariants—no resource over-allocation, no circular dependencies, and no dropped required actions—before being dispatched for execution.
Do not use this prompt for simple task assignment collisions or for merging observations; those are separate recovery workflows covered by the Multi-Agent Task Assignment Collision Prompt and the Concurrent Agent Observation Merge Prompt respectively. Do not use this prompt when only one agent has produced a plan; there is nothing to merge. Do not use this prompt when the plans are so fundamentally incompatible that no safe merge exists—for example, when two agents propose mutually exclusive irreversible actions with no rollback path. In those cases, escalate to a human operator or a higher-level arbitration agent rather than forcing a merge that could produce an unsafe composite plan. Finally, do not use this prompt as a substitute for proper agent coordination protocols; it is a recovery mechanism for when coordination fails, not a primary planning strategy.
Use Case Fit
Where the Concurrent Agent Plan Merge Conflict Resolution Prompt works and where it introduces unacceptable risk. Use these cards to decide if this prompt fits your architecture before integrating it into a production harness.
Good Fit: Multi-Agent Orchestrators
Use when: you have a coordinator agent that dispatches sub-tasks and receives overlapping or conflicting plans from specialized agents. The prompt excels at reconciling resource contention and ordering constraints into a single execution DAG. Guardrail: ensure each agent's plan includes explicit resource claims and preconditions so the merge prompt has structured conflict metadata to work with.
Bad Fit: Real-Time Safety-Critical Systems
Avoid when: the merged plan controls physical actuators, medical devices, or safety interlocks with hard real-time deadlines. The prompt introduces nondeterministic latency and cannot guarantee deadline satisfaction. Guardrail: use this prompt only for advisory or planning layers; keep execution gating in deterministic control code with hard watchdog timers.
Required Inputs
What you must provide: each agent's plan as a structured list of steps with resource requirements, estimated durations, and explicit dependencies. Missing resource declarations or implicit ordering assumptions cause the merge to produce unsafe schedules. Guardrail: validate that every incoming plan includes a resources array and a depends_on field before calling the merge prompt.
Operational Risk: Silent Goal Contradiction
What to watch: two agents may pursue goals that are logically contradictory without explicitly conflicting on resources. The merge prompt may produce a plan that satisfies both superficially but fails at execution. Guardrail: add a pre-merge goal-consistency check that flags contradictory objectives and escalates to a human operator before merging.
Operational Risk: Merge Latency Spikes
What to watch: as the number of agents and plan steps grows, the merge prompt's token count and reasoning depth increase non-linearly, causing latency spikes that violate your orchestration timeout. Guardrail: set a hard token budget and step-count cap per merge call; if exceeded, split the merge into batches or escalate to a lightweight heuristic resolver.
Not a Replacement for Distributed Consensus
What to watch: teams sometimes treat this prompt as a substitute for proper distributed consensus protocols. The prompt has no notion of quorum, fencing tokens, or linearizability. Guardrail: use this prompt for plan-level reconciliation only; rely on your execution harness's locking, versioning, and consensus mechanisms for state mutations.
Copy-Ready Prompt Template
A reusable prompt for merging conflicting agent plans into a single coherent execution plan with safety and completeness checks.
This template resolves merge conflicts between concurrent agent plans that contain overlapping resources, contradictory ordering constraints, or incompatible goal specifications. Copy the block below into your agent harness, populate the square-bracket placeholders with runtime data from your plan store and conflict detector, and call the model. The prompt is designed to produce a structured merge decision plus a conflict-resolution trace that your harness can validate before committing the merged plan.
textYou are a plan-merge resolver for a multi-agent system. Your job is to reconcile conflicting execution plans produced by concurrent agents into a single coherent plan. ## INPUTS ### Plan A [PLAN_A] ### Plan B [PLAN_B] ### Conflict Report [CONFLICT_REPORT] ### Shared Resource Pool [SHARED_RESOURCES] ### Global Ordering Constraints [ORDERING_CONSTRAINTS] ### Goal Priority Rules [GOAL_PRIORITY_RULES] ### Safety Constraints [SAFETY_CONSTRAINTS] ## OUTPUT SCHEMA Return a valid JSON object with exactly these fields: { "merged_plan": [ { "step_id": "string (unique identifier)", "action": "string (what to execute)", "agent": "string (assigned agent or 'any')", "depends_on": ["step_id"], "resource_claims": ["resource_id"], "rollback_action": "string (undo instruction if step fails)" } ], "conflicts_resolved": [ { "conflict_id": "string (from conflict report)", "resolution": "string (choose: 'plan_a_wins', 'plan_b_wins', 'merged', 'deferred', 'escalated')", "rationale": "string (why this resolution was chosen)", "safety_impact": "string (low | medium | high | none)" } ], "unresolved_conflicts": [ { "conflict_id": "string", "reason": "string (why it could not be resolved)", "recommended_escalation": "string (who or what to escalate to)" } ], "completeness_check": { "all_goals_covered": true, "missing_goals": ["string (goal descriptions not addressed)"], "ordering_violations": ["string (any ordering constraints broken)"], "resource_overcommits": ["string (resources claimed by multiple steps at same time)"] }, "safety_assessment": { "overall_risk": "string (low | medium | high | critical)", "requires_human_approval": true, "risk_notes": ["string (specific risks identified)"] } } ## RESOLUTION RULES 1. Safety constraints override all other priorities. If a step in either plan violates a safety constraint, it must be removed or modified. 2. Resource conflicts: apply the goal priority rules to decide which agent gets the resource. If priority is equal, prefer the plan with fewer total resource claims. 3. Ordering conflicts: preserve ordering constraints. If both plans specify contradictory orders for the same steps, use the ordering from the higher-priority goal. 4. Goal contradictions: if the plans pursue mutually exclusive goals, select the goal with higher priority. Document the excluded goal in unresolved_conflicts. 5. Do not invent new steps. Only merge, reorder, or remove steps from the input plans. 6. Every step in the merged plan must have a rollback_action. 7. If any conflict has safety_impact of 'high' or 'critical', set requires_human_approval to true. ## CONSTRAINTS - Do not add steps that do not appear in Plan A or Plan B. - Do not ignore conflicts listed in the conflict report. Every conflict must appear in either conflicts_resolved or unresolved_conflicts. - Preserve all ordering constraints listed in the input. - If you cannot resolve a conflict safely, escalate it rather than guessing.
Before wiring this into production, adapt the placeholder resolution rules to match your system's actual priority model. If your agents use numeric priorities, replace the text rules with a scoring function. If you have a human-in-the-loop queue, add a [REVIEW_QUEUE_ENDPOINT] placeholder and instruct the model to format escalation payloads for that endpoint. The output schema is deliberately strict: your harness should validate the JSON against this schema before accepting the merged plan. Reject any response that omits required fields or contains step IDs not present in the input plans.
Prompt Variables
Inputs required for the merge conflict resolution prompt to operate reliably. Each placeholder must be populated before the prompt is assembled and sent.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[AGENT_PLANS] | Array of agent plans to merge, each containing agent ID, proposed actions, resource claims, and ordering constraints | [{"agent_id":"agent-1","plan":{"actions":[...],"resources":["db-lock-1"],"constraints":["action-A before action-B"]}}] | Must be a valid JSON array with at least 2 plans. Each plan object requires agent_id (string), actions (array), resources (array), and constraints (array). Reject if any plan is missing required fields. |
[SHARED_RESOURCES] | Inventory of resources that agents may contend for, including current state and ownership | {"db-lock-1":{"type":"exclusive","current_holder":null,"max_holders":1}} | Must be a valid JSON object. Each resource entry requires type (exclusive or shared), current_holder (string or null), and max_holders (integer). Null allowed for current_holder if unclaimed. |
[CONFLICT_DETECTION_RULES] | Rules that define what constitutes a conflict between plans | {"resource_conflict":"two agents claim same exclusive resource","ordering_conflict":"circular dependency in action ordering","goal_conflict":"agents pursue mutually exclusive outcomes"} | Must be a valid JSON object with at least one conflict type defined. Each rule value must be a non-empty string describing the conflict condition. Validate that rules cover resource, ordering, and goal conflict categories. |
[PRIORITY_POLICY] | Policy for resolving conflicts when plans cannot be fully merged, defining agent or goal precedence | {"default":"higher-priority-agent-wins","agent_priorities":{"agent-1":10,"agent-2":5},"tie_break":"first-submitted"} | Must be a valid JSON object with a default strategy (string) and agent_priorities map (agent_id to integer). Tie_break must be one of: first-submitted, random, or escalate. Reject if priority values are missing for any agent in AGENT_PLANS. |
[SAFETY_CONSTRAINTS] | Invariants that must never be violated by the merged plan | ["no two agents hold same exclusive resource simultaneously","no circular action dependencies","all goal preconditions satisfied before execution"] | Must be a non-empty array of strings. Each constraint must be a declarative statement. Validate that constraints are testable (can be checked against merged plan output). Reject if any constraint is ambiguous or unverifiable. |
[OUTPUT_SCHEMA] | Expected structure of the merged plan output | {"merged_plan":{"actions":[],"resource_assignments":{},"execution_order":[]},"conflicts_resolved":[],"conflicts_escalated":[],"safety_check":{"passed":true,"violations":[]}} | Must be a valid JSON Schema or example object. Required fields: merged_plan (object), conflicts_resolved (array), conflicts_escalated (array), safety_check (object with passed boolean and violations array). Validate that output conforms to this schema after generation. |
[ESCALATION_THRESHOLD] | Conditions under which the merge should be escalated to a human instead of resolved automatically | {"max_unresolvable_conflicts":2,"escalate_on":["safety_violation","goal_contradiction"],"human_review_required":true} | Must be a valid JSON object. max_unresolvable_conflicts must be a non-negative integer. escalate_on must be an array of valid escalation reasons. human_review_required must be boolean. Validate that escalation is triggered when threshold exceeded. |
[CONTEXT_WINDOW_BUDGET] | Token budget allocation for this prompt within the total context window | {"max_input_tokens":4000,"max_output_tokens":2000,"reserved_for_plans":3000} | Must be a valid JSON object with integer values. max_input_tokens must be less than model context limit. Validate that AGENT_PLANS size does not exceed reserved_for_plans budget. Truncate or reject if plans exceed budget. |
Implementation Harness Notes
How to wire the merge prompt into a multi-agent orchestration harness with validation, retries, and safety gates.
The Concurrent Agent Plan Merge Conflict Resolution Prompt is not a standalone chat instruction. It is a structured merge operator that sits inside an agent orchestration harness. The harness is responsible for collecting the conflicting plans, assembling the prompt with the correct [AGENT_A_PLAN], [AGENT_B_PLAN], [SHARED_GOAL], [RESOURCE_CONSTRAINTS], and [CONFLICT_METADATA] placeholders, and then validating the merged output before it is dispatched for execution. Do not call this prompt without first confirming that a real conflict exists—running it on already-compatible plans wastes tokens and risks introducing unnecessary reordering.
Wire the prompt into a merge step that fires only when the orchestrator detects overlapping resource claims, contradictory ordering constraints, or mutually exclusive goal assignments. The harness should serialize each agent plan into a canonical JSON structure with fields for steps, resource_locks, preconditions, and expected_outcomes. Before calling the model, compute a lightweight conflict fingerprint (hash of overlapping resource IDs and contradictory preconditions) and attach it as [CONFLICT_METADATA]. After the model returns a merged plan, run a deterministic post-validation pass: check that no resource is double-booked in the same time window, that all original goal requirements are covered, and that no step depends on an output that was reordered after it. If validation fails, retry once with the validation errors injected into [PREVIOUS_FAILURE_CONTEXT]. If the second attempt also fails, escalate to a human operator with the conflict fingerprint and both original plans—do not loop beyond two retries.
Model choice matters here. Use a model with strong reasoning and structured-output discipline (GPT-4o, Claude 3.5 Sonnet, or equivalent). Set temperature=0 or very low to maximize deterministic merge behavior. The output schema must be strict: a JSON object with merged_plan (array of steps), resolution_decisions (array of conflict-to-resolution mappings), and safety_notes (array of warnings about assumptions made during merge). Log every merge attempt with the conflict fingerprint, model version, raw prompt, raw output, validation result, and final disposition (accepted, retried, escalated). This audit trail is essential for debugging merge failures and proving correctness to downstream systems that will execute the merged plan.
The most common production failure mode is not a bad merge but a merge that silently drops a constraint. A resource lock from Agent A's plan might be omitted from the merged output because the model prioritized conciseness over completeness. Your post-validation must explicitly check that every resource lock, precondition, and goal requirement from both input plans is either preserved in the merged plan or explicitly resolved with a documented trade-off in resolution_decisions. If a constraint disappears without a corresponding resolution entry, reject the output. The second most common failure is ordering inversion: the merged plan reorders steps in a way that violates a hard dependency. Validate the merged step sequence against the original dependency graphs before accepting the output. These checks are not optional—they are the difference between a merge that looks plausible and one that is safe to execute.
Expected Output Contract
The model must return a single JSON object conforming to this contract. Validate the response before accepting it in the agent harness.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
merge_plan | object | Top-level object must parse as valid JSON. Schema check: contains exactly the keys 'merge_plan', 'conflicts_resolved', 'unresolved_conflicts', 'safety_notes'. | |
merge_plan.goal | string | Non-empty string. Must not contradict any input goal from [AGENT_A_PLAN] or [AGENT_B_PLAN]. Check: substring match against input goals. | |
merge_plan.steps | array of objects | Array length >= 1. Each step object must contain 'id' (string), 'action' (string), 'agent' (string matching A or B), 'depends_on' (array of step id strings or empty array). No circular dependencies allowed. | |
merge_plan.resource_assignments | array of objects | Each object must contain 'resource' (string), 'assigned_to' (string matching A or B), 'time_slot' (string). No resource assigned to both agents in overlapping time slots. | |
conflicts_resolved | array of objects | Each object must contain 'conflict_type' (enum: resource, ordering, goal), 'description' (string), 'resolution' (string), 'winning_agent' (string or null). Array can be empty if no conflicts found. | |
unresolved_conflicts | array of objects | Each object must contain 'conflict_type' (enum: resource, ordering, goal), 'description' (string), 'blocking_reason' (string). Array can be empty. If non-empty, merge_plan.steps must be empty and safety_notes must explain escalation. | |
safety_notes | object | Must contain 'completeness_check' (boolean), 'safety_concerns' (array of strings), 'human_review_recommended' (boolean). If human_review_recommended is true, unresolved_conflicts must be non-empty or safety_concerns must be non-empty. |
Common Failure Modes
What breaks first when merging concurrent agent plans and how to guard against it.
Silent Resource Double-Booking
What to watch: Two agents claim the same resource (e.g., a database, API key, or human reviewer) in their plans, and the merge produces a schedule with overlapping assignments. The conflict is invisible until runtime when one agent fails with a resource-unavailable error. Guardrail: Add a resource-capacity check step before merge finalization. The prompt must require the model to list all claimed resources, detect overlaps, and either sequence access or escalate when capacity is exceeded.
Ordering Constraint Violation
What to watch: Agent A's plan requires step X before step Y, but Agent B's plan requires Y before X. The merge produces a linearized plan that satisfies neither dependency, causing deadlock or incorrect execution order. Guardrail: Require the merge prompt to extract and compare all ordering constraints as a directed graph. If a cycle is detected, the prompt must flag it and request constraint relaxation or priority rules rather than silently breaking one dependency.
Goal Contradiction Without Resolution
What to watch: Two agents pursue goals that are logically incompatible (e.g., maximize throughput vs. minimize cost). The merge produces a plan that claims to satisfy both but actually satisfies neither, leading to downstream failures or unsafe trade-offs. Guardrail: Include an explicit goal-contradiction detection step. The prompt must identify contradictory objectives, assign priority based on a predefined policy, and document which goal was subordinated and why. Never allow the model to silently average incompatible goals.
Incomplete Plan Stitching
What to watch: The merge drops steps that appear redundant but are actually required by one agent's plan. The resulting merged plan is shorter but missing critical actions, causing execution gaps. Guardrail: Require the merge prompt to produce a coverage check: every step from every input plan must either appear in the merged plan or be explicitly marked as superseded with a justification. Add a post-merge validation that counts steps and flags missing actions.
Race Condition on Shared State
What to watch: Both agents plan to read-modify-write the same state variable. The merge produces a plan where both reads happen before either write, causing lost updates. Guardrail: The merge prompt must detect read-modify-write patterns on shared state and insert sequencing barriers or transactional boundaries. If the system cannot guarantee atomicity, the prompt must escalate rather than produce an unsafe interleaving.
Merge Produces a Larger Conflict Set
What to watch: The merge prompt itself introduces new conflicts by reordering steps in ways that create resource contention or dependency violations that didn't exist in the original plans. Guardrail: Run the merged plan through the same conflict-detection logic applied to the input plans. If the merged plan has more conflicts than the union of input-plan conflicts, reject the merge and retry with stricter ordering-preservation constraints. Set a retry budget of 2 attempts before escalating to a human operator.
Evaluation Rubric
Use this rubric to test the quality of merge conflict resolution outputs before shipping. Each criterion targets a specific failure mode in concurrent agent plan merging, with concrete pass standards and test methods.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Completeness | All agent plans from [INPUT_PLANS] are represented in the merged output; no task or constraint is silently dropped | Merged plan has fewer tasks or constraints than the sum of input plans without explicit justification for removal | Diff the task IDs and constraint IDs in [INPUT_PLANS] against the merged output; flag any missing without a documented exclusion reason |
Conflict Resolution Traceability | Every resolved conflict includes a resolution rationale referencing the specific conflicting elements and the decision rule applied | Conflict resolution section contains generic statements like 'merged successfully' without linking to specific plan elements | Parse the resolution section for explicit references to conflicting task IDs, resource names, or ordering constraints; fail if any conflict lacks a traceable link |
Resource Conflict Safety | No two tasks in the merged plan claim the same exclusive resource at overlapping times unless explicitly serialized with ordering constraints | Merged plan schedules two tasks on the same exclusive resource concurrently without a serialization constraint | Extract all resource assignments with time windows; check for overlapping intervals on exclusive resources; flag any overlap without an ordering edge |
Ordering Constraint Preservation | All ordering constraints from input plans are preserved in the merged plan unless explicitly relaxed with justification | Merged plan violates a hard ordering constraint from an input plan without documenting the relaxation | Build a directed graph of ordering constraints from [INPUT_PLANS]; check the merged plan's task order for cycles or violated edges; fail on any unaddressed violation |
Goal Contradiction Resolution | Conflicting goals are explicitly identified and resolved with a priority decision or decomposition that preserves safety invariants | Merged plan pursues two mutually exclusive goals simultaneously or ignores a goal contradiction | Extract goal statements from [INPUT_PLANS]; check for logical contradictions using a pairwise comparison; verify each contradiction has a resolution entry in the output |
Safety Invariant Preservation | All safety invariants from input plans are present and enforced in the merged plan; no merged action violates a stated invariant | Merged plan includes an action that violates a safety invariant from any input plan | Extract safety invariants from [INPUT_PLANS]; validate each against the merged plan's action sequence; fail on any invariant violation |
Deadlock Freedom | The merged plan contains no circular wait dependencies between tasks or agents | Merged plan's dependency graph contains a cycle indicating a deadlock | Construct a wait-for graph from the merged plan's task dependencies and resource assignments; run cycle detection; fail on any cycle found |
Output Schema Validity | Output matches [OUTPUT_SCHEMA] exactly: all required fields present, correct types, no extra fields | Output fails schema validation: missing required fields, type mismatches, or unexpected fields | Validate the output against [OUTPUT_SCHEMA] using a JSON Schema validator; fail on any validation error |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a single frontier model and lightweight validation. Focus on plan-merge correctness before adding retry logic or concurrency guards. Replace [AGENT_PLANS] with a simple JSON array of two conflicting plans and [CONFLICT_METADATA] with a short description of the overlap.
Watch for
- Missing resource-conflict detection when plans share the same tool or data store
- Overly broad merge instructions that produce a concatenation instead of a resolution
- No ordering-constraint validation in the merged output

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us