Getting Started & Quick Start
Relevant source files
The following files were used as context for generating this wiki page:
Daytona provides a secure and elastic infrastructure for running AI-generated code. It allows developers and AI agents to manage "sandboxes"—fully composable, isolated computers—programmatically through various SDKs. The platform is designed for lightning-fast environment creation, typically achieving sub-90ms sandbox initialization from code to execution.
Sources: README.md:1-25, libs/sdk-typescript/README.md:1-5
Core Onboarding Workflow
The typical onboarding process for a new user involves five primary steps: installing the relevant SDK, securing an API key, initializing the client, creating a sandbox, and executing code.
The diagram above illustrates the high-level flow for a developer starting with Daytona.
Sources: apps/dashboard/src/pages/Onboarding.tsx:135-235, README.md:40-65
SDK Installation
Daytona supports multiple programming languages. Installation is handled via standard package managers for each ecosystem.
| Language | Package Manager | Command |
|---|---|---|
| Python | pip | pip install daytona |
| TypeScript | npm / yarn | npm install @daytonaio/sdk or yarn add @daytonaio/sdk |
| Ruby | gem | gem install daytona |
| Go | go get | go get github.com/daytonaio/daytona/libs/sdk-go |
Sources: README.md:27-38, libs/sdk-typescript/README.md:11-20, libs/sdk-ruby/README.md:7-18
Authentication & Configuration
To interact with the Daytona API, users must generate an API key from the Daytona Dashboard. Authentication and behavior can be configured either through environment variables or directly within the code via a configuration object.
Configuration Methods
- Environment Variables: The SDKs automatically look for specific variables such as
DAYTONA_API_KEY,DAYTONA_API_URL, andDAYTONA_TARGET. - Configuration Object: Passing parameters directly to the constructor (e.g.,
DaytonaConfigin Python or a literal object in TypeScript).
| Variable | Description | Default / Example |
|---|---|---|
DAYTONA_API_KEY | API key for authentication | Obtained from Dashboard |
DAYTONA_API_URL | URL of the Daytona API | https://app.daytona.io/api |
DAYTONA_TARGET | Target region environment | us, eu |
Sources: libs/sdk-typescript/README.md:22-42, libs/sdk-ruby/README.md:37-43, apps/dashboard/src/pages/Onboarding.tsx:150-180
Sandbox Lifecycle Management
A sandbox is the primary unit of execution in Daytona. The lifecycle typically follows a sequence of creation, execution, and eventual deletion to free resources.
The sequence diagram shows the interaction between the SDK client and the Daytona backend during a standard sandbox lifecycle.
Sources: libs/sdk-typescript/README.md:44-55, examples/typescript/file-operations/index.ts:7-10, examples/typescript/file-operations/index.ts:100-110
Initializing and Creating a Sandbox
Developers can specify the environment's language, container image, and resource constraints (CPU, memory, disk) during creation.
// Example: TypeScript SDK Initialization
import { Daytona } from '@daytonaio/sdk'
const daytona = new Daytona({ apiKey: 'YOUR_API_KEY' });
const sandbox = await daytona.create({
language: 'typescript',
resources: { cpu: 2, memory: 4, disk: 8 }
});
Sources: libs/sdk-typescript/README.md:65-71, apps/dashboard/src/pages/Onboarding.tsx:245-255
Local Development Setup
For developers wishing to run the entire Daytona stack locally, a Docker Compose configuration is provided. This setup includes the API, Runner, Database (PostgreSQL), and Proxy services.
Services in Local Stack
- API: Main application server.
- Runner: Hosts the execution environment for sandboxes.
- Proxy: Handles request routing to active sandboxes.
- MinIO: S3-compatible object storage for persistence.
Quick Start Command
To start the local environment from the repository root:
docker compose -f docker/docker-compose.yaml up -d
Sources: docker/README.md:1-35
Basic Operations
Once a sandbox is active, the SDK provides several namespaces for interacting with it:
- Process: For running shell commands (
executeCommand) or raw code snippets (codeRun). - FileSystem (fs): For uploading, downloading, and searching files.
- Git: For cloning repositories and managing branches.
Execution Example
# Python SDK Code Execution
response = sandbox.process.code_run('print("Hello World!")')
print(response.result)
Sources: README.md:50-55, libs/sdk-typescript/README.md:95-108, examples/typescript/file-operations/index.ts:50-60
Summary
Getting started with Daytona involves choosing an SDK, authenticating via an API key, and leveraging the Daytona client to provision isolated sandboxes. These environments support high-performance code execution and full filesystem control, making them suitable for AI agents and secure development workflows. For local testing, the provided Docker Compose setup offers a complete replica of the Daytona infrastructure.
Sources: README.md:1-20, docker/README.md:10-20