Skip to main content
Cloudflare Sandboxes provide edge-native sandboxed code environments built on Cloudflare’s container platform and Durable Objects. Unlike other VibeKit providers, Cloudflare sandboxes run exclusively within Cloudflare Workers for agentic & AI use cases. Learn more about Cloudflare Workers here.

Installation

Configuration

Using the provider directly

Worker Setup

Cloudflare sandboxes require specific Worker configuration:

1. Configure wrangler.json

2. Create your Worker

ENV variables and secrets

In your Worker code:

Configuration Options

The createCloudflareProvider function accepts these configuration options:
  • env (required): Your Cloudflare Worker’s environment object containing the Sandbox Durable Object binding
  • hostname (required): Your Worker’s hostname used for generating preview URLs when exposing ports

Unique Features

Preview URLs

Cloudflare sandboxes can generate public preview URLs when services are exposed on specific ports, making them accessible from anywhere on the internet.

Edge-Native Execution

Sandboxes run on Cloudflare’s global edge network, providing low-latency execution closest to your users.

Durable Objects Integration

Built on Cloudflare’s Durable Objects platform for strong consistency, automatic geographic distribution, and seamless Workers platform integration.

Local Development

For local development with wrangler dev, only ports explicitly exposed in the Dockerfile are available for port forwarding. This is not an issue in production. To test multiple ports locally, create a custom Dockerfile:
Then update your wrangler.json to use the custom Dockerfile:

Requirements

  • Cloudflare Workers: Must run within a Cloudflare Worker environment
  • Wrangler: For local development and deployment
  • Docker: For building sandboxes locally and deploying to Cloudflare
  • Node.js 18+: For development tooling