BotsBot Teams & Delegation

Bot Teams & Delegation

A single bot connected to a single workspace works for many use cases. But when your organization has distinct domains — billing, technical support, HR, legal — a team of specialist bots is more powerful. Each bot has its own workspace with domain-specific tools, its own system prompt optimized for its area, and its own LLM configuration.

The delegate_to_bot workflow node makes this possible. One bot calls another, passes context, gets a response, and continues its workflow.


Architecture

The reception bot is the user-facing entry point. It classifies intent and delegates to the right specialist. Each specialist bot has:

  • Its own MCP workspace with domain-specific tools
  • A system prompt tuned for its domain
  • Optionally, a different LLM model (e.g., cheaper model for FAQ, flagship model for complex reasoning)

How delegate_to_bot Works

The delegate_to_bot node sends the current message and optional context to another bot. The target bot processes the message using its own workspace and tools (in agent loop or workflow mode), and returns the response.

{
  "type": "delegate_to_bot",
  "data": {
    "target_bot_id": "bt_billing_specialist",
    "outputVariable": "specialist_response",
    "context": "{\"customer_id\": \"{{verified_identity}}\", \"intent\": \"{{intent.text}}\"}",
    "label": "Route to Billing Bot"
  }
}
FieldDescription
target_bot_idThe bot ID to delegate to
outputVariableVariable to store the delegated bot’s response
contextOptional JSON context passed to the target bot (available as variables)

After delegation, {{specialist_response}} contains the target bot’s text response. The calling workflow can use it directly, process it further, or combine it with other data before responding to the user.


Delegation Limits

LimitValue
Maximum delegation hops3
Timeout per delegationInherits the calling bot’s timeout_ms

A delegation hop is counted each time a bot calls another bot. Bot A calls Bot B (1 hop). Bot B calls Bot C (2 hops). Bot C calls Bot D (3 hops). If Bot D tries to call another bot, the call is rejected.

⚠️

Delegation hops are tracked across the entire chain. If Bot A delegates to Bot B, which delegates to Bot C, that counts as 2 hops from Bot A’s perspective. Design your architecture to stay within the 3-hop limit.


Use Cases

Support Routing

A reception bot in Slack classifies every incoming message and routes to the appropriate specialist:

  • Billing questions go to a billing bot with Stripe, QuickBooks, and invoice MCPs
  • Technical issues go to a tech support bot with Jira, documentation, and monitoring MCPs
  • HR requests go to an HR bot with PTO tracking, benefits, and payroll MCPs
  • General questions are handled directly by the reception bot using a knowledge base MCP

Each specialist has a system prompt that makes it an expert in its domain. The billing bot knows your pricing tiers, refund policies, and invoice formats. The tech bot knows your architecture, common issues, and escalation paths.

Tiered Support

Level 1 bot handles common questions. When it cannot resolve an issue, it delegates to a Level 2 bot with more powerful (and expensive) tools and a more capable LLM model. Level 2 can further escalate to a Level 3 bot or trigger a human_handoff.

Multi-Department Workflows

An employee onboarding bot orchestrates across departments:

  1. Delegates to IT bot to provision laptop and accounts for the new employee
  2. Delegates to HR bot to schedule orientation
  3. Delegates to facilities bot to assign a desk
  4. Collects all responses and sends a summary

Incident Response

A monitoring bot receives alerts and delegates to an on-call bot that has access to PagerDuty, Datadog, and deployment MCPs. The on-call bot creates incidents, gathers diagnostics, and reports back. P1 incidents additionally trigger human_handoff to the engineering manager.


Building a Bot Team

Step 1: Plan the Architecture

Map out which domains need specialist bots and what tools each needs.

BotDomainWorkspace ToolsLLM
ReceptionIntent classification, general Q&AKnowledge base MCPClaude Haiku (fast, cheap)
BillingPayments, invoices, refundsStripe MCP, Accounting MCPClaude Sonnet (capable)
Tech SupportIssues, docs, monitoringJira MCP, Docs MCP, Datadog MCPGPT-4o (strong at technical)
HRPTO, benefits, onboardingHR System MCP, Calendar MCPClaude Sonnet

Step 2: Create Specialist Bots

Create each specialist bot with its own workspace and tools. These bots do not need to be activated on a messaging platform — they are called internally by the reception bot. Use the custom platform type.

Step 3: Build the Reception Workflow

The reception bot uses a workflow that classifies intent and delegates:

{
  "nodes": [
    {
      "id": "trigger",
      "type": "trigger",
      "data": { "triggerType": "message_received", "label": "On Message" }
    },
    {
      "id": "classify",
      "type": "llm_call",
      "data": {
        "prompt": "Classify this message into one category: billing, tech_support, hr, general.\n\nMessage: {{message}}\n\nRespond with only the category.",
        "outputVariable": "intent",
        "label": "Classify"
      }
    },
    {
      "id": "route",
      "type": "logic",
      "data": {
        "logicType": "switch",
        "variable": "intent.text",
        "cases": ["billing", "tech_support", "hr"],
        "label": "Route"
      }
    },
    {
      "id": "billing_delegate",
      "type": "delegate_to_bot",
      "data": {
        "target_bot_id": "bt_billing_bot",
        "outputVariable": "response",
        "label": "Billing Bot"
      }
    },
    {
      "id": "tech_delegate",
      "type": "delegate_to_bot",
      "data": {
        "target_bot_id": "bt_tech_bot",
        "outputVariable": "response",
        "label": "Tech Bot"
      }
    },
    {
      "id": "hr_delegate",
      "type": "delegate_to_bot",
      "data": {
        "target_bot_id": "bt_hr_bot",
        "outputVariable": "response",
        "label": "HR Bot"
      }
    },
    {
      "id": "general",
      "type": "llm_call",
      "data": {
        "prompt": "Answer this general question helpfully:\n{{message}}",
        "outputVariable": "response",
        "label": "General Response"
      }
    },
    {
      "id": "send",
      "type": "send_message",
      "data": {
        "message": "{{response.text}}",
        "label": "Send Response"
      }
    }
  ],
  "edges": [
    { "id": "e1", "source": "trigger", "target": "classify" },
    { "id": "e2", "source": "classify", "target": "route" },
    { "id": "e3", "source": "route", "target": "billing_delegate", "sourceHandle": "case_billing" },
    { "id": "e4", "source": "route", "target": "tech_delegate", "sourceHandle": "case_tech_support" },
    { "id": "e5", "source": "route", "target": "hr_delegate", "sourceHandle": "case_hr" },
    { "id": "e6", "source": "route", "target": "general", "sourceHandle": "case_default" },
    { "id": "e7", "source": "billing_delegate", "target": "send" },
    { "id": "e8", "source": "tech_delegate", "target": "send" },
    { "id": "e9", "source": "hr_delegate", "target": "send" },
    { "id": "e10", "source": "general", "target": "send" }
  ]
}

Step 4: Activate Only the Reception Bot

Only the reception bot needs to be connected to a messaging platform (Telegram, Slack, etc.). Specialist bots are internal — they process delegated requests and return responses without being directly accessible to users.


Best Practices

  1. Use cheap, fast models for classification. The reception bot’s job is to classify and route. Claude Haiku or GPT-4o Mini is sufficient. Save the expensive models for specialist bots that need deep reasoning.

  2. Pass context explicitly. Use the context field in delegate_to_bot to pass verified identity, intent, and any relevant data. Do not rely on the target bot to re-extract information from the message.

  3. Keep delegation shallow. Most architectures need at most 2 hops (reception to specialist). If you find yourself needing 3 hops, consider flattening the architecture.

  4. Test each specialist independently. Use the test endpoint on each specialist bot before wiring them into the reception workflow. Each bot should work correctly on its own.

  5. Monitor costs per bot. Each bot has its own analytics. Track which specialists are the most expensive and optimize their model or tool configuration.


Next Steps