Inference Logoinference.sh

Sub-Agents

Agents can delegate to other agents. Sub-agents are just another type of tool.


Why Sub-Agents?

Complex tasks benefit from specialization:

code
1Main Agent2 Research Agent (gathers information)3 Writing Agent (creates content)4 Editor Agent (reviews and polishes)

Each focuses on what it does best.


How to Add a Sub-Agent

Sub-agents are added through the unified Tools tab:

  1. Open your agent's settings
  2. Go to the Tools tab
  3. Click Add ToolAgent Tool
  4. Select another agent

The main agent can now delegate to it.


How Delegation Works

code
1You: Write a blog post about AI trends2 3Main Agent: I'll delegate this.4            [Calling research-agent: "Find AI trends 2024"]5            [Calling writing-agent: "Write post about these trends"]6            [Calling editor-agent: "Review and polish"]7            8            Here's your blog post!

Each sub-agent:

  1. Receives the task from the parent
  2. Works independently using its own tools
  3. Returns results via the finish tool

Sub-Agent Results

When a sub-agent completes, it calls finish with:

  • status: succeeded, failed, or cancelled
  • result: the output to send back

The parent agent receives this and continues.


Nested Agents

Sub-agents can have their own sub-agents:

code
1Orchestrator2 Project Manager3     Developer Agent4        Code Review Agent5     Designer Agent

Keep nesting shallow for clarity.


When to Use Sub-Agents

  • Complex workflows with distinct phases
  • Specialized expertise for different tasks
  • Reusable components across multiple agents

When NOT to Use Sub-Agents

  • Simple tasks a single agent can handle
  • When an app tool would suffice
  • Over-engineering for its own sake

Start without sub-agents. Add them when you need specialization.


Next

Chatting with Agents

we use cookies

we use cookies to ensure you get the best experience on our website. for more information on how we use cookies, please see our cookie policy.

by clicking "accept", you agree to our use of cookies.
learn more.