加入我们的 Telegram 社群 (clawdbotCN) 学习分享和了解更多 →
en
Core Concepts
Multi-Agent Routing

Multi-Agent Routing

Clawdbot supports running multiple independent AI agents, each with their own workspace, sessions, and configuration.

What is an Agent?

An Agent is a completely isolated AI persona with:

  • Independent workspace (files, personality rules)
  • Independent state directory (agentDir)
  • Independent session storage
  • Independent authentication configuration

Core Concepts

Agent Isolation

Each agent reads from its own configuration:

~/.clawdbot/agents/<agentId>/
├── sessions/           # Session storage
├── auth-profiles.json  # Auth configuration
└── workspace/          # Workspace

Important: Credentials are never automatically shared between agents.

Routing Mechanism

Messages are deterministically routed via bindings that match on:

  1. Peer ID (most specific)
  2. Guild/Team ID
  3. Account ID
  4. Channel-level match
  5. Default agent fallback

Configuring Multiple Agents

Adding an Agent

Use the wizard to add a new agent:

clawdbot agents add work

Configuration File

{
  agents: {
    // Default agent
    default: {
      workspace: "~/clawd",
      sandbox: "host"
    },
 
    // Work agent
    work: {
      workspace: "~/clawd-work",
      sandbox: "docker",
      tools: {
        restricted: ["browser", "shell"]
      }
    },
 
    // Personal agent
    personal: {
      workspace: "~/clawd-personal",
      sandbox: "host"
    }
  }
}

Binding Rules

Configure which channels/accounts map to which agent:

{
  bindings: [
    // Route Telegram messages to work agent
    {
      match: { channel: "telegram" },
      agent: "work"
    },
 
    // Route specific WhatsApp number to personal agent
    {
      match: {
        channel: "whatsapp",
        peer: "+15551234567"
      },
      agent: "personal"
    },
 
    // Discord specific server
    {
      match: {
        channel: "discord",
        guild: "123456789"
      },
      agent: "work"
    }
  ]
}

Agent Settings

Workspace

Each agent can have an independent workspace:

{
  agents: {
    work: {
      workspace: "~/work-projects",
      // Only allow access to work directory
      workspacePolicy: "strict"
    }
  }
}

Sandbox Mode

Control agent isolation level:

{
  agents: {
    untrusted: {
      sandbox: "docker",
      // Docker sandbox configuration
      sandboxConfig: {
        image: "clawdbot/sandbox:latest",
        memory: "2g",
        cpus: 2
      }
    }
  }
}

Tool Restrictions

Limit which tools an agent can use:

{
  agents: {
    limited: {
      tools: {
        // Disable certain tools
        disabled: ["shell", "browser"],
        // Or only allow certain tools
        allowed: ["search", "calculator"]
      }
    }
  }
}

Command Reference

# List all agents
clawdbot agents list
 
# Add new agent
clawdbot agents add <name>
 
# Remove agent
clawdbot agents remove <name>
 
# Switch default agent
clawdbot agents default <name>

Use Cases

Work/Personal Separation

{
  bindings: [
    { match: { channel: "slack" }, agent: "work" },
    { match: { channel: "whatsapp" }, agent: "personal" }
  ]
}

Multi-language Support

{
  agents: {
    chinese: {
      personality: "用中文回复"
    },
    english: {
      personality: "Reply in English"
    }
  }
}

Security Levels

{
  agents: {
    admin: {
      sandbox: "host",
      tools: { allowed: ["*"] }
    },
    public: {
      sandbox: "docker",
      tools: { disabled: ["shell", "browser"] }
    }
  }
}

Next Steps