Skip to main content
When you run multiple agents, Comis needs to decide which one should respond to each message. Routing rules let you assign agents based on the chat platform, channel, or even specific users.

How routing works

When a message arrives, Comis checks your routing rules from most specific to least specific. The first matching rule wins. If nothing matches, the default agent handles it. Each rule is called a binding. A binding says: “When a message matches these conditions, send it to this agent.” You can match on any combination of platform type, channel, server, or user.

Specificity

More specific rules always win over general ones. Comis assigns a weight to each type of match condition, and rules with higher total weight take priority:
Match conditionWeightExample
Specific userHighest”Messages from user 12345 go to the VIP agent”
Specific channelHigh”Messages in #support go to the support agent”
Server or guildMedium”All messages in the Marketing server go to the marketing agent”
Platform typeLow”All Telegram messages go to the Telegram agent”
When two rules have the same total weight, the one listed first in your configuration wins. This means the order of your bindings matters for equal-specificity rules. For example, a binding that matches a specific user on a specific channel (weight: highest + high) always beats a binding that just matches a platform type (weight: low), regardless of order.

Configuration

OptionTypeDefaultWhat it does
routing.defaultAgentIdstring"default"Which agent handles messages that do not match any binding
routing.bindings[].channelTypestringMatch by platform (telegram, discord, slack, whatsapp, signal, imessage, irc, line)
routing.bindings[].channelIdstringMatch by specific channel identifier
routing.bindings[].peerIdstringMatch by specific user identifier
routing.bindings[].guildIdstringMatch by server or guild identifier
routing.bindings[].agentIdstring(required)Which agent to assign when this binding matches
~/.comis/config.yaml
routing:
  defaultAgentId: default
  bindings:
    # All Telegram messages go to the personal agent
    - channelType: telegram
      agentId: personal

    # Messages in a specific Discord channel go to the support agent
    - channelType: discord
      channelId: "1234567890"
      agentId: support

    # Messages from a specific user always go to the VIP agent
    - peerId: "user-9876"
      agentId: vip
In this example, a message from user-9876 in any channel will always go to the VIP agent (highest specificity). A message in Discord channel 1234567890 from anyone else goes to the support agent. Any other Telegram message goes to the personal agent. Everything else goes to the default agent.
You do not need routing rules if you only run one agent. The default agent handles everything automatically.

Multiple agents setup

To use routing, you first need to define multiple agents in your configuration. Each agent gets its own identity, model, and settings:
~/.comis/config.yaml
agents:
  default:
    name: Atlas
    model: claude-sonnet-4-5-20250929
    provider: anthropic

  support:
    name: Helper
    model: gpt-4o
    provider: openai
    workspacePath: ~/.comis/workspaces/support

  personal:
    name: Buddy
    model: claude-sonnet-4-5-20250929
    provider: anthropic
    workspacePath: ~/.comis/workspaces/personal

routing:
  defaultAgentId: default
  bindings:
    - channelType: telegram
      agentId: personal
    - channelType: discord
      channelId: "1234567890"
      agentId: support
Each agent can have its own workspace folder with separate identity files, giving it a unique personality and set of instructions.

Worked example: support agent on Slack, scheduler agent on Discord

Say you want two distinct agents:
  • Helper answers customer questions in your Slack #support channel
  • Pip manages reminders and recurring jobs in your team Discord
Here is the complete configuration:
~/.comis/config.yaml
agents:
  default:
    name: Atlas
    model: claude-sonnet-4-5-20250929
    provider: anthropic

  helper:
    name: Helper
    model: claude-sonnet-4-5-20250929
    provider: anthropic
    workspacePath: ~/.comis/workspaces/helper

  pip:
    name: Pip
    model: claude-sonnet-4-5-20250929
    provider: anthropic
    workspacePath: ~/.comis/workspaces/pip

routing:
  defaultAgentId: default
  bindings:
    # Every Slack message goes to Helper
    - channelType: slack
      agentId: helper

    # Every Discord message goes to Pip
    - channelType: discord
      agentId: pip
When a user posts in Slack #support, the router scores the message: channelType=slack matches the first binding (weight 1) → routed to helper. A Discord message matches the second binding instead → routed to pip. A message from a channel with no matching binding (say, the web dashboard) falls through to default. Each agent has its own workspace at ~/.comis/workspaces/helper and ~/.comis/workspaces/pip, so their personalities and operating instructions stay independent.

Identity

The workspace files that shape each agent’s personality.

Slash Commands

Commands you can type to control your agent.