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: 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

~/.comis/config.yaml
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
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
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.