Building a Multi-Agent Parallel Architecture: A Practical Guide

    This article explains how to move conversational AI systems from strictly serial request handling to a parallel, multi-agent task architecture. It covers a two-layer design that separates a dispatcher (control plane) from execution units (data plane), the principles of task decomposition and dependency modeling with DAGs, background job execution to keep the frontend responsive, hot-context plus cold-archive context governance, result aggregation and conflict resolution, fault tolerance and cost control, and the observability and evaluation metrics needed before launch. Readers will get a reusable architectural methodology for handling complex, multi-step agent workloads.

    1. The Problem: Why Serial, Single-Task Execution Becomes a Bottleneck

    In early conversational AI applications, the interaction model was strictly serial: the user submits a request, and the system completes reasoning and output within the same session context, unable to accept new valid instructions in the meantime. This works fine for short question-and-answer scenarios, but once the task becomes a composite flow such as “research + summarize + generate a document + validate,” waiting time expands quickly, and users are forced to stare at the window and wait.

    Context bloat makes things worse. As turns accumulate, historical messages, intermediate artifacts, and reference material all pile up in the same context, leading to three consequences: first, inference cost rises; second, key information gets diluted and accuracy drops; third, the cost of retrying after a failure is extremely high, because every retry has to reload the entire history.

    As a result, the industry has gradually reached a consensus: agents need to be transformed from “single-threaded question answerers” into “task systems with scheduling capabilities.” The core of this is not making a single model smarter, but changing the execution structure of the system.

    2. Core Architecture: A Two-Layer Design of Dispatcher and Execution Units

    The two-layer architecture can be abstracted as a separation of “control plane + data plane.”

    The control plane is handled by the dispatcher, whose responsibilities include intent recognition, task decomposition, dependency determination, execution unit assignment, and result aggregation and conflict resolution. The data plane is handled by multiple execution units, each of which only cares about the atomic subtask assigned to it and has its own independent context window and tool permissions.

    Illustrative pseudocode:

    1. class Router:
    2. def handle(self, request):
    3. plan = decompose(request) # Task decomposition
    4. dag = build_dependency(plan) # Build the dependency graph
    5. return scheduler.run(dag)
    6. class Worker:
    7. def run(self, subtask, ctx):
    8. result = tool_invoke(subtask, ctx) # Invoke retrieval/computation/generation capabilities
    9. return summarize(result) # Return only the core conclusion

    The key benefit of this design is that the dispatcher does not have to carry all the details, and the execution units do not have to understand the global goal. The overall system complexity is sliced into manageable granularity.

    3. The Key to Parallel Execution: Task Decomposition and Dependency Modeling

    Parallelism is not simply copying a request multiple times; it depends on correct task partitioning. In practice, three principles are recommended:

    First, atomicity. A subtask should independently produce a verifiable result, avoiding “you-within-me” cross-dependencies.

    Second, aggregability. Subtask outputs must converge under a unified schema; otherwise, the aggregation stage degrades into manual stitching.

    Third, dependency minimization. Model tasks as a directed acyclic graph, parallelize only nodes without dependencies, and serialize nodes with strong dependencies, avoiding the resource waste caused by pseudo-parallelism.

    A simplified task graph representation:

    1. {
    2. "nodes": [
    3. {"id": "t1", "type": "retrieve", "deps": []},
    4. {"id": "t2", "type": "analyze", "deps": ["t1"]},
    5. {"id": "t3", "type": "analyze", "deps": ["t1"]},
    6. {"id": "t4", "type": "merge", "deps": ["t2", "t3"]}
    7. ]
    8. }

    Here t2 and t3 can run in parallel, while t4 must wait for both to complete.

    4. Moving Long Tasks to the Background While Protecting Frontend Responsiveness

    A parallel architecture must be paired with a “never block the frontend” mechanism. A common engineering practice is to turn time-consuming tasks into background jobs: the frontend immediately returns a task identifier, and the user can continue to initiate new interactions; after the background job completes, results are backfilled via event notifications or a polling interface.

    The state machine should include at least: received, queued, executing, waiting for additional information, completed, failed and retryable, and failed and terminated. Every state transition should be written to a log to facilitate troubleshooting and cost accounting.

    When deploying on the cloud, it is common to combine a message queue for task buffering, a container platform for elastic scaling of execution units, object storage for archiving intermediate artifacts, and logging, monitoring, and alerting services for observability support. These are all general capability categories, and specific choices should be evaluated based on concurrency and latency targets.

    5. Context Governance: Keep Only the Core, Archive and Retrieve the Rest

    Whether the two-layer architecture runs stably depends largely on the context strategy. The recommended approach is “hot context + cold archive”:

    • The hot context retains only the goal, constraints, and current subtask conclusions;
    • Cold data (raw documents, long logs, intermediate artifacts) is written to archive storage with summaries and indexes attached;
    • Execution units retrieve on demand rather than passively receiving the full set of materials.

    Illustrative structure:

    1. hot_context = {
    2. "goal": "...",
    3. "constraints": [...],
    4. "accepted_facts": [...]
    5. }
    6. cold_store = archive(raw_materials) # Returns a retrievable handle

    This design can significantly suppress context bloat while keeping retry costs controllable: a failed unit only needs to rebuild its own hot context.

    6. Result Aggregation, Conflict Resolution, and Quality Validation

    Multiple execution units running in parallel inevitably produce inconsistent results. The aggregation stage needs clear arbitration rules: prefer conclusions with more complete evidence chains; cross-validate numerical results; and trigger a secondary verification subtask for mutually contradictory judgments.

    It is recommended to define acceptance criteria for each subtask, for example “must include source citations” or “must provide structured fields.” If acceptance fails, the task returns to the queue for retry rather than exposing a half-finished product directly to the user.

    7. Fault Tolerance, Rate Limiting, and Cost Control

    Parallelism amplifies the blast radius of failures, so you need unit-level timeouts and circuit breaking, a retry limit for failures, idempotency key design to avoid duplicate side effects, and concurrency quotas by tenant and task type. On the cost side, it is recommended to meter tokens and tool invocation counts at subtask granularity, identify high-consumption nodes, and optimize prompts and retrieval scope.

    8. Observability and the Evaluation System

    Before launch, prepare at least three categories of metrics: task success rate, end-to-end latency distribution, and average cost per task. Also retain full-chain tracing so that scheduling decisions can be reviewed. The evaluation set should cover three types of tasks: single-task goals, parallel-task goals, and tasks that require manual supplementary information, avoiding the pitfall where only average metrics are examined and long-tail problems are hidden.

    9. Conclusion

    Moving from serial question answering to a parallel task system is essentially advancing agent engineering from “prompt engineering tricks” to “system architecture design.” Separation of scheduling and execution, graph-based task modeling, moving long tasks to the background, and hot/cold layering of context form four reusable cornerstones. Once you master this methodology, whether you are building your own agent platform or building on general cloud capabilities on Baidu AI Cloud, you can handle complex task scenarios with greater ease.