Daytona Documentation
The Daytona SDK provides official Python and TypeScript interfaces for interacting with Daytona, enabling you to programmatically manage development environments and execute code.
Quick Start
Run your first line of code in a Daytona Sandbox. Use our LLMs context files for faster development with AI assistants.
1. Get Your API Key
- Go to the Daytona Dashboard.
- Create a new API key. Make sure to save it securely, as it won’t be shown again.
2. Install the SDK
pip install daytona
npm install @daytonaio/sdk
3. Write Your Code
Create a file named: main.py
from daytona import Daytona, DaytonaConfig
# Define the configuration
config = DaytonaConfig(api_key="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 from code!")')if response.exit_code != 0: print(f"Error: {response.exit_code} {response.result}")else: print(response.result)
# Clean up
sandbox.delete()
Create a file named: index.mts
import { Daytona } from '@daytonaio/sdk';
// Initialize the Daytona clientconst daytona = new Daytona({ apiKey: 'your-api-key' });
// Create the Sandbox instanceconst sandbox = await daytona.create({ language: 'typescript',});
// Run the code securely inside the Sandboxconst response = await sandbox.process.codeRun('console.log("Hello World from code!")')console.log(response.result);
// Clean upawait sandbox.delete()
4. Run It
python main.py
npx tsx index.mts
✅ What You Just Did
- Installed the Daytona SDK.
- Created a secure sandbox environment.
- Executed code remotely inside that sandbox.
- Retrieved and displayed the output locally.
You’re now ready to use Daytona for secure, isolated code execution.
Introduction
- Getting Started
Learn about Daytona SDK and how it can help you manage your development environments. - Configuration
Get started with Daytona SDK and learn how to use and configure your development environments. - Sandboxes
Learn how to create, manage, and remove Sandboxes using the Daytona SDK. - Snapshots
Learn how to create, manage and remove Snapshots using the Daytona SDK. - Declarative Builder
Learn how to dynamically build Snapshots from Docker/OCI compatible images using the Daytona SDK. - Volumes
Learn how to manage volumes in your Daytona Sandboxes.
Account management
Agent Toolbox
- File System
Learn how to manage files and directories in your Sandboxes using the Daytona SDK. - Git Operations
Learn how to manage Git repositories in your Sandboxes using the Daytona SDK. - Language Server Protocol
Learn how to use Language Server Protocol (LSP) support in your Sandboxes using the Daytona SDK. - Process & Code Execution
Learn about running commands and code in isolated environments using the Daytona SDK. - Log Streaming
Learn how to stream logs from your Sandboxes using the Daytona SDK.