Choosing Between Multi-Agent and Single-Agent Architectures: A Developer's Guide

    The competition among large language models has shifted from parameter size to practical business application. When building AI agents, developers face a critical choice between multi-agent collaboration and single-agent efficiency. This article explores the technical foundations, execution scheduling, business models, and engineering risks of both approaches, providing a comprehensive guide to help developers select the right architecture based on task complexity, concurrency, latency, and cost.

    The competition among large language models has shifted from competing on parameter size to competing on the ability to apply model capabilities to specific business scenarios. Currently, there are two main approaches in the agent direction. One is multi-agent collaboration: a main orchestrator agent decomposes tasks, multiple sub-agents execute them in division of labor, and the results are finally aggregated. The other is single-agent efficiency: relying on a sufficiently capable model with low inference costs to complete tasks directly, reducing external orchestration. Both routes have their applicable scenarios, and the cost of choosing the wrong route is often higher than any single technical detail.

    1. From Information Retrieval to Execution

    Early large models were mostly used for Q&A and long-text retrieval. The user asks a question, the model gives an answer, and the task ends there. The goal of an agent is to enable the model to perform actions: calling tools, reading and writing files, querying databases, running code, and deciding the next step based on the results. This transition brings three new problems: how to decompose tasks, how to save intermediate states, and how to recover from errors. The multi-agent architecture emerged to solve these three problems.

    2. Scheduling Implementation of the Execution Engine

    The core work of the main agent is to convert the user’s goal into a task graph. A task graph is a Directed Acyclic Graph (DAG), where each node is a sub-task and each edge represents a dependency. The scheduler executes in topological order: downstream tasks can only start after upstream tasks are completed.

    Below is the corrected scheduling logic. A common early implementation checks the results dictionary for dependencies when submitting a task. The problem is that the upstream task might still be running, leaving the results dictionary empty, causing the downstream task to be incorrectly skipped. The corrected version only submits downstream tasks after dependencies are completed, incorporating concurrency limits, timeouts, retries, and failure propagation.

    1. from concurrent.futures import FIRST_COMPLETED, ThreadPoolExecutor, wait
    2. from graphlib import TopologicalSorter # Python 3.9+
    3. class Orchestrator:
    4. def __init__(self, max_workers=8, max_retries=2, timeout_s=60):
    5. self.max_workers = max_workers # Concurrency limit to prevent rate limiting and cost overrun
    6. self.max_retries = max_retries # Max retries for a single task
    7. self.timeout_s = timeout_s # Timeout if no task completes for a long period
    8. def run(self, graph, agents):
    9. # graph: {task_id: set of dependency task_ids}
    10. # agents: {task_id: callable agent(inputs)}
    11. sorter = TopologicalSorter(graph)
    12. sorter.prepare() # Raises error immediately if a cycle exists
    13. results, failed = {}, {}
    14. pending = {} # running future -> task_id
    15. with ThreadPoolExecutor(max_workers=self.max_workers) as pool:
    16. while sorter.is_active():
    17. for task_id in sorter.get_ready():
    18. deps = graph.get(task_id, set())
    19. if any(d in failed for d in deps):
    20. # Skips execution with empty inputs if upstream fails
    21. failed[task_id] = "upstream failed, skipped"
    22. sorter.done(task_id)
    23. continue
    24. # Dependencies are guaranteed complete by the sorter, so results exist
    25. inputs = {d: results[d] for d in deps}
    26. future = pool.submit(self._run_with_retry, agents[task_id], inputs)
    27. pending[future] = task_id
    28. if not pending:
    29. continue
    30. done, _ = wait(pending, timeout=self.timeout_s,
    31. return_when=FIRST_COMPLETED)
    32. if not done:
    33. raise TimeoutError("Timeout: no task completed within the period")
    34. for future in done:
    35. task_id = pending.pop(future)
    36. try:
    37. results[task_id] = future.result()
    38. except Exception as exc:
    39. failed[task_id] = repr(exc)
    40. sorter.done(task_id)
    41. return results, failed
    42. def _run_with_retry(self, agent, inputs):
    43. last_exc = None
    44. for _ in range(self.max_retries + 1):
    45. try:
    46. return agent(inputs)
    47. except Exception as exc:
    48. last_exc = exc # Production environments should implement exponential backoff
    49. raise last_exc

    There are a few design details to explain in this code. max_workers limits the number of sub-agents running simultaneously, preventing a large number of requests from hitting the model API at once, which could trigger rate limits or incur uncontrollable costs. timeout_s prevents a sub-task from hanging indefinitely. The retry limit should be capped, and implementing exponential backoff is recommended. A failed upstream task will cause all downstream tasks to be marked as skipped rather than continuing with missing inputs, avoiding seemingly successful but actually erroneous results.

    3. Technical Foundations of Single-Agent Efficiency

    The single-agent route aims to increase the capability ceiling of a single model while reducing scheduling overhead. A common current implementation is the Mixture of Experts (MoE) architecture. The model contains multiple expert sub-networks, and each token only activates a few experts after passing through a router. Therefore, the model’s total parameter count and the actual parameters involved in computation are two different numbers.

    Consider a hypothetical example: a model has 1000B total parameters and activates about 50B parameters per token. These numbers are for illustrative purposes only and do not represent actual data of any specific model. With a 5% activation rate, the computational load of a single inference is roughly equivalent to a 50B dense model, while the model’s capacity approaches 1000B. This design provides a compromise between quality and cost, but it does not automatically bring low costs. The memory must still accommodate the weights of all experts, so the deployment threshold is not lowered.

    Another major overhead in long-context inference is the KV-Cache. It saves the keys and values of the attention mechanism for each layer. The memory footprint can be estimated using the following formula:

    KV-Cache Memory ≈ 2 × Layers × KV Heads × Head Dimension × Sequence Length × Batch Size × Bytes per Element

    Assuming 60 layers, 8 KV heads, a head dimension of 128, a sequence length of 8192, a batch size of 16, and using FP16 (2 bytes per element), the memory required is about 32 GB. This indicates that in high-concurrency long-text scenarios, the KV-Cache may exhaust memory faster than the model weights. Grouped-Query Attention (GQA), KV-Cache quantization, and memory pooling are common mitigation strategies.

    The calculation method for unit cost also needs to be clarified. A comparable algorithm is: Unit Token Cost = Hourly Cost per Card × Number of Cards ÷ Effective Output Tokens per Hour. The number of effective output tokens depends on input/output length, batching strategy, and concurrency. Therefore, when comparing the prices of two models, you should fix the model version, input/output length, concurrency, and hardware conditions; otherwise, the conclusion is invalid.

    4. Business Models: From Token-Based to Outcome-Based Billing

    Traditional APIs bill by token. Multi-agent systems, however, are closer to task or outcome-based billing. A single task might involve multiple model calls and multiple tool calls; if it were still settled by tokens, it would be difficult for customers to understand the final price. Therefore, some vendors try to charge by project or membership benefits. This approach is more intuitive for customers, but the vendor must bear the cost of failed tasks, requiring appropriate margins in pricing.

    5. A Developer’s Guide to Architecture Selection

    When is Multi-Agent Collaboration Suitable?

    It is suitable for scenarios with many task steps, requiring multiple tools, and where the context of a single inference cannot fit the entire task. Examples include automatically generating and validating code, cross-system data analysis, and multi-source information verification. If the task is single-turn Q&A, text summarization, or real-time completion, multi-agent is usually unnecessary.

    When Should You Choose a Single-Agent Model?

    Single-agent models are more suitable when the business involves high concurrency, single-turn interactions, and is sensitive to latency and unit costs. Reducing the orchestration layer means fewer network hops and less state storage, making the system easier to scale.

    How Do the Two Routes Compare?

    Dimension Multi-Agent Collaboration Single-Agent Model
    Task Complexity Multi-step, multi-tool Single-step or few steps
    Concurrency Medium to low, limited by scheduling and cost High, horizontally scalable by instance
    Latency Accumulates with task steps, requires scenario-based stress testing Lower, requires empirical testing with P95 and P99
    Unit Cost High cost due to multiple calls Low cost per call, requires fixed metric comparison
    Ops Requirements Requires message queues, state storage, and monitoring Primarily model service and inference monitoring
    Compliance Long intermediate state and log chains, requires desensitization at each node Short chain, easy to audit

    It is recommended to first evaluate with a small sample of real business data. Key metrics include task success rate, P95 latency, average cost per task, and human intervention rate. Until the data meets expectations, it is not advisable to deploy a multi-agent architecture directly to production.

    6. Engineering Risks and Governance

    Multi-agent systems are prone to hallucination amplification: an erroneous conclusion from a previous sub-agent is treated as fact by subsequent agents, causing the error to accumulate progressively. Another common issue is infinite loops, where two agents repeatedly modify the same result without converging. You can refer to the following governance checklist:

    • Set a maximum number of steps and retry limits for single tasks.
    • Set cost and token budgets; pause tasks if exceeded.
    • Implement human-in-the-loop confirmation for critical operations like payments, deletions, and external communications.
    • Save the input and output of each step to support rollback to the last stable state.
    • Perform structured validation on sub-agent outputs; unqualified results are not passed downstream.

    If you promise an SLA (Service Level Agreement) to customers, the promises should be based on empirical data. When promising task success rates or response times, you should simultaneously specify the sample size, task types, and criteria for failure.

    While open-source model weights can be obtained for free, what enterprises truly need is deployment, tuning, monitoring, and technical support. If only weights are provided, users may turn to self-hosting or other service providers. Common supporting elements include deployment documentation and inference optimization solutions, fine-tuning toolchains, monitoring and alerting, and private deployment support. The business closed-loop relies on whether these services can generate stable paid demand, which the weights alone cannot support.

    Regardless of which route you choose, data boundaries must be clear. Before calling an external model, confirm whether the data will be used for training, where the data is stored geographically, and whether the logs contain personal information. In multi-agent systems, intermediate results are passed between multiple nodes, so desensitization and access control must cover every node.

    Conclusion

    There is no absolute superiority between the two routes. For businesses with complex tasks requiring tool collaboration, multi-agent can provide higher task coverage. For businesses with high concurrency, low latency, and cost sensitivity, single-agent models are easier to scale. The key to selection is evaluating with real data rather than relying on marketing metrics. As heterogeneous computing power and cloud-native infrastructure mature, enterprises can leverage general cloud services for computing, storage, and deployment capabilities, and then combine the two architectures according to business needs.