Pi 24/7 Telegram Agent on Render
Running Pi coding agent as a background service with Telegram interface.
Architecture
Render Free Tier (ephemeral)
├── Pi (headless RPC mode, --no-session)
│ └── pi-telegram-connect extension
├── Telegram Bot (via extension)
└── No persistent storage
Note: Render free tier has no persistent storage. Sessions reset on restart. This is fine for a 24/7 agent - it keeps general context in the system prompt, not session history.
Prerequisites
- Render Account - https://render.com
- Telegram Bot Token - From @BotFather
- Pi API Key - From your LLM provider (Anthropic/OpenAI)
- GitHub Repo - To deploy from
Quick Deploy
1. Fork/Clone This Repo
git clone https://github.com/yourusername/pi-telegram-247.git
cd pi-telegram-247
2. Set Environment Variables in Render
| Variable | Description |
|---|---|
TELEGRAM_BOT_TOKEN |
Bot token from @BotFather |
ANTHROPIC_API_KEY |
Or OPENAI_API_KEY |
PI_PROVIDER |
anthropic or openai |
PI_MODEL |
e.g., claude-sonnet-4-20250514 |
3. Deploy to Render
- Connect GitHub repo
- Select Background Worker type
- Use
render.yamlfor auto-config - Deploy
Local Development
# Install dependencies
./scripts/setup.sh
# Configure
cp .env.example .env
# Edit .env with your keys
# Run
./scripts/run.sh
How It Works
Pi runs in RPC mode (headless) with the pi-telegram-connect extension:
- Pi starts with
pi --mode rpc - Extension connects to Telegram via long polling
- Messages flow: Telegram → Extension → Pi → Response → Telegram
- Session persists in
/data/pi-sessions/
Telegram Commands
/start- Show help/new- New session/stop- Abort current turn/status- Show bot status
SCRAPER TODO
- Channel scraper using Telethon
- AI-ready JSON output
- Resume capability
- Media download support
References
Xet Storage Details
- Size:
- 2.26 kB
- Xet hash:
- 9dd24cb74a2dd2a6e5d129ebc5959e19ad3bb57b217c243e2a8c59000791a953
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.