Documentation · Daytona
Daytona Documentation
Daytona is a secure and elastic infrastructure for running AI-generated code.
Daytona provides full composable computers — sandboxes — with complete isolation, a dedicated kernel, filesystem, network stack, and allocated vCPU, RAM, and disk.
Sandboxes are the core component of the Daytona platform, spinning up in under 90ms from code to execution and running any code in Python, TypeScript, and JavaScript. Built on OCI/Docker compatibility, massive parallelization, and unlimited persistence, sandboxes deliver consistent, predictable environments for AI, agent and reinforcement learning workflows.
Agents and developers interact with sandboxes programmatically using the SDKs, API, and CLI.
Help me set up Daytona in this project. Before writing any Daytona code, verify the setup:
Check that the Daytona SDK is installed for the language used in this project. If not, install it.
Python:
pip install daytonaTypeScript:npm install @daytona/sdkRuby:gem install daytonaGo:go get github.com/daytona/clients/sdk-goJava: add theio.daytona:sdkdependency tobuild.gradle.ktsorpom.xmlCheck DAYTONA_API_KEY in the shell environment or in environment files. If not set, tell the user they need an API key and point them to https://app.daytona.io/dashboard/keys to create one.
Write a script that initializes the Daytona client, creates a sandbox, runs a "Hello World" program inside it, captures the output, and deletes the sandbox.
Run the script to verify the sandbox works.
Get started
- Create an account → app.daytona.io
- Get an API key → app.daytona.io/dashboard/keys
- Save the API key →
DAYTONA_API_KEYenvironment variable or in a.envfile.
DAYTONA_API_KEY=YOUR_API_KEY
export DAYTONA_API_KEY=YOUR_API_KEY
$env:DAYTONA_API_KEY="YOUR_API_KEY"
- Install the Python SDK
pip install daytona
- Create a sandbox and run code
# Import the Daytona SDK
from daytona import Daytona, DaytonaConfig
# Define the configuration
config = DaytonaConfig(api_key="YOUR_API_KEY") # Replace with your API key
# Initialize the Daytona client
daytona = Daytona(config)
# Create the Sandbox instance
sandbox = daytona.create()
# Run code
response = sandbox.process.code_run('print("Hello World")')
print(response.result)
- Install the TypeScript SDK
npm install @daytona/sdk
- Create a sandbox and run code
// Import the Daytona SDK
import { Daytona } from '@daytona/sdk'
// Initialize the Daytona client
const daytona = new Daytona({ apiKey: 'YOUR_API_KEY' }) // Replace with your API key
// Create the Sandbox instance
const sandbox = await daytona.create()
// Run code
const response = await sandbox.process.codeRun('print("Hello World")')
console.log(response.result)
- Install the Ruby SDK
gem install daytona
- Create a sandbox and run code
require 'daytona'
# Initialize the Daytona client
config = Daytona::Config.new(api_key: 'YOUR_API_KEY') # Replace with your API key
# Create the Daytona client
daytona = Daytona::Daytona.new(config)
# Create the Sandbox instance
sandbox = daytona.create
# Run code
response = sandbox.process.code_run(code: 'print("Hello World")')
puts response.result
- Install the Go SDK
go get github.com/daytona/clients/sdk-go
- Create a sandbox and run code
package main
import (
"context"
"fmt"
"github.com/daytona/clients/sdk-go/pkg/daytona"
"github.com/daytona/clients/sdk-go/pkg/types"
)
func main() {
config := &types.DaytonaConfig{
APIKey: "YOUR_API_KEY", // Replace with your API key
}
client, _ := daytona.NewClientWithConfig(config)
ctx := context.Background()
sandbox, _ := client.Create(ctx, nil)
// Run code
result, _ := sandbox.Process.CodeRun(ctx, `print("Hello World")`)
fmt.Println(result.Result)
}
- Install the Java SDK
Gradle
Add the Daytona SDK dependency to your build.gradle.kts:
dependencies {
implementation("io.daytona:sdk-java:0.1.0")
}
Maven
Add the Daytona SDK dependency to your pom.xml:
<dependency>
<groupId>io.daytona</groupId>
<artifactId>sdk-java</artifactId>
<version>0.1.0</version>
</dependency>
- Create a sandbox and run code
import io.daytona.sdk.Daytona;
import io.daytona.sdk.Sandbox;
import io.daytona.sdk.DaytonaConfig;
import io.daytona.sdk.model.ExecuteResponse;
public class Main {
public static void main(String[] args) {
DaytonaConfig config = new DaytonaConfig.Builder()
.apiKey("YOUR_API_KEY")
.build();
try (Daytona daytona = new Daytona(config)) {
Sandbox sandbox = daytona.create();
// Run code
ExecuteResponse response = sandbox.getProcess().codeRun("print(\"Hello World\")");
System.out.println(response.getResult());
}
}
}
- Create a sandbox and run code
# Create sandbox
curl https://app.daytona.io/api/sandbox \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{}'
# Run code
curl 'https://proxy.app.daytona.io/toolbox/{sandboxId}/process/code-run' \
--request POST \
--header 'Content-Type: application/json' \
--data '{
"code": "print(\"Hello World\")",
"language": "python"
}'
- Install the CLI
daytona create --name hello
daytona exec hello -- python3 -c 'print("Hello World")'
Next steps
Daytona provides core platform resources for managing sandboxes, environments, and storage.
- Linux sandboxes => Linux container and virtual machine runtime for running processes, executing code, and Linux-specific tools.
- Windows sandboxes => Windows OS runtime in a virtual machine for running Windows applications and tooling.
- macOS sandboxes => macOS runtime for automating applications and desktop interactions.
- GPU sandboxes => NVIDIA and AMD GPU runtime for CUDA development, 3D and graphics workloads, and other GPU-accelerated compute.
Reference
Daytona provides a comprehensive set of resources for developers and agents to get started and build on the platform. You can find the following resources in the documentation:
- Daytona SDKs: TypeScript, Python, Ruby, Go, Java
- Daytona APIs: Platform ( OpenAPI), Toolbox ( OpenAPI), Analytics ( OpenAPI)
- Daytona CLI: Mac/Linux/Windows
- Daytona LLMs: llms.txt, llms-full.txt
- Daytona Sitemap: sitemap-0.xml
- Daytona Skills: agent skills
- Daytona Markdown: suffix pages with
.md(e.g sandboxes.md)