---
title: Daytona Documentation
description: Start managing your Sandboxes with Daytona.
template: doc
head:
  - tag: title
    content: Documentation · Daytona
  - tag: meta
    attrs:
      property: og:title
      content: Documentation · Daytona
  - tag: meta
    attrs:
      name: twitter:title
      content: Documentation · Daytona
tableOfContents: true
---

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](/docs/en/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.

- **Daytona SDKs**: [TypeScript](/docs/en/typescript-sdk), [Python](/docs/en/python-sdk), [Ruby](/docs/en/ruby-sdk), [Go](/docs/en/go-sdk), [Java](/docs/en/java-sdk)
- **Daytona API**: [RESTful API](/docs/en/tools/api#daytona) ([OpenAPI spec](/docs/openapi.json)), [Toolbox API](/docs/en/tools/api#daytona-toolbox) ([OpenAPI spec](/docs/toolbox-openapi.json))
- **Daytona CLI**: [Mac/Linux](/docs/en/getting-started#cli), [Windows](/docs/en/getting-started#cli), [Reference](/docs/en/tools/cli)

:::tip
For faster development with AI agents and assistants, use our LLMs context files: [llms.txt](https://www.daytona.io/docs/llms.txt) and [llms-full.txt](https://www.daytona.io/docs/llms-full.txt), [agent skills](https://github.com/daytona/skills), and markdown pages by appending `.md` to URLs.

&nbsp;

```text
npx skills add https://github.com/daytona/skills --skill daytona
```
:::

## 1. Create an account

Open the [Daytona Dashboard ↗](https://app.daytona.io/) to create your account. Daytona supports account creation using an email and password, or by connecting your Google or GitHub account.

## 2. Obtain an API key

Generate an API key from the [Daytona Dashboard ↗](https://app.daytona.io/dashboard/keys) or using the [Daytona API](/docs/en/tools/api/#daytona/tag/api-keys/POST/api-keys) to authenticate SDK requests and access Daytona services. Daytona supports multiple options to configure your environment and API keys: [in code](/docs/en/configuration#configuration-in-code), [environment variables](/docs/en/configuration#environment-variables), [.env file](/docs/en/configuration#env-file), and [default values](/docs/en/configuration#default-values).

## 3. Install the SDK

Install the Daytona **Python**, **TypeScript**, **Ruby**, **Go**, or **Java** SDKs to interact with sandboxes.

<Tabs syncKey="language">
<TabItem label="Python" icon="seti:python">

```bash
pip install daytona
```

</TabItem>
<TabItem label="TypeScript" icon="seti:typescript">

```bash
npm install @daytona/sdk
```

</TabItem>
<TabItem label="Ruby" icon="seti:ruby">

```bash
gem install daytona
```

</TabItem>
<TabItem label="Go" icon="seti:go">

```bash
go get github.com/daytonaio/daytona/libs/sdk-go
```

</TabItem>
<TabItem label="Java" icon="seti:java">

**Gradle**

Add the Daytona SDK dependency to your `build.gradle.kts`:

```kotlin
dependencies {
    implementation("io.daytona:sdk-java:0.1.0")
}
```

**Maven**

Add the Daytona SDK dependency to your `pom.xml`:

```xml
<dependency>
  <groupId>io.daytona</groupId>
  <artifactId>sdk-java</artifactId>
  <version>0.1.0</version>
</dependency>
```

</TabItem>
</Tabs>

## 4. Create a Sandbox

Create a sandbox to run your code securely in an isolated environment.

<Tabs syncKey="language">
<TabItem label="Python" icon="seti:python">

```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()
```

</TabItem>
<TabItem label="TypeScript" icon="seti:typescript">

```typescript
// 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()
```

</TabItem>
<TabItem label="Ruby" icon="seti:ruby">

```ruby
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
```

</TabItem>
<TabItem label="Go" icon="seti:go">

```go
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)
}
```

</TabItem>
<TabItem label="Java" icon="seti:java">

```java
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());
        }
    }
}
```

</TabItem>
<TabItem label="API" icon="seti:json">

```bash
curl https://app.daytona.io/api/sandbox \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --data '{}'
```

</TabItem>
<TabItem label="CLI" icon="seti:shell">

```shell
daytona create
```

</TabItem>
</Tabs>

## 5. Write and run code

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">

```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()
```

</TabItem>
<TabItem label="TypeScript" icon="seti:typescript">

```typescript
// 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()
```

</TabItem>
<TabItem label="Ruby" icon="seti:ruby">

```ruby
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
```

</TabItem>
<TabItem label="Go" icon="seti:go">

```go
// 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)
}
```

</TabItem>
<TabItem label="Java" icon="seti:java">

```java
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();
        }
    }
}
```

</TabItem>
</Tabs>

## Summary

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.

## Next steps

Use the following resources to interact with sandboxes:

- Learn more about Daytona with the [getting started](/docs/en/getting-started) and [sandboxes](/docs/en/sandboxes) guides
- View [examples](/docs/en/getting-started#examples) for common sandbox operations and best practices
- Explore [guides](/docs/en/guides) to connect Daytona with [Claude](/docs/en/guides/claude), [OpenCode](/docs/en/guides/opencode/opencode-web-agent), [Codex](/docs/en/guides/codex/codex-sdk-interactive-terminal-sandbox), [LangChain](/docs/en/guides/langchain/langchain-data-analysis) and more
