Code
multiple_instances.py
Usage
1
Set up your virtual environment
2
Set Environment Variables
3
Install dependencies
4
Run Example
5
Start a Public Tunnel
In a separate terminal, start ngrok for the AgentOS port:Copy the HTTPS forwarding URL, then export it in the terminal where you will register the webhooks:
6
Register Webhooks
Register a webhook for each bot token:See Telegram setup for BotFather and production webhook-secret configuration.
Key Features
- Prefix-Based Routing: Each agent gets its own webhook path (
/basic/webhook,/web-research/webhook) - Shared Server: Both agents run on a single AgentOS instance
- Separate Bot Tokens: Each interface uses its own BotFather bot (Telegram allows only one webhook per token)
- Shared Database: Both agents share the same SQLite database