03: Routing + concurrency (sessionKey/lanes/queue)
03: Routing + concurrency (sessionKey/lanes/queue)
Between “an inbound message arrives” and “an agent run starts”, the critical step is stable session routing and concurrency control.
You should be able to explain three properties:
- No cross-talk: groups/multi-account/multi-channel don’t leak context into each other
- Stable ordering: messages within the same session don’t reorder
- Safe parallelism: different sessions can run concurrently (with global limits)
sessionKey: the isolation primitive
sessionKey decides what belongs to the same session. It typically incorporates:
- channel type (DM/group/channel)
- account/device/connection instance
- thread/reply-chain context (when available)
See:
lanes/queue: serial per session, parallel across sessions
Once a sessionKey is chosen:
- same
sessionKey: serial execution (avoid concurrent session writes) - different
sessionKey: parallel execution (bounded by global limits)
See:
Troubleshooting “cross-talk” or reordering
Debug from outside in:
- verify routing/sessionKey choice
- verify queue/lane settings (no unintended session collapsing)
- return to logs/Control UI and follow one
runIdend-to-end
See: