Routing & Sessions
When a user sends a message, the orchestrator needs to decide which agent handles it. Routing rules in agent.yaml control this behaviour. Sessions track the ongoing conversation state between a user and an agent.
Routing modes
Section titled “Routing modes”Selu supports two routing modes:
Inline mode (default)
Section titled “Inline mode (default)”In inline mode, the orchestrator evaluates every incoming message against all installed agents and picks the best match. This is the default when a user has multiple agents installed.
routing: mode: inline triggers: - intent: weather_query - mention: "@weather" priority: 10The orchestrator scores each agent based on trigger matches and priority. The highest-scoring agent handles the message.
Dedicated mode
Section titled “Dedicated mode”In dedicated mode, the agent owns an entire channel or conversation thread. All messages in that context go directly to it — no routing evaluation is needed.
routing: mode: dedicatedThis is useful for single-purpose bots or when the user explicitly starts a session with a specific agent.
Triggers
Section titled “Triggers”Triggers help the orchestrator match messages to agents in inline mode.
| Trigger | Description | Example |
|---|---|---|
mention | Matches when the message contains a specific @-mention. | @weather |
intent | Matches when the orchestrator’s lightweight classifier detects a semantic intent. | weather_query |
keyword | Matches when specific keywords appear in the message. | forecast, temperature |
regex | Matches a regular expression against the message text. | \bweather\b |
Triggers are evaluated in order. The first match wins for that agent, and its priority score is used in ranking.
Priority
Section titled “Priority”When multiple agents match, priority breaks the tie. Higher values win. The default is 0.
routing: priority: 10 # higher = more likely to be selectedSessions
Section titled “Sessions”A session is a stateful conversation between a user and an agent. Sessions track:
- Message history — The rolling window of messages sent to the LLM.
- Memory context — Long-term facts stored across sessions (when enabled).
- Active capability state — If a capability uses multi-step flows, the session holds intermediate state.
Session configuration
Section titled “Session configuration”memory: session_ttl: 3600 # seconds before an idle session expires max_history: 50 # max messages retained in the context window long_term: true # persist facts to vector-backed long-term memoryFor stateless utility agents (e.g. unit converter), use a low session_ttl and disable long_term:
memory: session_ttl: 300 max_history: 10 long_term: falseFor personal assistants that should remember the user over time:
memory: session_ttl: 86400 max_history: 100 long_term: trueSession handoff
Section titled “Session handoff”When an agent delegates to another agent using delegate_to_agent, the orchestrator can either create a new session for the target agent or continue the existing one. This is controlled by the delegate_to_agent tool’s new_session parameter.
Next steps
Section titled “Next steps”Now that you understand routing, head to Build Your First Agent to put it all together.