Quick Start
Simple Usage
How It Works
| Step | What Happens |
|---|---|
| Origin detection | detect_chat_type(platform, chat_id) classifies as group, direct, channel, or unknown |
| Target listing | ChannelDirectory.describe_targets() lists home channels and aliases |
| Prompt injection | A ## Session Context block is appended per turn |
| Agent responds | The agent uses context to reply here or deliver elsewhere |
Prompt injection happens after the system prompt cache boundary — the per-turn
## Session Context block is never cached.Configuration Options
BotSessionManager
| Option | Type | Default | Description |
|---|---|---|---|
channel_directory | ChannelDirectory | None | Named aliases and home channels for delivery |
inject_session_context | bool | True | When False, suppress per-turn prompt injection |
BotConfig media
| Option | Type | Default | Description |
|---|---|---|---|
max_inbound_media_bytes | int | 20971520 | Max inbound media size; set 0 to disable |
Chat-type detection
| Platform | Pattern | Type |
|---|---|---|
telegram | starts with -100 | "unknown" |
telegram | starts with - | "group" |
telegram | otherwise | "direct" |
slack | starts with C / G / D | channel / group / direct |
whatsapp | contains @g.us / @c.us | group / direct |
Common Patterns
Cross-platform delivery
Disable injection for privacy
get_session_context() — only the visible prompt block is suppressed.
Best Practices
Per-turn data is never cached
Per-turn data is never cached
The
## Session Context block is injected after the cache boundary — each turn gets fresh context without invalidating prior cache entries.Use friendly alias names
Use friendly alias names
Prefer
"team" or "ops" over raw channel IDs — the model matches user intent to alias names.Set home channels before aliases
Set home channels before aliases
set_home_channel(platform, channel_id) designates the default delivery target; agents refer to it as "<platform>:home".Disable injection for privacy-sensitive deployments
Disable injection for privacy-sensitive deployments
Set
inject_session_context=False when platform metadata should not appear in the system prompt.Related
Cross-Platform Sessions
Unified conversation history across platforms
Channels Gateway
Connect agents to Telegram, Discord, Slack, and WhatsApp
Bot Message Routing
Route messages to different agents by channel
Gateway Tool Policy
Scope the toolset per route

