More Sub-Agents Isn't Always Better: Design Principles for a Single Main-Loop Architecture
Multi-agent orchestration has become a default instinct when building LLM-powered agents, but splitting tasks across many sub-agents adds handoff loss, error propagation, and cost before it adds value. This article compares three common agent architectures—monolithic prompt, single main loop with progressive disclosure, and multi-agent collaboration—explains how a single main loop works with on-demand skill loading, identifies the scenarios where sub-agents are genuinely justified (context isolation, true parallelism, permission boundaries), and offers practical guidance on cost control, evaluation metrics, and safe production deployment.
1. Background: Why Multi-Agent Became the Default
Over the past year, large language models have evolved from single-turn Q&A into agents that can call tools and execute tasks continuously. When building such systems, a common intuition is to split work among multiple specialized sub-agents: one for retrieval, one for coding, one for review, with a coordinator aggregating the results. This approach is conceptually clean and looks more “engineered.”
But splitting has a cost. Every sub-agent needs its own instructions, context, and tool descriptions. Information is lost at each handoff, and debugging requires tracing multiple execution chains. When the number of splits exceeds what the task actually requires, system complexity and operating cost grow faster than the benefits. Architecture choices should start from the task itself, not from the assumption that more agents means more advanced.
2. Three Common Architectures and Their Boundaries
In practice, most solutions fall into one of three categories.
| Architecture | Core approach | Strengths | Main risks |
|---|---|---|---|
| Monolithic prompt | All rules, knowledge, and workflows packed into one very long prompt | Simple to build, no handoff loss | Instructions interfere with each other, context bloat, hard to maintain |
| Single main loop + progressive disclosure | One main loop makes decisions; skills and tools load on demand | Controlled context, traceable behavior, low extension cost | Poorly designed loops can produce overly long decision chains |
| Multi-agent collaboration | A coordinator dispatches tasks to independent sub-agents | Parallel execution, clear role isolation | High handoff cost, error propagation, multiplied cost |
Evaluate three dimensions when choosing: Can the task be parallelized? Do subtasks need to share large amounts of context? Do different subtasks require different permission boundaries? If none of these hold, a single main loop is usually the safer starting point.
3. How the Single Main Loop Works
The core of a single main loop is a repeating control structure: the model decides the next action based on the current state, executes a tool call, writes the result back into the context, and enters the next iteration until the task completes or a stop condition triggers.
Three properties matter here.
First, centralized state. All intermediate results live in the same context, so the model never has to reconstruct information from another agent’s summary.
Second, controlled actions. Every tool call passes through a unified dispatch layer, which makes parameter validation, permission checks, and logging straightforward.
Third, explicit termination. Set a maximum number of steps, a timeout, and a retry limit to prevent the model from looping forever in a broken state.
Illustrative code:
MAX_STEPS = 30def run_agent(task, base_rules, skill_index, tools, model):system = build_system_prompt(base_rules, skill_index)messages = [{"role": "system", "content": system},{"role": "user", "content": task}]for step in range(MAX_STEPS):reply = model.generate(messages, tools=tools.schemas())if reply.tool_call is None:return reply.text # model produced the final answerresult = tools.execute(reply.tool_call) # unified dispatch and validationmessages.append({"role": "assistant", "content": reply.raw})messages.append({"role": "tool", "content": result})raise RuntimeError("Maximum steps exceeded; task not completed")
The example omits error handling and logging details, but it captures the skeleton of the control structure: one loop, unified dispatch, explicit termination.
4. Progressive Disclosure: Loading Skills and Tools on Demand
Progressive disclosure means giving the model detailed information only when it is needed. Applied to agent systems, it works in two layers.
The first layer is an index. The system prompt keeps only each skill’s name and a one-line description, so the model knows what capabilities exist.
The second layer is the full content. When the model decides a skill is relevant to the current task, it reads that skill’s complete instructions, examples, and constraints through a dedicated load action.
The benefit is that prompt length decouples from the number of skills. Adding a new skill means adding one index entry instead of making every task pay extra context overhead. The model’s attention also stays focused—irrelevant rules don’t interfere with the current decision.
Example:
SKILL_INDEX = {"database_migration": {"path": "skills/db_migration.md","summary": "Standardized workflow for schema changes"},"report_generation": {"path": "skills/report.md","summary": "Field and format requirements for reports"},}def build_system_prompt(base_rules, skill_index):lines = [f"- {name}: {meta['summary']}"for name, meta in skill_index.items()]return base_rules + "\n\nAvailable skill index:\n" + "\n".join(lines)def load_skill(name):# Read the content only when the model explicitly requests it,# and restrict reads to an allowlisted directorymeta = SKILL_INDEX[name]with open(meta["path"], encoding="utf-8") as f:return f.read()
Two implementation caveats. First, skill content should live in a controlled directory with path allowlisting, so the model cannot request arbitrary files. Second, skill descriptions should be treated as data rather than a trusted source of instructions—the system layer must clearly define their scope of applicability.
5. When Sub-Agents Are Actually Justified
A single main loop cannot solve everything. Splitting into sub-agents is a reasonable choice in the following scenarios.
Context isolation. Some subtasks generate large volumes of intermediate material—reading dozens of documents or processing large log batches. Keeping all of it in the main context crowds out later reasoning. Letting a sub-agent process the material in its own context and return only conclusions reduces the burden on the main flow.
True parallelism. When multiple subtasks are independent of each other, running them in parallel shortens total latency. Note that the benefit depends on how independent the subtasks are, not on how many there are.
Permission boundaries. When one step requires access to sensitive resources that other steps must not touch, delegating that step to a permission-restricted sub-agent is safer than opening up permissions across the whole main loop.
Beyond these cases, splitting just to make the architecture diagram look complete usually adds cost without real benefit.
6. Costs and Risks
The cost of splitting into sub-agents can be estimated along four dimensions.
- Handoff loss. The coordinator must compress the task description, constraints, and background into the sub-agent’s input, and key information is easily lost in compression.
- Error propagation. A sub-agent’s wrong conclusion is treated as fact by the coordinator. Without a verification step, errors amplify during aggregation.
- Invocation cost. Each sub-agent carries its own instruction and inference overhead; in most cases total consumption is significantly higher than a single main loop.
- Debugging difficulty. A problem may sit in any sub-agent or in any handoff, and troubleshooting requires reading multiple logs at once.
These costs are manageable. Limiting the number of sub-agents, designing structured formats for handoff results, and adding independent verification at critical nodes can bring the risk within an acceptable range.
7. Practical Recommendations
When adopting a single main-loop architecture, consider the following practices.
- Start with a single main loop; only split when a bottleneck is proven by actual data.
- Register skills and tools centrally, recording name, purpose, input/output format, and permission level.
- Validate parameters before tool calls; truncate and format-check results afterward.
- Generate a complete step log for each run, including model decisions, tool parameters, and result summaries.
- Set limits on steps, elapsed time, and cost; hand over to a human when limits are exceeded instead of retrying indefinitely.
- Add human confirmation for high-risk actions (deletion, sending, deployment).
8. How to Evaluate Whether the Architecture Works
Architecture choices should be compared on the same set of tasks, not judged by subjective impression. Useful metrics include:
- Task success rate: completion ratio against predefined acceptance criteria.
- Result quality: scored by human or independent reviewers under a unified standard, with typical error types recorded.
- Average steps and latency: reflects execution efficiency.
- Per-task cost: includes model invocation fees and tool invocation fees.
- Maintainability: the scope of changes required to add a skill or modify a rule.
Prepare a fixed test set for each architecture covering simple, medium, and complex difficulty levels. Only when an architecture consistently outperforms on the same test set is the added complexity justified.
9. Conclusion
Multi-agent collaboration is not the wrong direction, but it should be a tool introduced to solve specific problems, not a default configuration. For most tasks, a single main loop combined with progressive disclosure of skills and tools strikes a good balance among controlled context, traceable behavior, and extension cost. When deciding whether to split, return to three questions: Can the subtasks run independently? Can their contexts be isolated? Do permissions need to be layered? Only when the answers clearly point to splitting is the extra complexity worth paying for.
