Single Agent Setup
Deploy one purpose-built AI agent that responds to Telegram messages, hibernates when idle, and wakes on demand.
What you’ll build
A single agent that:
- Receives messages via Telegram webhook
- Processes them with an AI provider (Anthropic, OpenAI, etc.)
- Responds via the Telegram Bot API
- Hibernates when idle — costs nothing while sleeping
- Wakes automatically when the next message arrives
Prerequisites
- A LobsterCage account (sign up free )
- The
lobsterCLI:npm install -g lobstercage-cli - An AI provider API key (Anthropic, OpenAI, etc.)
- A Telegram bot token (from @BotFather )
Step 1: Create a cage
lobster create my-agentThis creates a Starter-sized cage (1 vCPU, 4 GB RAM) and starts it.
For heavier workloads, choose a larger size:
lobster create my-agent --size standard # 2 vCPU, 8 GB RAM
lobster create my-agent --size power # 4 vCPU, 16 GB RAMStep 2: SSH in and configure OpenClaw
OpenClaw is pre-installed in every cage. SSH in and run the interactive setup:
lobster ssh my-agent
openclaw configureThe openclaw configure wizard walks you through:
- Choosing your AI provider and entering your API key
- Entering your Telegram bot token
- Registering the webhook URL with Telegram
Follow the prompts — OpenClaw handles the configuration for you.
Step 3: Get your webhook URL
In a separate terminal, get the cage’s webhook URL:
lobster status my-agentThe output includes a Webhook URL like:
https://gateway.lobstercage.ai/hook/cage_abc123/tok_xyz789/For Telegram, OpenClaw can register this automatically during openclaw configure. You can also register it manually:
curl -X POST "https://api.telegram.org/bot${BOT_TOKEN}/setWebhook" \
-d '{"url": "YOUR_WEBHOOK_URL"}'See the Telegram webhook guide for more details.
Step 4: Test the full lifecycle
- Send a message to your bot on Telegram
- Watch it respond — the AI processes your message and replies
- Wait 30 minutes (or adjust the idle timeout) — the cage hibernates automatically
- Send another message — the gateway buffers it, wakes the cage, delivers it
- Check your billing — you only paid for the minutes the cage was active
# Monitor the lifecycle in real time
lobster tail my-agent
# Check status
lobster status my-agentHow the lifecycle works
- User sends a message → Telegram delivers it to your webhook URL
- Cage is hibernated? → Gateway proxy buffers the request (encrypted) and triggers a wake
- Cage boots (~10-30 seconds) → OpenClaw auto-starts, buffered messages are delivered
- Agent responds → AI processes the message and sends a reply via Telegram
- No activity for 30 minutes → Cage auto-hibernates, billing stops
- Next message arrives → Cycle repeats from step 2
OpenClaw auto-starts on every wake — once you’ve run openclaw configure, you never need to start it manually again. The cage manager detects your config and launches OpenClaw automatically.
Your agent is always reachable but you only pay for active compute time. A typical agent handling a few conversations per day costs just a few dollars per month.
Programmatic setup (for automation)
If you’re creating agents programmatically (e.g., from an orchestrator), you can skip the interactive wizard. Deploy with the openclaw-chatbot template and set env vars:
lobster create my-agent --template openclaw-chatbot
lobster env set my-agent ANTHROPIC_API_KEY=sk-ant-...
lobster env set my-agent TELEGRAM_BOT_TOKEN=123456:ABC...The openclaw-chatbot template tells the cage manager to auto-detect the Telegram bot token from env vars and generate the OpenClaw config at boot. See the orchestrator pattern for the full programmatic workflow.
What’s next
- Add cron jobs for scheduled tasks — LobsterCage auto-wakes your cage before scheduled runs. See cron scheduling.
- Deploy a second agent — each with its own domain and personality. See multi-agent setup.
- Build an orchestrator — automate agent creation and task delegation. See the orchestrator pattern.
Tips
- Workspace persistence: Everything in
/workspaceand/home/agentsurvives hibernation. Install packages once. - Budget controls: Set spending limits in the dashboard to prevent runaway costs.
- SSH debugging: Use
lobster ssh my-agentanytime to inspect, debug, or update your agent live. - Live logs:
lobster tail my-agentstreams events in real time.