Local sandbox provider for Vibekit using Dagger
npm install @vibe-kit/daggerLocal sandbox provider for Vibekit using Dagger.
The @vibe-kit/dagger package enables Vibekit to run AI coding agents in isolated, containerized environments on your local machine. This provides an alternative to cloud-based sandboxes, offering faster iteration, offline development, and cost savings.
The local provider is automatically available when you install Vibekit. System dependencies are installed automatically when you first use the local provider:
``bashInitialize with local provider
vibekit init --provider dagger
$3
If automatic installation fails, you can install dependencies manually:
`bash
Install Docker (platform-specific)
See: https://docs.docker.com/get-docker/
Install Dagger
curl -fsSL https://dagger.io/install.sh | bashVerify installation
dagger version
`Usage
$3
`typescript
import { createLocalProvider } from '@vibe-kit/dagger';// Create a local provider
const provider = createLocalProvider();
// Create a sandbox instance
const sandbox = await provider.create(
{ NODE_ENV: 'development' }, // environment variables
'claude', // agent type
'/vibe0' // working directory
);
// Execute commands
const result = await sandbox.commands.run('npm install');
console.log(result.stdout);
// Clean up
await sandbox.kill();
`$3
`typescript
import { createLocalProvider, LocalDaggerConfig } from '@vibe-kit/dagger';const config: LocalDaggerConfig = {
// Configuration options for the local provider
};
const provider = createLocalProvider(config);
`Architecture
The local provider consists of several key components:
- Dagger Integration: Low-level container orchestration
- Environment Manager: Lifecycle and state management
- Container Persistence: Workspace state across commands
- Agent Configuration: Support for multiple agent types
- Resource Management: Docker container orchestration
Agent Support
The local provider supports all Vibekit agent types:
- Claude: Uses
assets/dockerfiles/Dockerfile.claude
- Codex: Uses assets/dockerfiles/Dockerfile.codex
- OpenCode: Uses assets/dockerfiles/Dockerfile.opencode
- Gemini: Uses assets/dockerfiles/Dockerfile.geminiEach agent type can have its own optimized container image for better performance.
Security Considerations
Local sandboxes run in Docker containers with the following isolation:
- File System: Containers cannot access host files outside mounted volumes
- Network: Containers run in isolated Docker networks
- Process: Complete process isolation from host system
- Resources: Configurable CPU and memory limits
Interface Compatibility
This package implements the same
SandboxProvider interface as other Vibekit providers:`typescript
interface SandboxProvider {
create(envs?, agentType?, workingDirectory?): Promise;
resume(sandboxId: string): Promise;
}interface SandboxInstance {
sandboxId: string;
commands: SandboxCommands;
kill(): Promise;
pause(): Promise;
getHost(port: number): Promise;
}
`This ensures you can swap between local and cloud providers seamlessly.
Troubleshooting
$3
Docker not running:
`bash
Check Docker status
docker psStart Docker Desktop (macOS/Windows)
Or start Docker daemon (Linux)
`Dagger not found:
`bash
Reinstall Dagger
curl -fsSL https://dagger.io/install.sh | bashCheck PATH
which dagger
`Permission errors:
`bash
Add user to docker group (Linux)
sudo usermod -aG docker $USER
Then log out and back in
`$3
Enable verbose logging for troubleshooting:
`bash
export VIBEKIT_LOG_LEVEL=debug
Your Vibekit commands here
`Contributing
See the main Vibekit contribution guide for general guidelines.
$3
`bash
Clone the repository
git clone https://github.com/vibekit/vibekit.git
cd vibekitInstall dependencies
npm installBuild the dagger package
cd packages/dagger
npm run buildRun tests
npm test
``MIT - see LICENSE for details.