Skip to content

๐Ÿ’ก Idea: Clawdspace - Self-hosted sandboxed execution environmentsย #651

Closed

Description

@adam91holt

Summary

A native Clawdbot feature for spinning up isolated, persistent Linux execution environments โ€” like Sprites but self-hosted.

The Problem

When agents need to run untrusted code, execute long-running tasks, or have persistent workspaces, they currently have limited options:

  • Run directly on the host (risky)
  • Manually SSH into servers (clunky)
  • Use external services like Sprites (cost, dependency)

The Vision

# From anywhere - CLI, Clawdbot, CI
clawdspace create dev
clawdspace exec dev "npm install && npm test"
clawdspace stop dev      # Pause (no CPU cost)
clawdspace start dev     # Resume instantly
clawdspace destroy dev

Or as a native Clawdbot tool:

clawdspace:
  action: exec
  space: agent-workspace
  command: "python3 analyze.py"

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                       CLIENTS                            โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”             โ”‚
โ”‚  โ”‚clawdspace โ”‚ โ”‚ Clawdbot  โ”‚ โ”‚  Web UI   โ”‚             โ”‚
โ”‚  โ”‚    CLI    โ”‚ โ”‚  (native) โ”‚ โ”‚ (future)  โ”‚             โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜             โ”‚
โ”‚        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                    โ”‚
โ”‚                      โ”‚ HTTPS/WSS                        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              HOST SERVER (Oracle, VPS, etc)               โ”‚
โ”‚                                                           โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚              Clawdspace API Server                   โ”‚ โ”‚
โ”‚  โ”‚  โ€ข REST + WebSocket exec streaming                   โ”‚ โ”‚
โ”‚  โ”‚  โ€ข API key or Tailscale identity auth               โ”‚ โ”‚
โ”‚  โ”‚  โ€ข Auto-sleep after idle timeout                     โ”‚ โ”‚
โ”‚  โ”‚  โ€ข File upload/download                              โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚                         โ”‚ Docker API                      โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”            โ”‚
โ”‚  โ”‚Space 1 โ”‚ โ”‚Space 2 โ”‚ โ”‚Space 3 โ”‚ โ”‚Space N โ”‚            โ”‚
โ”‚  โ”‚(paused)โ”‚ โ”‚(runningโ”‚ โ”‚(runningโ”‚ โ”‚(paused)โ”‚            โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Proposed API

Endpoint Description
POST /spaces Create space
GET /spaces List all
GET /spaces/:name Get details
DELETE /spaces/:name Destroy
POST /spaces/:name/exec Execute (WebSocket for streaming)
POST /spaces/:name/stop Pause container
POST /spaces/:name/start Resume container
PUT /spaces/:name/files/* Upload file
GET /spaces/:name/files/* Download file
POST /spaces/:name/checkpoint Snapshot (future, needs CRIU)
POST /spaces/:name/restore Restore snapshot

Key Features

1. Isolation

Each space is a Docker container with:

  • Separate filesystem
  • Resource limits (CPU, RAM)
  • Network isolation (optional)
  • Non-root user by default

2. Persistence

  • Files persist between exec calls
  • Spaces survive server restarts
  • Optional persistent volumes

3. Auto-Sleep

Every 60 seconds:
  For each running space:
    If last_activity > 10 minutes:
      docker pause $container
      status = "sleeping"
      
On exec request:
  If sleeping: unpause first (~100ms)
  Run command
  Update last_activity

4. Clawdbot Integration

  • Native tool for agents
  • Each agent could have its own persistent space
  • Code execution happens in isolation by default
  • No manual setup required

Use Cases

  1. Safe code execution โ€” Run LLM-generated code without risking the host
  2. Per-user workspaces โ€” Each user/agent gets isolated environment
  3. Long-running tasks โ€” Start a job, disconnect, come back later
  4. Dev environments โ€” Consistent, reproducible setups
  5. CI/testing sandboxes โ€” Spin up, test, destroy

Prior Art

  • Sprites โ€” Fly.io hosted version (Firecracker VMs, checkpoint/restore)
  • E2B โ€” Cloud sandboxes for AI
  • Modal โ€” Serverless containers
  • Gitpod โ€” Cloud dev environments

Implementation Options

Option A: Standalone Service

  • Separate repo/binary
  • Clawdbot connects via HTTP
  • Can be used independently

Option B: Clawdbot Plugin

  • Built into Clawdbot
  • Configured in clawdbot.yaml
  • Tighter integration

Option C: Hybrid

  • Core API is standalone
  • Clawdbot has native tool that talks to it

Open Questions

  1. Should this be part of Clawdbot core or a separate service?
  2. How should auth work? (API keys, Tailscale identity, Clawdbot sessions?)
  3. Should spaces be tied to Clawdbot sessions/agents?
  4. Multi-host support? (Route to different servers based on load/location)
  5. Billing/metering for hosted version?

Proof of Concept

Already built a basic version on an Oracle ARM server:

  • Docker-based containers
  • CLI wrapper for create/exec/stop/start/destroy
  • Works, but requires SSH access

The proposal is to make this a proper API-driven service with Clawdbot integration.


Idea from exploring Sprites and wanting a self-hosted equivalent.

Activity

  1. adam91holt commented on Jan 10, 2026

    @adam91holt
    ContributorAuthor

    ๐Ÿš€ Proof of Concept Implemented!

    I've built a working implementation of Clawdspace:

    Repository: https://github.com/adam91holt/clawdspace

    What's Included

    • TypeScript API (packages/api/) - Express server with Docker integration
    • React Dashboard (packages/web/) - Vite + React + TypeScript
    • CLI Tool (packages/cli/) - Bash script for local control
    • Docker Image (docker/) - Ubuntu 24.04 sandbox environment

    Features Working

    โœ… Create/destroy spaces
    โœ… Pause/resume (auto-unpauses on exec)
    โœ… Execute commands with output streaming
    โœ… Auto-sleep after 10 min idle
    โœ… Web dashboard with real-time stats
    โœ… API key authentication
    โœ… System monitoring (CPU, RAM, disk)

    Dashboard Screenshot

    Clawdspace Dashboard

    Live Demo

    Currently running on an Oracle ARM server (24GB RAM, 4 CPU):

    • 4 spaces active (3 running, 1 paused)
    • Auto-sleep working
    • ~5ms exec latency

    Architecture

    graph TB
        CLI[CLI Tool] --> API[Express API]
        Web[React Dashboard] --> API
        API --> Docker[Docker Engine]
        Docker --> S1[Space 1]
        Docker --> S2[Space 2]
        Docker --> S3[Space N]
    
    Loading

    Next Steps for Integration

    1. Native Clawdbot tool?
    2. Auth via Tailscale identity?
    3. Multi-host support?

    Let me know what you think ๐Ÿฆˆ

  2. thewilloftheshadow commented on Jan 13, 2026

    @thewilloftheshadow
    Member

    @joshp123 ๐Ÿ‘€

  3. adam91holt commented on Jan 13, 2026

    @adam91holt
    ContributorAuthor

    โœ… Progress update: Clawdspace is live + Clawdbot tool integration is working

    Clawdspace is now past โ€œidea/PoCโ€ โ€” weโ€™re using it in anger as a real execution substrate for agents.

    Whatโ€™s working today (end-to-end)

    • Live deployment: Clawdspace API running on an Oracle ARM node and responding normally (currently running v1.6.0).
    • Spaces: Docker container + persistent Docker volume mounted at /workspace (clawdspace- + clawdspace-vol-).
    • Auto-sleep: idle spaces pause (no CPU), resume on demand.
    • Core API: create/list/get/destroy spaces; exec; stats; files list/get/put; audit.
    • Terminal: websocket terminal endpoint (/api/spaces/:name/terminal) for interactive sessions.
    • Templates: stored server-side (/api/templates) and applied on create for consistent defaults (resources/image/network/rootfs).
    • Git workflows:
      • optional repo clone during POST /api/spaces (with GitHub HTTPS support)
      • server-side push endpoint (POST /api/spaces/:name/git/push) to avoid persisting tokens in the container.
    • Multi-node discovery: nodes can be discovered via Tailscale and cached for the dashboard/clients (/api/nodes).

    How Clawdbot fits (this is the important part)

    We now have a Clawdbot-side extension that exposes Clawdspace as a native tool โ€” so agents can create a space, exec, and move files without SSHing into servers or relying on a local CLI.

    Architecture diagram

    flowchart LR
      %% Clients
      AGENT[Clawdbot Agent] -->|tool call: clawdspace| PLUGIN[Clawdspace Extension<br/>Clawdbot]
      CLI[clawdspace CLI] -->|REST| API
      UI[Web Dashboard] -->|REST| API
      UI -->|WebSocket terminal| API
    
      %% Clawdbot side
      PLUGIN -->|REST - API key| API
    
      %% Clawdspace node
      API[Clawdspace API] -->|Docker socket| DOCKER[Docker Engine]
      DOCKER -->|containers| SPACE[Spaces]
      DOCKER -->|named volumes| VOL[Per-space volumes]
    
      API -->|tailscale status| TS[Tailscale]
      API -->|cached probe| NODES[Other nodes]
    
      API --> AUDIT[Audit JSONL]
      SPACE -->|bash history| VOL
      API -->|ingest .bash_history| AUDIT
    
    Loading

    What we should decide next

    1. Where this lives long-term: keep Clawdspace as a standalone service repo (current) with a Clawdbot extension, vs. bringing it into Clawdbot core.
    2. Auth hardening: API keys work; the next obvious step is optional Tailscale identity auth.
    3. Multi-host routing + templates: define how Clawdbot chooses nodes (per-agent, per-capability like GPU, per-load).

    If we align on the above, we can turn this into a documented, supported โ€œdefault execution sandboxโ€ path for Clawdbot agents.

  4. joshp123 commented on Jan 13, 2026

    @joshp123
    Contributor

    Discussing on discord!

  5. sebslight commented on Jan 19, 2026

    @sebslight
    Contributor

    Moved to discussion

  6. converted this issue into a discussionon Jan 19, 2026
  7. locked as resolved and limited conversation to collaborators on Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions