# Daytona Documentation

Daytona is secure and elastic cloud infrastructure built for autonomous agents.

Daytona provides **composable computers for agents** — [sandboxes](https://www.daytona.io/docs/en/v2/sandboxes.md) — virtual machines with hardware isolation, a dedicated kernel, filesystem, network, 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 and massive parallelization, sandboxes deliver consistent, predictable environments for AI, autonomous agents, and reinforcement learning.

<AgentPrompt
  title="Agent Prompt"
  prompt={`
Help me set up Daytona in this project. Before writing any Daytona code, verify the setup:

1. Check that the Daytona SDK is installed for the language used in this project. If not, install it.

    Python: \`pip install daytona\`
    TypeScript: \`npm install @daytona/sdk\`

2. Check 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.com/dashboard/keys to create one.

3. 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.

4. Run the script to verify the sandbox works.
`}
/>

## Get started

1. Create an account → [app.daytona.com](https://app.daytona.com)
2. Get an API key → [app.daytona.com/dashboard/keys](https://app.daytona.com/dashboard/keys)
3. Save the API key → **`DAYTONA_API_KEY`** environment variable or in a **`.env`** file.


```bash
DAYTONA_API_KEY=YOUR_API_KEY
```


```bash
export DAYTONA_API_KEY=YOUR_API_KEY
```


```powershell
$env:DAYTONA_API_KEY="YOUR_API_KEY"
```



4. Install the Python SDK

    ```bash 
    pip install daytona
    ```

5. Create a sandbox and run code

    ```python
    from daytona import Daytona

    daytona = Daytona()

    sandbox = daytona.v2.create()

    response = sandbox.run_code('print("Hello World")')
    print(response.logs.stdout)
    ```


4. Install the TypeScript SDK

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

5. Create a sandbox and run code

    ```typescript
    import { Daytona } from '@daytona/sdk'

    const daytona = new Daytona()

    const sandbox = await daytona.v2.create()

    const response = await sandbox.runCode('print("Hello World")')
    console.log(response.logs.stdout)
    ```


4. Install the CLI


      ```bash
      brew install daytonaio/cli/daytona
      ```


      ```bash
      # Downloads the amd64 or arm64 binary for this host
      ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/') && \
        sudo curl -fL "https://github.com/daytona/clients/releases/latest/download/daytona-linux-$ARCH" -o /usr/local/bin/daytona && \
        sudo chmod +x /usr/local/bin/daytona
      ```


      ```bash
      powershell -Command "irm https://get.daytona.io/windows | iex"
      ```


5. Log in


    ```bash
    daytona login --token "$DAYTONA_API_KEY" --api-url https://api.daytona.com
    ```


    ```powershell
    daytona login --token "$env:DAYTONA_API_KEY" --api-url https://api.daytona.com
    ```


6. Create a sandbox and run code

    ```bash
    daytona sandbox create
    daytona sandbox exec {sandboxId} -- python -c 'print("Hello World")'
    ```


4. Create a sandbox and run code

    ```bash
    # Create sandbox
    curl 'https://api.daytona.com/sandboxes' \
      --request POST \
      --header 'Content-Type: application/json' \
      --header "Authorization: Bearer $DAYTONA_API_KEY" \
      --data '{}'

    # Wait until running
    curl 'https://api.daytona.com/sandboxes/{sandboxId}?wait=running&timeout_ms=60000' \
      --header "Authorization: Bearer $DAYTONA_API_KEY"

    # Run code
    curl 'https://toolbox.daytona.com/toolbox/{sandboxId}/processes?waitMs=30000&logs=text' \
      --request POST \
      --header 'Content-Type: application/json' \
      --header "Authorization: Bearer $DAYTONA_API_KEY" \
      --data '{"kind": "code", "language": "python", "code": "print(\"Hello World\")"}'
    ```


## References

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 Sandboxes**: [Linux](https://www.daytona.io/docs/en/v2/sandboxes.md#linux-sandboxes), [macOS](https://www.daytona.io/docs/en/v2/sandboxes.md#macos-sandboxes)
- **Daytona SDKs**: [TypeScript](https://www.daytona.io/docs/en/v2/typescript-sdk.md), [Python](https://www.daytona.io/docs/en/v2/python-sdk.md)
- **Daytona APIs**: [Platform](https://www.daytona.io/docs/en/v2/api.md) ([OpenAPI](https://www.daytona.io/docs/v2/openapi.json)), [Toolbox](https://www.daytona.io/docs/en/v2/api.md) ([OpenAPI](https://www.daytona.io/docs/v2/toolbox-openapi.json))
- **Daytona CLI**: [Mac/Linux/Windows](https://www.daytona.io/docs/en/v2/cli.md)
- **Daytona LLMs**: [llms.txt](https://www.daytona.io/docs/llms.txt), [llms-full.txt](https://www.daytona.io/docs/llms-full.txt)
- **Daytona Markdown**: suffix pages with **.md** (e.g [sandboxes.md](https://www.daytona.io/docs/en/v2/sandboxes.md))