Model Selection and Cost Control Practices in Multi-Agent Collaboration

    Explore practical strategies in multi-agent collaboration to address model selection, result verification, unresponsiveness, and the cost of switching between planning and execution. Learn how to build reliable and cost-effective AI agent systems using explicit model rules, evidence constraints, and cache optimization.

    I. Background: Common Patterns in Multi-Agent Collaboration

    In coding assistance and automated development scenarios, a single agent handling long tasks often suffers from context bloat, attention dispersion, and decreased efficiency. Consequently, many teams adopt multi-agent collaboration: a main agent is responsible for understanding requirements, decomposing tasks, and summarizing conclusions, while delegating specific work such as retrieval, code reading, sample writing, and documentation checking to several sub-agents for parallel execution.

    The benefits of this structure are straightforward: parallel execution shortens waiting times, and the context for each subtask is smaller and more focused. However, it also introduces several new challenges:

    1. Which model a subtask uses is often determined by default configurations rather than the nature of the task itself.
    2. Whether a sub-agent’s output is truthful requires additional mechanisms to verify.
    3. How the overall workflow continues when a sub-agent becomes unresponsive.
    4. How costs are calculated when the main agent switches models between planning and execution.

    These four issues are interrelated. Let’s explore them one by one.

    II. Model Inheritance in Subtasks

    Many frameworks default to letting subtasks inherit the model used in the main session. This design poses no issues for simple tasks but introduces two types of risks in mixed-task scenarios.

    The first risk is cost overruns. If the main session uses a high-capability, high-priced model, all subtasks will consume quota at the same rate. Low-difficulty work like retrieval and format conversion does not require such a powerful model, yet it still occupies a significant amount of the quota.

    The second risk is version drift. When dispatching tasks, the system might silently fall back to an earlier model version without the coordinator’s knowledge. The results may appear normal, but the actual capability and behavior have diverged from expectations.

    The solution is to make model selection an explicit rule rather than relying on inheritance:

    • Specify the model for each type of subtask during dispatch and record it in the task description.
    • Check the runtime logs after dispatch to confirm that the actual invoked model name matches expectations.
    • Set alerts for model changes within the same session; pause related tasks immediately if drift is detected.

    By specifying models explicitly, teams can configure them in tiers based on task difficulty: use more capable models for planning and decision-making, and use faster, lower-cost models for batch reading and organization. This tiering should be based on task complexity and risk, not on the model’s marketing positioning.

    III. Result Credibility: From Self-Reporting to Evidence Constraints

    The most easily overlooked problem in multi-agent collaboration is that sub-agents may claim to have completed their work when they actually have not. Symptoms of this include reporting progress without deliverables, providing conclusions without supporting evidence, or skipping steps while claiming everything has passed.

    The solution is to change the definition of “completion” from “the executor says it’s done” to “the deliverable can be independently verified.” The following constraints can be applied:

    1. Every finding must be accompanied by a source. The source can be a file path with a line number or a web address with a quoted excerpt.
    2. If no source is found, explicitly write “Not Found” and forbid adding speculative content.
    3. Separate conclusions from findings. Executors only submit raw findings; judgment and summarization are performed by the main agent or a designated checker.
    4. Set up an independent checker role. Reserve one checker per batch of tasks to sample and verify whether the sources exist and whether the excerpts match the original text.

    While this approach adds some process overhead, it significantly reduces rework. For code-related tasks, sub-agents can also be required to attach runnable test results or compilation outputs, converting subjective statements into objective evidence.

    IV. Offline Detection and Task Takeover

    During long-term parallel execution, sub-agents may become unresponsive due to network anomalies, stuck tool calls, or context limits. Without a timeout mechanism, the overall workflow will wait indefinitely, wasting resources.

    A practical design is to set a fixed inactivity timeout threshold for each subtask. For example, if no progress file has been written or if errors are continuously reported beyond a set duration, the task is considered offline. The handling steps after determination are as follows:

    1. Preserve the progress files already written by the offline subtask; do not delete them.
    2. Transfer the progress files and the original task description to another executor to continue the work.
    3. Record the reason for going offline and the takeover time for subsequent review.

    Directory isolation is a prerequisite for this mechanism to function smoothly. Each sub-agent is only allowed to write to directories under its own namespace, such as partitioning by “task_name/role_name”. This allows the takeover executor to directly read the predecessor’s deliverables and prevents mutual overwriting caused by multiple agents writing to the same file simultaneously.

    V. Separation of Planning and Execution: The Cost of Model Switching

    A common practice is to use a more capable model for the planning phase and a faster model for the execution phase, switching between them within the same session. While theoretically reasonable, this design incurs two hidden costs in actual operation.

    5.1 Cache Invalidation

    Most model services cache the input prefix. As long as the prefix content remains unchanged, subsequent requests can reuse the already computed results, thereby reducing latency and cost. Switching to another model usually means the original cache cannot be reused, and the prefix must be recalculated. If this switching occurs frequently, the cache hit rate will drop significantly.

    To improve the hit rate, follow two principles:

    • Place system prompts, tool definitions, and long materials at the very beginning of the context, keeping them unchanged throughout the session.
    • Append new content only at the end without modifying existing preceding parts.

    These two principles are independent of specific service providers and represent a universal method for leveraging prefix caching.

    5.2 Fallbacks Caused by Clarifications

    During the execution phase, if the execution model repeatedly asks the user for clarification, and the system is designed to automatically revert to the planning model upon such inquiries, each query will trigger a switch and a subsequent cache rebuild. This type of design can cause costs to far exceed expectations.

    A more reasonable approach is:

    • Write the complete plan during the planning phase and obtain manual confirmation before starting.
    • If uncertain issues arise during execution, record them in a to-do list to be handled uniformly after execution is complete.
    • Only allow switching back to planning when explicit failure conditions occur, such as the same test failing twice in a row.
    • Set a maximum number of switches for a single session; if exceeded, pause and request manual intervention.

    The specific limit value should be determined based on the task scale and cost budget. The key is to make switching a justified action rather than a default behavior.

    VI. How to Measure Collaboration Effectiveness

    To determine whether a set of collaboration rules is effective, you should observe at least the following metrics:

    • Task Completion Rate: The proportion of subtasks ultimately accepted.
    • Rework Rate: The proportion of tasks that need to be redone due to missing sources or incorrect conclusions.
    • Cache Hit Rate: Counted by session and by phase to help locate losses caused by switching.
    • Single Task Quota Consumption: Consumption comparisons of similar tasks under different configurations.
    • Takeover Time: The time from determining a task is offline to resuming the task.

    When analyzing statistics, controlled experiments should be conducted using the same batch of tasks and the same set of evaluation criteria. Comparing results from a single run can easily be skewed by task differences.

    VII. Rule Template Example

    Below is an illustrative configuration snippet demonstrating how the above rules can be implemented. The field names are defined for explanatory purposes and do not represent a specific tool’s interface.

    1. collaboration:
    2. default_model_policy: explicit # No silent inheritance
    3. planner_model: planner-tier # Model tier used for the planning phase
    4. executor_model: executor-tier # Model tier used for the execution phase
    5. max_switches_per_session: 3 # Maximum number of switches per session
    6. switch_trigger:
    7. - repeated_test_failure: 2 # Allow fallback only after the same test fails twice
    8. executor_policy:
    9. workers: "Assign 3 to 4 workers based on workload"
    10. checker: 1 # Set one checker per batch of tasks
    11. finding_requires: [file_line_or_url, quoted_excerpt]
    12. missing_evidence_value: "Not Found"
    13. timeout_minutes: 15 # Inactivity threshold for offline determination
    14. takeover: transfer_progress_file
    15. workspace:
    16. isolation: "task/role" # Each agent writes only to its own directory
    17. prompt_layout:
    18. stable_prefix: [system, tools, long_materials]
    19. append_only: true

    When using such configurations, it is best to write them into the project’s global rules file so that all sessions follow the same standard by default, rather than relying on temporary reminders during each conversation.

    VIII. Conclusion

    The value of multi-agent collaboration lies in parallelism and division of labor, but it simultaneously amplifies issues in model selection, result verification, and state management. Making model selection explicit, constraining results with evidence, designing takeover paths for unresponsive agents, and controlling the frequency of switching between planning and execution are foundational tasks to make collaboration both reliable and economical. These rules are product-agnostic and can be migrated to any development environment that supports multi-agent orchestration.