apps/docs/src/content/docs/en/index.mdx
import { TabItem, Tabs } from '@astrojs/starlight/components'
Daytona is an open-source, 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 agent workflows.
Agents and developers interact with sandboxes programmatically using the Daytona SDKs, API, and CLI. Operations span sandbox lifecycle management, filesystem operations, process and code execution, and runtime configuration. Our stateful environment snapshots enable persistent agent operations across sessions, making Daytona the ideal foundation for AI agent architectures.
:::tip
For faster development with AI agents and assistants, use our LLMs context files: llms.txt and llms-full.txt, agent skills, and markdown pages by appending .md to URLs.
npx skills add https://github.com/daytona/skills --skill daytona
:::
Open the Daytona Dashboard ↗ to create your account. Daytona supports account creation using an email and password, or by connecting your Google or GitHub account.
Generate an API key from the Daytona Dashboard ↗ or using the Daytona API to authenticate SDK requests and access Daytona services. Daytona supports multiple options to configure your environment and API keys: in code, environment variables, .env file, and default values.
Install the Daytona Python, TypeScript, Ruby, Go, or Java SDKs to interact with sandboxes.
<Tabs syncKey="language"> <TabItem label="Python" icon="seti:python">pip install daytona
npm install @daytona/sdk
gem install daytona
go get github.com/daytonaio/daytona/libs/sdk-go
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 to run your code securely in an isolated environment.
<Tabs syncKey="language"> <TabItem label="Python" icon="seti:python"># 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()
// 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()
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
package main
import (
"context"
"fmt"
"github.com/daytonaio/daytona/libs/sdk-go/pkg/daytona"
"github.com/daytonaio/daytona/libs/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)
fmt.Println(sandbox.ID)
}
import io.daytona.sdk.Daytona;
import io.daytona.sdk.Sandbox;
import io.daytona.sdk.DaytonaConfig;
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();
System.out.println(sandbox.getId());
}
}
}
curl https://app.daytona.io/api/sandbox \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{}'
daytona create
Create a program that runs code inside a sandbox. The following snippets are examples of "Hello World" programs that run securely inside a sandbox.
<Tabs syncKey="language"> <TabItem label="Python" icon="seti:python"># 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 the code securely inside the Sandbox
response = sandbox.process.code_run('print("Hello World")')
# Check the response
if response.exit_code != 0:
print(f"Error: {response.exit_code} {response.result}")
else:
print(response.result)
# Clean up
sandbox.delete()
// 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({
language: 'typescript',
})
// Run the code securely inside the Sandbox
const response = await sandbox.process.codeRun('console.log("Hello World")')
// Check the response
if (response.exitCode !== 0) {
console.error(`Error: ${response.exitCode} ${response.result}`)
} else {
console.log(response.result)
}
// Clean up
await sandbox.delete()
require 'daytona'
# Initialize the Daytona client
config = Daytona::Config.new(api_key: 'YOUR_API_KEY')
daytona = Daytona::Daytona.new(config)
# Create the Sandbox instance
sandbox = daytona.create
# Run the code securely inside the Sandbox
response = sandbox.process.code_run(code: 'print("Hello World")')
puts response.result
// Import the Daytona SDK
package main
import (
"context"
"log"
"github.com/daytonaio/daytona/libs/sdk-go/pkg/daytona"
"github.com/daytonaio/daytona/libs/sdk-go/pkg/types"
)
func main() {
// Define the configuration
config := &types.DaytonaConfig{
APIKey: "YOUR_API_KEY", // Replace with your API key
}
// Initialize the Daytona client
client, err := daytona.NewClientWithConfig(config)
if err != nil {
log.Fatal(err)
}
ctx := context.Background()
// Create the Sandbox instance
params := types.SnapshotParams{
SandboxBaseParams: types.SandboxBaseParams{
Language: types.CodeLanguagePython,
},
}
sandbox, err := client.Create(ctx, params)
if err != nil {
log.Fatal(err)
}
// Run the code securely inside the Sandbox
result, err := sandbox.Process.ExecuteCommand(ctx, `echo "Hello World"`)
// Check the response
if err != nil {
log.Fatalf("Error: %v", err)
}
if result.ExitCode != 0 {
log.Printf("Error: %d %s", result.ExitCode, result.Result)
} else {
log.Println(result.Result)
}
// Clean up
sandbox.Delete(ctx)
}
import io.daytona.sdk.Daytona;
import io.daytona.sdk.DaytonaConfig;
import io.daytona.sdk.Sandbox;
import io.daytona.sdk.model.ExecuteResponse;
public class Main {
public static void main(String[] args) {
DaytonaConfig config = new DaytonaConfig.Builder()
.apiKey("YOUR_API_KEY") // Replace with your API key
.build();
try (Daytona daytona = new Daytona(config)) {
// Create the Sandbox instance
Sandbox sandbox = daytona.create();
// Run the code securely inside the Sandbox
ExecuteResponse response = sandbox.getProcess().executeCommand("echo \"Hello World\"");
// Check the response
if (response.getExitCode() != 0) {
System.err.println("Error: " + response.getExitCode() + " " + response.getResult());
} else {
System.out.println(response.getResult());
}
// Clean up
sandbox.delete();
}
}
}
By following the steps above, you successfully create a Daytona account, obtain an API key, install the SDK, create a sandbox, write code, and run it securely in a sandbox.
Use the following resources to interact with sandboxes: