Multi-Agent Collaboration: Improving LLM Workflows with a Manager–Worker Architecture

    A Manager–Worker architecture separates user-facing coordination from specialized coding and reasoning tasks. This article explains how on-demand delegation, self-contained task inputs, output verification, sandbox isolation, and session state management can help multi-agent workflows balance cost, latency, and output quality.

    1. Why One Model Should Not Handle Everything

    For a long time, many developers—including me—assumed that finding a sufficiently capable general-purpose large language model would solve everything. Requirements analysis, task decomposition, coding, documentation, and reporting could all go through the same model.

    In practice, this approach reveals three problems:

    1. A mismatch between capability, cost, and latency. Using the most capable model—often also the most expensive and slowest—for casual conversation, requirements clarification, or document editing wastes resources. Conversely, assigning mathematical derivations or complex algorithms to a lightweight model can compromise the success rate.
    2. Uneven strengths across models. Some models excel at clear communication, conversational nuance, and context comprehension, making them suitable for user-facing work. Others are stronger at coding and rigorous reasoning. Asking one model to cover both roles does not necessarily produce the best results in either.
    3. Context contamination. Putting every stage into a single conversation mixes unrelated information. Irrelevant history can distract the model and reduce output quality.

    The principle is familiar from human teams: a product manager would not normally implement the core algorithm, and an algorithm engineer would not spend every day in meetings writing status reports. Assigning specialized work to specialized roles is a more effective way to organize the workflow.

    2. The Manager–Worker Architecture

    Based on these observations, I use a simple two-layer architecture for multi-agent workflows. Think of it as a general contractor coordinating specialist work: a Manager handles the overall job, while a Worker takes on the technically demanding parts.

    Manager: User-Facing Coordinator

    The Manager uses a broadly capable, responsive multimodal model with strong communication skills. Its responsibilities include:

    • Requirements clarification: Interact with the user and turn vague or conversational requests into clear objectives.
    • Task decomposition: Break complex objectives into executable subtasks and decide who should handle each one.
    • Routing and delegation: Complete lightweight tasks directly and package demanding tasks for the Worker.
    • Review and reporting: Check and integrate Worker outputs, then present conclusions in language the user can readily understand.

    The Manager’s defining strength is not advanced formal reasoning but clear, accessible communication. It should explain complex issues in an organized way without excessive jargon or a condescending tone. Long-context comprehension and multimodal processing also matter, allowing it to interpret charts, screenshots, and lengthy documents.

    Worker: Specialized Technical Executor

    The Worker uses a model suited to code generation and rigorous logical reasoning. Its role has several defining characteristics:

    • It handles core algorithms, mathematical derivations, and code modules with complex edge cases.
    • It works best with clean context and explicit boundaries. Focused inputs help produce more consistent outputs.
    • It typically operates in an isolated sandbox, concentrating on code and reasoning rather than communicating with the user.

    Reasoning-oriented models are also used to assist with demanding mathematical proofs, illustrating their relevance to strict logical tasks. In this architecture, they take on the technically intensive work.

    3. The Key Mechanism: On-Demand Skill Invocation

    The central idea is not simply to give two models separate jobs. It is to delegate dynamically when the task requires it.

    The following pseudocode illustrates the workflow:

    1. class ManagerAgent:
    2. def handle(self, user_request):
    3. plan = self.decompose(user_request) # Break down the task
    4. for task in plan.subtasks:
    5. if task.is_hardcore(): # Complex algorithms, math, or rigorous logic
    6. result = self.invoke_worker(task)
    7. result = self.verify(result) # Review the output
    8. else:
    9. result = self.do(task) # Handle lightweight tasks directly
    10. return self.summarize(plan.results) # Report the results
    11. def invoke_worker(self, task):
    12. # Delegate to the background Worker model through the Skill mechanism
    13. return worker_agent.execute(
    14. prompt=task.prompt,
    15. context=task.context,
    16. constraints=task.boundaries
    17. )

    Here, the Skill mechanism acts as the on-demand delegation path to the Worker.

    This approach offers three practical benefits:

    • Lower token usage and cost: Routine conversation and documentation stay with the responsive Manager rather than triggering an expensive reasoning model.
    • Better task–model alignment: When a subtask requires demanding reasoning, the Manager invokes the Skill and sends the necessary context to the model best suited to the work.
    • A consistent user experience: The user interacts with a single entry point—the Manager—while delegation happens behind the scenes.

    The division of responsibilities is straightforward: the Manager handles communication and coordination, the Worker tackles difficult technical problems, and the user remains focused on the overall task.

    4. Engineering Details That Make the Workflow Reliable

    Getting this architecture running is relatively straightforward. Making it reliable requires attention to several implementation details.

    1. Make Every Delegated Task Self-Contained

    The Worker’s prompt must include enough context to execute the task: input and output formats, constraints, and dependency information.

    Do not assume the Worker knows the Manager’s conversation history. Clean context and clear boundaries are prerequisites for useful Worker output.

    2. Do Not Skip Output Verification

    Worker output should not pass directly to the user without review. The Manager needs to check whether the result is complete and satisfies the specified constraints, requesting a retry when necessary.

    This review-and-retry loop is an important safeguard for the architecture’s reliability.

    3. Define Delegation Criteria Explicitly

    What qualifies as a demanding task?

    Use a combination of rules and model judgment. Tasks involving mathematical derivation, complex algorithms, or strict formal logic should be prioritized for Worker execution. Other tasks can remain with the Manager.

    Avoid delegating everything: excessive handoffs can increase both latency and cost.

    4. Isolate Code Execution in a Sandbox

    When the Worker executes code, it should run in an isolated environment with restricted filesystem and network access. This helps prevent unintended side effects.

    5. Separate Global State from Worker Execution

    The Manager should maintain global task state, including progress and intermediate artifacts. The Worker should execute tasks without retaining session state.

    This separation makes failed tasks easier to retry and completed results easier to reuse.

    5. A Shift from Model Selection to Task Matching

    Recent model development suggests that leading models continue to improve, with multiple teams advancing in parallel. For developers, this creates opportunities to replace either the Manager or the Worker with a model better suited to its role. The architecture does not depend on a particular implementation.

    The more important change is conceptual: instead of asking “Which model is strongest?”, ask “Which type of model fits this task?”

    The value of a multi-agent system does not come from adding more models. It comes from an engineered division of labor that combines their strengths while limiting the impact of their weaknesses.

    If you are still trying to make one general-purpose model do everything, consider a Manager–Worker workflow. Define the roles, make task boundaries explicit, and connect the Worker through an on-demand Skill mechanism. This provides a practical path toward more efficient collaboration without forcing every task through the same model.