Skip to main content
Get started with Daytona by creating and running your first sandbox. This guide will walk you through the complete process from setup to execution.

Prerequisites

Before you begin, make sure you have:

Create your first sandbox

1

Install the SDK

Choose your preferred language and install the Daytona SDK:
pip install daytona
2

Set your API key

Set your API key as an environment variable:
export DAYTONA_API_KEY="your-api-key-here"
You can also pass the API key directly in your code. See the authentication guide for more options.
3

Create and run a sandbox

Create a simple program that creates a sandbox and runs code inside it:
from daytona import Daytona

# Initialize the Daytona client
daytona = Daytona()

# Create the sandbox
sandbox = daytona.create()

# Run code securely inside the sandbox
response = sandbox.process.code_run('print("Sum of 3 and 4 is", 3 + 4)')
print(response.result)

# Clean up
daytona.delete(sandbox)
4

Run your program

Execute your program and you’ll see the output:
Sum of 3 and 4 is 7
Congratulations! You’ve successfully created your first Daytona sandbox and executed code inside it.

What just happened?

Let’s break down what your program did:
  1. Initialized the client - Connected to the Daytona API using your API key
  2. Created a sandbox - Launched an isolated execution environment in under 90ms
  3. Executed code - Ran Python code safely inside the sandbox
  4. Retrieved output - Got the results back to your application
  5. Cleaned up - Deleted the sandbox to free up resources

Next steps

Explore file operations

Upload, download, and manage files in your sandbox

Git operations

Clone repositories and manage Git workflows

Process management

Execute commands and manage processes

Language Server Protocol

Add code intelligence with LSP support

Build docs developers (and LLMs) love