OpenClaw Sandbox

Autonomous agent sandbox integration

OpenClaw Sandbox Integration

Overview

VIBE AI integrates with OpenClaw -- an open-source autonomous agent framework -- to run self-hosted AI agents in isolated sandboxes. Users pick a template, launch a sandbox, and interact with their agent via Telegram.

┌──────────┐     ┌──────────┐     ┌──────────────┐     ┌────────────────┐
│  User    │────▶│  VIBE    │────▶│  Daytona     │────▶│  OpenClaw      │
│ (Telegram│     │  Backend │     │  Sandbox     │     │  Agent         │
│  / Chat) │◀────│  (API)   │◀────│  (Daytona SDK│◀────│  (LLM + Tools) │
└──────────┘     └──────────┘     └──────────────┘     └────────────────┘
                        │                                       │
                        │         ┌────────────────┐           │
                        └────────▶│  VIBE Tools    │◀──────────┘
                                  │  Gateway       │   (API calls)
                                  │  (/api/vibe-   │
                                  │   tools/*)     │
                                  └────────────────┘

How It Works

1. Template Selection

Users choose from pre-built agent templates, each with a distinct personality and trading strategy:

TemplateNameStyleIcon
traderClawTraderConservative -- risk-first, 10% sizing rule, smart money trackingshield
shitcoin-traderDegenTraderAggressive -- degen plays, fast moves, meme-awarefire
degenDegenScannerAlpha-hunter -- high-frequency scanning, Nansen + social signals, no tradeszap
analystChainAnalystData-driven -- deep analysis, research reports, on-chain forensicsmicroscope

2. Sandbox Provisioning

When a user starts a gateway, VIBE's backend:

  1. Creates an isolated Daytona sandbox from a pre-baked snapshot
  2. Writes the openclaw.json config with the user's settings
  3. Injects VIBE Skills (SKILL.md files) into the workspace
  4. Injects a VIBE Tools API key so the agent can call /api/vibe-tools/* directly
  5. Overrides the LLM provider to route through VIBE's proxy (for billing)
  6. Starts the OpenClaw gateway process

3. LLM Proxy

All LLM calls from the sandbox are routed through VIBE's OpenAI-compatible proxy at /api/v1/llm/chat/completions:

  • Auth: HMAC-signed token (vibe_<account_id>_<hmac_sig>) auto-generated per account
  • Billing: Token-based cost with 1.5x markup, deducted from user credits
  • Model aliases: Short names like claude-sonnet-4.6 or gpt-4o are resolved to their OpenRouter equivalents
  • Streaming: SSE streaming with real-time token usage tracking
  • Pre-flight check: Calls are blocked when credits are exhausted (returns 402)

Supported Models

AliasResolved Model
vibe-opus-4-6anthropic/claude-opus-4-6
vibe-sonnet-4-6anthropic/claude-sonnet-4-6
vibe-gpt-4oopenai/gpt-4o
vibe-gpt-4o-miniopenai/gpt-4o-mini
claude-sonnet-4.6anthropic/claude-sonnet-4-6
gpt-4oopenai/gpt-4o

4. VIBE Tools Integration

The sandbox agent has direct access to all VIBE Tools endpoints. During gateway startup, a VIBE API key (scopes: gateway:read, gateway:data, gateway:wallet_write) is injected into the sandbox environment. The agent's SKILL.md files reference {VIBE_API_URL} and {VIBE_API_TOKEN} placeholders, which are replaced with real values at launch time.

This means OpenClaw agents can:

  • Get swap quotes and execute trades on Solana and EVM chains
  • Query data providers (Nansen, Twitter/X, Blokiments)
  • Launch tokens on bags.fm
  • Perform DeFi operations (stake, lend, provide liquidity)

5. Telegram Integration

Users interact with their running agent through Telegram. VIBE manages the bot lifecycle:

  • Bot registration: Users provide a Telegram bot token from @BotFather
  • Long-polling: OpenClaw uses grammy long-polling (not webhooks) for message delivery
  • Config: DMs are open (dmPolicy: "open"), groups use an allowlist (groupPolicy: "allowlist")
  • Streaming: Partial stream mode sends agent responses as they're generated

::: warning OpenClaw uses grammy long-polling, NOT webhooks. Do not set webhookUrl in the channel config -- setting it causes Telegram to register a webhook to the sandbox proxy URL, which returns 405 and breaks message delivery. :::

Architecture Details

Gateway API Endpoints

MethodPathAuthDescription
GET/api/openclaw/gatewayJWTCheck gateway status
POST/api/openclaw/gateway/startJWTStart gateway with template
POST/api/openclaw/gateway/stopJWTStop running gateway
GET/api/openclaw/gateway/logsJWTStream gateway logs (SSE)
GET/api/openclaw/templatesJWTList available templates
GET/api/openclaw/telegram/configJWTGet Telegram bot config
PUT/api/openclaw/telegram/configJWTSave Telegram bot config
POST/api/openclaw/telegram/webhook/{token_hash}NoneInbound Telegram message relay
POST/api/v1/llm/chat/completionsHMAC TokenOpenAI-compatible LLM proxy

Sandbox Lifecycle

1. User selects template → POST /api/openclaw/gateway/start
2. Backend creates Daytona sandbox from snapshot
3. Config files written (openclaw.json, SKILL.md files, workspace files)
4. VIBE API key + LLM proxy token injected
5. OpenClaw gateway process started inside sandbox
6. Health check validates gateway is responding on port 18789
7. User interacts via Telegram
8. User stops gateway → POST /api/openclaw/gateway/stop
9. Sandbox is cleaned up

Skills Injected into Sandbox

Each sandbox gets the following VIBE skills installed:

SkillPurpose
vibeUmbrella skill: auth, envelope, discovery, LLM proxy
vibe-tradingSwap and quote operations
vibe-walletWallet and DeFi operations
vibe-dataData provider queries (Nansen, etc.)
vibe-data-providerDirect data provider access
vibe-bagsbags.fm token launch and fee claims
vibe-defiDeFi staking, lending, liquidity
vibe-twitter38 Twitter/X API endpoints
vibe-x402x402 agent commerce payments
vibe-creditsCredit balance queries
vibe-alphaAlpha signals and market intelligence

Template Structure

Each template directory contains:

templates/openclaw/<template>/
├── openclaw.json    # Agent config (models, auth, channels)
├── IDENTITY.md      # Agent personality and role definition
├── SOUL.md          # Agent values and behavioral guidelines
├── MEMORY.md        # Agent memory initialization
├── AGENTS.md        # Agent collaboration config
├── TOOLS.md         # Available tools documentation
└── HEARTBEAT.md     # Periodic self-check instructions

Configuration

Template Config (openclaw.json)

{
  "agents": {
    "defaults": {
      "models": {
        "openrouter/z-ai/glm-5.1": { "alias": "glm-5.1" },
        "openrouter/openai/gpt-5.4-mini": { "alias": "gpt-5.4-mini" }
      },
      "model": {
        "primary": "openrouter/z-ai/glm-5.1",
        "fallbacks": ["openrouter/openai/gpt-5.4-mini"]
      }
    }
  }
}

At runtime, the VIBE backend deep-merges this with:

  • Gateway auth token
  • LLM proxy base URL and HMAC token (replacing direct OpenRouter access)
  • Telegram channel config (if provided)
  • VIBE Tools API credentials

Staging vs Production

# Production (default)
VIBE_API_URL=https://api.vibe.airforce

# Staging
VIBE_API_URL=https://api-v3.vibe.airforce

Billing

OpenClaw usage is billed through VIBE credits:

  • LLM calls: Token-based cost (prompt + completion tokens) with 1.5x markup
  • VIBE Tools calls: Standard credit pricing (see Skills & CLI)
  • Pre-flight check: LLM calls are blocked when credits are exhausted
  • Per-agent tracking: Usage is attributed to specific agents for analytics

Troubleshooting

ProblemCauseSolution
Agent says "Twitter not connected"TOOLS.md missing /api/ prefixEnsure template TOOLS.md uses /api/vibe-tools/... paths
Telegram shows "405 Method Not Allowed"webhookUrl set in channel configRemove webhookUrl; OpenClaw uses long-polling
Agent generates text but never uses toolsLLM proxy dropping tools paramEnsure proxy passes tools and tool_choice to litellm
Gateway won't startSnapshot or Daytona issueCheck backend logs for sandbox creation errors
LLM calls return 402Credits exhaustedPurchase credits or enable x402 auto top-up

Previous: Skills & CLI