Skip to Content
GuidesOpenClaw Agent

Running OpenClaw in a Cage

This guide walks through deploying an OpenClaw  AI agent inside a LobsterCage — from cage creation to a fully autonomous agent that hibernates when idle and wakes on demand.

Prerequisites

  • A LobsterCage account (sign up )
  • The lobster CLI installed (npm install -g lobstercage-cli)
  • An AI provider API key (e.g., Anthropic, OpenAI)
  • A Telegram bot token (from @BotFather )

1. Create and start a cage

lobster create my-agent

This creates a Starter-sized cage (1 vCPU, 4 GB RAM) and starts it. For heavier workloads:

lobster create my-agent --size standard # 2 vCPU, 8 GB lobster create my-agent --size power # 4 vCPU, 16 GB

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 configure

The openclaw configure wizard walks you through everything:

  • 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.

3. Register the webhook URL

Get your cage’s webhook URL:

lobster status my-agent

The output includes a Webhook URL like:

https://gateway.lobstercage.ai/hook/cage_abc123/tok_xyz/

For Telegram, OpenClaw can register the webhook for you automatically during configure. You can also register it manually — see the Telegram webhook guide.

4. Test it

Send a message to your bot on Telegram. You should get a response from your AI agent within a few seconds.

Auto-start on wake

Once you’ve run openclaw configure, OpenClaw auto-starts on every wake from hibernation. The cage manager detects your OpenClaw config file and launches OpenClaw automatically — no startup scripts needed.

How the lifecycle works

Once everything is configured:

  1. User sends a message → Telegram delivers it to your webhook URL
  2. Cage is hibernated? → Gateway proxy buffers the request and wakes the cage
  3. Cage boots (~10-30 seconds) → OpenClaw auto-starts, buffered messages are delivered
  4. Agent responds → AI processes the message, sends a reply
  5. No activity for 30 minutes → Cage auto-hibernates, billing stops

Your agent is always reachable but you only pay for active compute time. A typical agent that handles 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:

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 channel tokens from env vars and generate the OpenClaw config at boot. All secrets are encrypted at rest with AES-256.

Adding cron jobs

OpenClaw supports scheduled tasks. Configure them in your OpenClaw config to run periodic jobs:

lobster ssh my-agent openclaw cron list

LobsterCage automatically wakes your cage 5 minutes before a scheduled cron job, runs it, then hibernates when idle.

Monitoring

# Watch real-time lifecycle events lobster tail my-agent # Check status lobster status my-agent

Tips

  • Workspace persistence: Everything in /workspace and /home/agent survives hibernation. Configure once.
  • Multiple agents: Run multiple OpenClaw instances in separate cages, each with their own bot and personality. See deployment patterns.
  • Budget controls: Set spending limits in the dashboard to prevent runaway costs.
  • SSH debugging: Use lobster ssh my-agent anytime to inspect, debug, or update your agent live.
Last updated on