How Multi-Agent Conflict Coordination Works: An Architectural Approach to Reliable AI Agent Systems

    This article explains why asking AI agents to "coordinate" in prompts fails to prevent task conflicts, and presents a five-layer architectural framework—work item uniqueness, leasing and mutual exclusion, isolation and versioning, idempotency and deduplication, and convergence with budgets—for building reliable multi-agent systems. It covers how to separate an interaction layer from an execution layer, four common conflict scenarios, an event-driven outer loop, observability metrics, conflict-injection evaluation, and practical implementation guidance. Technical readers will learn how to move conflicts from probabilistic behavior to testable, repeatable engineering problems.

    1. The Problem: Why “Letting Agents Negotiate” Doesn’t Resolve Conflicts

    In multi-agent systems, task conflicts typically appear in three forms: two executors modifying the same artifact simultaneously; one executor’s conclusion depending on an intermediate state that another executor hasn’t committed yet; or the same trigger event being consumed multiple times, causing the same work to be done repeatedly.

    Many teams’ first instinct is to add a clear instruction to the system prompt—something like “confirm with others before proceeding.” But this kind of prompt-based, phrasing-level constraint is inherently probabilistic: a model may understand it, or it may ignore it. Whether a conflict occurs depends on sampling outcomes, and no reviewer can reach a definitive conclusion about whether the constraint holds.

    The engineering standard is simple: constraints must be enforced by programs, not voluntarily followed by models. Anything that “must never happen” belongs at the architecture level, guaranteed by mutual exclusion, versioning, idempotency, and state machines. Only things that concern “how to do it better” should be left to prompts and model judgment. This boundary is the starting point for every design that follows.

    2. Layering: Separating Interaction from Execution

    A single agent can already complete a development task on its own. The real pain point shows up with parallelism: a person has to switch between multiple session windows and remember where each session left off.

    A practical approach is to split the system into two layers.

    The interaction layer is the persistent entry point. It receives messages from chat groups, tickets, and code hosting platforms; performs identity recognition, intent normalization, deduplication, and routing. It doesn’t carry long-running tasks—it only “receives and dispatches” messages.

    The execution layer is an ephemeral runtime. Each task runs in an isolated space, and the environment is destroyed once the task finishes.

    The direct benefit of this split: the interaction layer can stay online long-term with consistent context, while the execution layer can scale out and be reclaimed at any time. The two layers fail independently. Session state and “memory” no longer depend on a single person’s head or a single long-lived connection—it’s externalized to the ticket system and the code hosting platform.

    3. Four Core Objects: Minimal Units and Scheduling Semantics

    To make scheduling reason about, fix the vocabulary first.

    • Task: A definition of a repeatable piece of work, such as “implement,” “auto-review,” or “rework.” It’s the recipe, not any one specific instance of labor.
    • Trigger: An event that starts a run. Sources include ticket state changes, code platform events, scheduled clocks, or the output of another run.
    • Run: One execution of a given task type on a given runner. From trigger to completion, it is treated as a black box; internally, it may contain multiple sessions.
    • Runner: An ephemeral execution machine. Even if the machine persists long-term, the environment isn’t retained after a run finishes; history can only be reconstructed from tickets, the code platform, and scheduling records.

    Inside a single run, there’s a closed loop between model and tools: the model decides the next step, calls tools, reads results, and decides whether to continue. The surrounding program provides loop control, context assembly, permission policies, and system prompts.

    A complete delivery typically involves multiple runs—implementation, review, and rework—so the scheduling layer deals with the relationships between multiple run instances, not the details of a single inference call.

    4. Where Conflicts Come From: Four Typical Scenarios

    1. Write-write conflicts: Multiple run instances modify the same file or the same branch.
    2. Read-write dependencies: A review run reads implementation work that hasn’t been written to disk yet and reaches a false “no issues” conclusion.
    3. Repeated consumption: The same event is received by multiple consumers, so the same work is done twice, producing duplicate commits and duplicate comments.
    4. Resource contention: Concurrent runs exceed the capacity of build and test environments, causing timeouts and random failures—which in turn trigger meaningless rework.

    Four scenarios require four mechanisms. One lock cannot solve them all.

    5. Coordination Mechanisms: Five Layers of Constraints

    Layer 1: Work item uniqueness. Use the ticket identifier plus the change identifier as the idempotency key. Maintain a state machine for each work item (Open, In Progress, Awaiting Review, Reworking, Delivered). State transitions are validated by the program; illegal transitions are rejected outright. This eliminates, at the source, the situation where two executors both believe they’re advancing the same item.

    1. OPEN --claim--> RUNNING --impl_done--> REVIEWING
    2. REVIEWING --changes_requested--> REWORKING
    3. REWORKING --impl_done--> REVIEWING
    4. REVIEWING --approved--> DELIVERED

    Layer 2: Leasing and mutual exclusion. When a run instance starts, it acquires a lease via an atomic operation. The lease carries an expiration time; instances that fail to acquire the lease exit immediately rather than queueing and idling. An expired lease is treated as reclaimable, avoiding permanent deadlocks if an executor crashes.

    Layer 3: Isolation and versioning. Each run instance uses an independent working copy and an independent branch. Artifacts are passed via commit identifiers, not shared directories. Downstream consumers only consume committed, immutable versions, ruling out reading half-finished work.

    Layer 4: Idempotency and deduplication. Events carry a unique identifier; before consumption, it is written to a deduplication table. All external side effects (comments, state changes, commits) are constrained by an idempotency key, so repeated deliveries produce no additional effect.

    Layer 5: Convergence and budget. Set a maximum number of rework rounds and an overall budget (time, number of calls). If the limit is exceeded, escalate to a human and output diagnostic information. This prevents two executors from “fixing” each other into an infinite loop.

    6. Tying the Flow Together: The Event-Driven Outer Loop

    The outer loop’s job is to string multiple independent runs into a repeatable delivery cycle: event arrives, deduplication, lease acquisition, execution, produce commit, trigger the next task type, write back state, release the lease. Here’s an example of a code change:

    1. Ticket change event -> deduplicate -> acquire lease
    2. -> Run (implement) -> commit version V1
    3. -> Trigger Run (review) reading V1
    4. -> If rework needed: trigger Run (rework) producing V2, back to review
    5. -> Pass: write back state, release lease

    The key point is that every step’s input is an explicit, committed version, and every step’s output is traceable in the ticket and code platform. A runner being reclaimed doesn’t affect flow correctness, because state doesn’t live on the machine.

    7. Observability and Evaluation

    Whether scheduling is reliable should be judged by metrics, not by feel. Collect at least: latency from event to first execution, lease contention rate, number of duplicate executions intercepted, average rework rounds, escalation rate over limit, and end-to-end duration per delivery.

    The evaluation set should include conflict-injection cases: deliberately deliver the same event concurrently, deliberately make review run earlier than implementation completion, deliberately crash a run instance midway—verifying that the system produces only one effective side effect.

    8. Implementation Guidance

    First, get idempotency and leasing working on a single task type, then expand to more task types. Keep permissions to the minimum necessary scope; build and test in isolated environments. Externalize all intermediate artifacts to object storage, message queues, and log services; container platforms handle elastic runners; monitoring and alerting handle exception escalation.

    If you use Baidu AI Cloud’s general cloud products to carry these capabilities, treat them as stateless infrastructure—business state should still have the ticket and code hosting platform as the single source of truth.

    The conclusion is straightforward: reliability in multi-agent coordination doesn’t come from prompts that negotiate better; it comes from five architectural constraints—uniqueness, mutual exclusion, isolation, idempotency, and convergence. Give “what must not happen” to programs and “what can be done better” to models, and conflicts turn from guesswork into testable, regression-able engineering problems.