Skip to main content

Daytona

tip

72,467 GitHub stars — Secure, elastic sandbox infrastructure for running AI-generated code. Launch isolated environments with git sync and live previews.

Overview

Daytona provides a secure runtime environment where AI agents can execute code, run tests, preview builds, and interact with services without touching your real machine or production infrastructure. Each sandbox is disposable, network-isolated, and automatically cleaned up.

When to Use

ScenarioBenefit
AI-generated code executionRun untrusted code in isolated sandboxes
Preview deploymentsSpin up ephemeral preview environments for each PR
Multi-agent workGive each agent its own sandbox to prevent conflicts
CI/CD integrationRun build and test pipelines in reproducible environments
Learning and experimentationExplore tools and frameworks without polluting your local setup

How It Works

Daytona creates isolated environments on demand:

  1. Agent requests a sandbox — The agent calls the Daytona tool with a project reference or git URL.
  2. Daytona provisions a sandbox — A lightweight container or VM is created with the requested runtime.
  3. Code is synced — Git clone or file sync populates the sandbox with the project code.
  4. Agent works inside the sandbox — Commands, edits, and tests run inside the isolated environment.
  5. Sandbox is destroyed — When work is complete, the sandbox is torn down and resources are reclaimed.

Installation

Daytona is a standalone infrastructure tool. Install it directly:

curl -fsSL https://raw.githubusercontent.com/daytonaio/daytona/main/scripts/install.sh | bash

Configuration

Initialize Daytona and configure your provider:

daytona init
daytona provider add
daytona target set

opencode.json Integration

Add the Daytona MCP server to your OpenCode config:

{
"mcp": {
"daytona": {
"type": "local",
"command": ["daytona", "mcp"],
"enabled": true
}
}
}

Usage

Create a Sandbox

daytona create --repo https://github.com/user/project.git

Run Inside Sandbox

daytona exec <sandbox-id> "npm test"

List Sandboxes

daytona list

OpenCode Integration Example

{
"command": {
"sandbox-test": {
"description": "Run tests in an isolated Daytona sandbox",
"template": "Create a Daytona sandbox for the project at $1 and run the full test suite. Report results."
}
}
}

Best Practices

Environment Parity

  • Use the same runtime versions in sandboxes as in production.
  • Define sandbox images with all required tools pre-installed.

Resource Limits

  • Set CPU and memory limits per sandbox to prevent resource exhaustion.
  • Configure auto-shutdown for idle sandboxes.

Security Isolation

  • Treat every sandbox as potentially compromised.
  • Never mount production credentials into sandboxes.
  • Use network policies to restrict outbound access.

GitHub

  • Repo: daytonaio/daytona
  • Topics: ai-runtime, ai-sandboxes, code-execution, developer-tools
  • License: Apache-2.0
  • Category: Workspace / Environment