Quick Start
Enable per_chat scope in your gateway config
How It Works
The session key inper_chat mode is:
per_user vs per_chat
Direct messages always use
per_user scope, even when session_scope: per_chat is configured. Private conversations are never merged into a shared group transcript.Configuration
Set these options undersession: in your channel config:
| Option | Type | Default | Description |
|---|---|---|---|
session_scope | str | "per_user" | "per_user" for isolated sessions (default) or "per_chat" for shared group sessions |
attribution | str | "[{sender}] " | Template prefixed to each turn in per_chat scope. Supports {sender} and {time} |
max_history | int | 100 | Maximum number of turns to keep in session history |
session_scope: per_user, per_chat. Any other value raises a validation error.
/new in Groups
The/new command clears the shared session for the whole group — not just the sender.
All seven supported adapters (telegram, slack, discord, whatsapp, email, linear, agentmail) thread chat_id through their reset handlers. A /new from inside a DM clears only that user’s private session, not any group session.
Best Practices
When to enable per_chat
When to enable per_chat
Use
per_chat when your group needs one coherent conversation thread — for example, a team planning bot, a group Q&A assistant, or a shared research helper. Keep per_user (the default) when each user needs their own private context, like a personal productivity or support bot added to a group.Choose an attribution template
Choose an attribution template
The default Set
"[{sender}] " is clear and compact. Add {time} when timing context helps the agent reason about sequences of events:attribution: "" to disable attribution entirely — the agent sees messages without sender prefixes.Avoid key collisions across accounts
Avoid key collisions across accounts
The key includes
account to namespace different bot accounts on the same platform. If you run two gateway bots on the same Telegram group with different tokens, each bot maintains its own independent shared session. No additional config is needed — this is automatic.Watch the history budget in busy groups
Watch the history budget in busy groups
A
per_chat session accumulates turns from all participants. In active groups this fills max_history faster than a one-on-one conversation. Lower max_history or enable compaction to summarise older turns:Related
Bot Gateway
Set up the gateway to connect agents to messaging platforms
Multi-Channel Bots
Run one agent across telegram, slack, discord, and more

