Quick Start
- Single Bot
- Multi-Platform
- YAML Config
How It Works
Architecture
Design principles
Design principles
- Protocol-driven:
BotOSProtocollives in the lightweight core SDK; heavy implementations live in the wrapper - Lazy loading: Platform libraries (telegram, discord, etc.) are only imported when
start()is called - Agent-centric: Every bot is powered by an Agent, AgentTeam, or AgentFlow
- Extensible: Register custom platforms at runtime with
register_platform()
Token Setup
Tokens are resolved automatically from environment variables. Set them once, use everywhere.| Platform | Environment Variable |
|---|---|
| Telegram | TELEGRAM_BOT_TOKEN |
| Discord | DISCORD_BOT_TOKEN |
| Slack | SLACK_BOT_TOKEN + SLACK_APP_TOKEN |
WHATSAPP_ACCESS_TOKEN + WHATSAPP_PHONE_NUMBER_ID |
Usage Examples
Single Agent on Telegram
AgentTeam on Discord
AgentFlow on Multiple Platforms
YAML Configuration
Create abotos.yaml file:
Environment variables in
${VAR_NAME} format are automatically resolved.Extending Platforms
Add your own messaging platform in 3 steps:Adapter contract
Adapter contract
Your custom adapter class must implement:
| Method | Required | Description |
|---|---|---|
__init__(**kwargs) | Yes | Accept token, agent, and platform-specific params |
async start() | Yes | Start the bot (connect, listen for messages) |
async stop() | Yes | Gracefully stop the bot |
async send_message(channel_id, content) | Optional | Send a message programmatically |
on_message(handler) | Optional | Register a message handler |
on_command(command) | Optional | Register a command handler |
is_running (property) | Optional | Whether the bot is currently running |
Managing Bots
API Reference
Bot class
Bot class
Platform name:
"telegram", "discord", "slack", "whatsapp", or any registered custom platform.The AI agent that powers the bot.
Explicit token. Falls back to
{PLATFORM}_BOT_TOKEN env var.**kwargs
Platform-specific parameters (e.g.,
app_token for Slack, mode for WhatsApp).bot.run()— Start the bot (sync, blocks)await bot.start()— Start the bot (async)await bot.stop()— Stop the botawait bot.send_message(channel_id, content)— Send a message
BotOS class
BotOS class
Pre-built Bot instances to orchestrate.
Shared agent — used with
platforms to auto-create Bots.Platform names — auto-creates a Bot per platform using
agent.botos.run()— Start all bots (sync, blocks)await botos.start()— Start all bots (async)await botos.stop()— Stop all botsbotos.add_bot(bot)— Register a botbotos.remove_bot("platform")— Remove a botbotos.list_bots()— List platform namesbotos.get_bot("platform")— Get a bot by platformBotOS.from_config("path.yaml")— Load from YAML
Platform Registry
Platform Registry

