Skip to main content

What is the Orchestrator?

The orchestrator is the routing layer that decides which agent should handle incoming messages. It sits between channels and agents, analyzing messages and dispatching them to the appropriate destination. In Kubernetes terms, the orchestrator is like an Ingress controller—it routes traffic to the right service based on rules.

Architecture

Routing Modes

Disabled (Default)

All messages go to the default agent:

Rules-Based

Route messages based on regex patterns:

AI-Based

Let the LLM decide which agent to use:
The orchestrator sends a prompt like:

Hybrid

Combine rules and AI for best results:

Manual Routing

Users can override routing with explicit mentions:

Configuration

Namespace-Level Orchestration

In distributed mode, orchestration is configured per-namespace:

Agent Bindings

Agents are bound to namespaces with triggers:

Routing Flow

1

Message Received

A message arrives through a channel (Slack, CLI, API).
2

Manual Check

Check for @agent syntax. If present, route directly.
3

Rules Check

If mode is rules or hybrid, check regex patterns.
4

AI Routing

If mode is ai or hybrid (and no rule matched), ask LLM.
5

Default Fallback

If nothing matches, use the default agent.
6

Dispatch

Create a proxy channel and dispatch to the selected agent.

Proxy Channels

The orchestrator creates isolated channels for each message:

Multi-Agent Responses

When routing to @all, responses are aggregated:

Conversation Context

The orchestrator maintains routing context per conversation:

Sticky Routing

Enable sticky routing to maintain agent affinity:

Monitoring Routing

View Routing Decisions

Output:

Routing Metrics

Best Practices

Rules-based routing is instant. Use it for common patterns to avoid AI latency.
Hybrid mode gives you the best of both worlds—fast rules and smart fallback.
Agent names should clearly indicate their purpose for accurate AI routing.
Test your rules with various message patterns to ensure correct routing.

Orchestrator vs Direct Chat

Use direct chat (klaw chat) for single-agent scenarios. Use orchestrator for multi-agent deployments (Slack, distributed mode).

Next Steps

Memory

Learn about persistent context

Multi-Agent Workflows

Build complex multi-agent systems