Introducing Cloudflare Sandboxes Support
VibeKit now supports Cloudflare Sandboxes for AI code execution at the edge. Leverage isolated container environments across 300+ global locations with sub-second performance, complete Git integration, and real-time output streaming for faster AI coding workflows.
The Change
Previous approach: Code execution in centralized environments with higher latency. Current approach: Code execution at edge locations with sub-second performance.
Cloudflare Sandboxes provide isolated, container-based environments that execute code on Cloudflare's global edge network. Technical capabilities:
- Code execution in isolated, container-based environments on Cloudflare's edge
- Sub-second response times at 300+ global locations
- File operations and Git functionality within sandboxes
- Real-time output streaming
What This Enables
This reduces the latency in AI coding workflows by executing code closer to users.
Security
Code execution happens in isolated container environments. Secure file management within sandboxed environments.
Performance
Sub-second execution times at edge locations globally. Eliminates the traditional latency bottleneck.
Development Workflow
Complete Git integration:
- Repository cloning and PR creation within sandboxes
- Real-time output streaming
- File operations at edge locations
Getting Started
Adding Cloudflare Sandboxes to your VibeKit setup is straightforward:
import { VibeKit } from "@vibe-kit/sdk";
import { createCloudflareProvider } from "@vibe-kit/cloudflare";
const provider = createCloudflareProvider({
env: env, // Cloudflare Worker's env object
hostname: "your-worker.domain.workers.dev"
});
const vibeKit = new VibeKit()
.withAgent({
type: "claude",
provider: "anthropic",
apiKey: process.env.ANTHROPIC_API_KEY!,
model: "claude-sonnet-4-20250514"
})
.withSandbox(provider);
Use Cases This Enables
Coding agent use cases that require low latency:
- Interactive tools: Real-time code execution feedback with minimal latency
- Real-time user-facing features: AI-powered coding functionality in production applications
- Responsive development environments: Fast feedback loops for iterative development
- Global coding platforms: Consistent sub-second performance regardless of user location
Technical Implementation
The integration leverages Cloudflare's Durable Objects for strong consistency and automatic geographic distribution across their edge network.
Configuration Setup
Install the Cloudflare provider:
npm install @vibe-kit/cloudflare
Configure your wrangler.json
with Sandbox and Durable Object bindings:
{
"name": "my-vibekit-worker",
"main": "src/index.ts",
"compatibility_date": "2024-01-01",
"containers": [
{
"class_name": "Sandbox",
"image": "./node_modules/@cloudflare/sandbox/Dockerfile",
"max_instances": 1
}
],
"durable_objects": {
"bindings": [
{
"class_name": "Sandbox",
"name": "Sandbox"
}
]
}
}
Technical Capabilities
- Edge-native execution: Code runs directly on Cloudflare's global network
- Preview URL generation: Automatic exposure of sandbox ports for web applications
- Durable Objects integration: Strong consistency across edge locations
- Multi-agent support: Compatible with Claude, OpenAI Codex, and other AI agents
Requirements
- Node.js 18+
- Cloudflare Worker environment
- Docker for local sandbox development
Technical documentation: https://docs.vibekit.sh/supported-sandboxes/cloudflare