Building Smarter Agents: The Power of Sub-Agents in HiCA
Orchestrate multiple specialized AI agents to handle complex, multi-step tasks with simple workflows with HICA.
Building Smarter Agents: The Power of Sub-Agents in HiCA
As AI agents tackle increasingly complex tasks, the need for structured, modular approaches becomes paramount. While the allure of "multi-agent" systems—where numerous agents collaborate in parallel—is strong, real-world implementations often reveal significant challenges. HiCA, an open-source agent library, embraces a more robust paradigm: sub-agents as specialized tools, a philosophy that aligns closely with recent discussions in the AI community.
The Multi-Agent Dilemma: Why Simpler is Often Better
The concept of multiple agents working together sounds powerful, but as highlighted by Cognition AI's insightful blog post, "Don't Build Multi-Agents", systems with unstructured, flat hierarchies can quickly become fragile. The core issues often stem from:
- Fragmented Context: When agents operate in isolation or share context inefficiently, critical information can be lost or misinterpreted, leading to suboptimal decisions.
- Lack of Traceability: Understanding why a particular decision was made or how a task was executed across multiple interacting agents can become a debugging nightmare.
- Fragility: Dispersed decision-making without a clear, shared understanding of the overall goal can lead to brittle systems that fail unexpectedly.
The Cognition AI blog emphasizes that for robust agent design, "every agent action should be informed by all relevant decisions made by other parts of the system, ideally seeing everything." This principle of comprehensive context is crucial.
HiCA's Approach: Sub-Agents as First-Class Tools

Source : Don’t Build Multi-Agents
Instead of a loosely coupled "multi-agent" free-for-all, HiCA champions a structured sub-agent workflow. We model sub-agents not as independent entities that might or might not cooperate, but as specialized tools that a main agent can explicitly invoke. This design choice directly addresses the challenges outlined above:
-
Sub-Agents as Tools within the
ToolRegistry:
In HiCA, a sub-agent is encapsulated within aToolinstance. For example, aCodeInterpreterToolor aFileSystemSubagentToolallows the main agent to delegate specific, complex tasks. This clear interface ensures that the main agent maintains control and understands the capabilities of its sub-components. -
Isolated Execution, Centralized Memory:
When the main agent calls a sub-agent tool, HiCA instantiates a new, specializedAgent(e.g., aCodeGenerationAgentorFileManipulationAgent) and, crucially, creates a new, separateThreadfor this sub-agent. This thread runs in isolation, managing its own internal state and events. However, this isolation doesn't mean a loss of context. A single, authoritativeConversationMemoryStoremanages all agent threads—both main and sub-agent. This centralized store ensures atomicity, where every agent interaction is treated as a transaction, and the state is saved consistently. -
Seamless and Flexible Context Sharing:
Here's how HiCA's design puts these principles into practice: . When a sub-agent tool is invoked, thethread_idof the newly created sub-agent is embedded directly into thetool_callevent on the main thread. This creates a "foreign key" linkage, making it straightforward to trace which sub-agent was spawned by which specific action of the main agent.Crucially, HiCA provides flexible context delegation. A developer can choose the right level of context for the job:
- Full History: Pass the entire history of the main agent's thread to the sub-agent for maximum awareness, empowering it to handle deeply contextual tasks.
- Summarized History: Use HiCA's built-in summarization feature to pass a compressed version of the history, balancing context-awareness with token economy.
- Minimal Context: For simple, isolated tasks, one can pass only a specific task description, a model used by tools like Amp [1] to prioritize context window conservation.
-
Intelligent Context Summarization for Long Conversations:
Complementing the sub-agent architecture, HiCA also includes an intelligent context summarization feature. For long-running conversations, the agent can use an LLM to create a concise summary of past events, replacing older, less relevant history with a compact overview. This is vital for managing context window limitations, ensuring that even deeply nested or extended interactions remain efficient and focused.
The Benefits: Robust, Scalable, and Transparent Agentic Workflows
By treating sub-agents as specialized tools and meticulously managing context and traceability, HiCA empowers developers to build:
- Modular Agents: Break down complex problems into manageable sub-tasks, each handled by a specialized agent.
- Robust Systems: Minimize ambiguity and fragility by ensuring sub-agents operate with full, relevant context and their actions are clearly linked to the main workflow.
- Scalable Solutions: Support multiple sub-agents and nested delegations without sacrificing clarity or performance.
- Transparent Operations: Easily trace the flow of execution and decision-making across different agent layers.
The Path Forward: From Serial Orchestration to Managed Parallelism
The current HiCA architecture provides a powerful, serial orchestration model. The clear evolutionary path, inspired by the successes of systems like Anthropic's [2], is to introduce parallelism without sacrificing this core stability. This is not a regression to the chaotic multi-agent model, but an evolution of the orchestrator-worker pattern.
- The Orchestrator Remains in Control: The lead agent will be able to dispatch multiple, independent tasks to worker sub-agents that execute in parallel, while remaining the single source of truth.
- The Synthesizer Creates Consensus: With parallel execution comes the risk of divergent results. The solution, proven by Anthropic's architecture, is to introduce a final "synthesizer" agent to receive the outputs from all parallel workers and integrate them into a single, coherent response.
This two-part enhancement—managed parallelism combined with a synthesizer—represents the next generation of agentic architecture. The HiCA library provides the foundational architecture to move beyond simple multi-agent concepts towards truly intelligent, well-orchestrated agentic workflows. Explore our documentation and examples in docs/sub_agent_management.md and examples/subagent/ to see how you can leverage sub-agents to build the next generation of AI applications.
References
[1] Amp. (2024). Agents for the Agent. https://ampcode.com/agents-for-the-agent
[2] Anthropic. (2024). How we built our multi-agent research system. https://www.anthropic.com/engineering/built-multi-agent-system