Registry / devops / daytona

daytona

JSON →
library0.207.0pypypi✓ verified 25d ago

Daytona is an open-source platform that provides secure, isolated 'sandboxes' – composable computers – for running AI-generated code and streamlining development environments for engineering teams. The Python SDK allows programmatic interaction with these sandboxes, offering functionalities like lifecycle management, code execution, file system operations, and Git integration. It aims to simplify environment setup across various infrastructures. The library is actively maintained with frequent releases, often on a near-daily basis.

pip install daytona
INSTALL
IMPORT
SIG · DAYTONA
D
daytona
devopspythonv0.207.0
Install
12.1s avg
Import
7524ms
Disk
93MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.207.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 6.280s · 91.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 12.1s · import 5.758s · 92MB
93MB installed
● package 93MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Daytona
from daytona import Daytona
from daytona_sdk import Daytona
The primary package name and import path changed from `daytona-sdk` to `daytona` in recent versions. Using `daytona_sdk` will result in an `ImportError` or import an outdated version if both are installed.
DaytonaConfig
from daytona import Daytona, DaytonaConfig

This quickstart demonstrates how to initialize the Daytona client, create a sandbox, execute Python code within it, and then clean up the sandbox. Authentication is handled via an API key, ideally from an environment variable.

import os from daytona import Daytona, DaytonaConfig # It is highly recommended to set API_KEY as an environment variable (DAYTONA_API_KEY) api_key = os.environ.get('DAYTONA_API_KEY', 'YOUR_DAYTONA_API_KEY') if api_key == 'YOUR_DAYTONA_API_KEY': print("Warning: Please set the DAYTONA_API_KEY environment variable or replace 'YOUR_DAYTONA_API_KEY' with your actual key.") exit() # Configure Daytona client (using environment variables by default, or explicitly) config = DaytonaConfig(api_key=api_key) daytona = Daytona(config) try: # Create a new sandbox print("Creating a Daytona sandbox...") sandbox = daytona.create() print(f"Sandbox created with ID: {sandbox.id} and state: {sandbox.state}") # Run a simple Python command in the sandbox print("Running 'Hello World!' in the sandbox...") response = sandbox.process.code_run('print("Hello World from Daytona sandbox!")') print(f"Sandbox output: {response.result}") print(f"Exit code: {response.exit_code}") # Clean up the sandbox print(f"Deleting sandbox {sandbox.id}...") daytona.delete(sandbox) print("Sandbox deleted successfully.") except Exception as e: print(f"An error occurred: {e}") # Add more specific error handling as per warnings below
daytona --version
Debug
Known issues
breakingThe package name and import path for the Python SDK changed from `daytona-sdk` to `daytona`. Code using `pip install daytona-sdk` or `from daytona_sdk import Daytona` will fail or use an outdated client.
fix
Update `pip install daytona-sdk` to `pip install daytona` and `from daytona_sdk import Daytona` to `from daytona import Daytona`.
affects: <=0.100.0 (approximate, based on deprecation timeline)
breakingError handling has been standardized to use specific, semantically meaningful exception subclasses (e.g., `DaytonaNotFoundError`, `DaytonaAuthenticationError`) instead of the generic `DaytonaError`. While `DaytonaError` still acts as a catch-all, relying on string parsing of error messages to differentiate failures is now brittle and may break.
fix
Update `except DaytonaError as exc: if 'message text' in str(exc):` patterns to catch specific exceptions like `except DaytonaNotFoundError:` or `except DaytonaAuthenticationError:`.
affects: Introduced in v0.163.0 (and discussed earlier), affects versions where specific error types are preferred over string parsing.
gotchaThe Python SDK's dotenv handling (loading environment variables from `.env` files) has been made more isolated. Only environment variables prefixed with `DAYTONA_` are now loaded, preventing unintended pollution of the global environment.
fix
Ensure all Daytona-related environment variables in `.env` files are prefixed with `DAYTONA_` (e.g., `API_KEY` should be `DAYTONA_API_KEY`).
affects: >=0.157.0
gotchaThe Daytona SDK undergoes rapid development with frequent minor version releases (often daily or every few days). While this ensures continuous improvement, users should plan for regular updates and monitor release notes for changes that might affect their applications.
fix
Regularly review release notes for the `daytona` package. Consider using version pinning in `requirements.txt` (e.g., `daytona~=0.164.0`) to control updates, but be prepared to update frequently to leverage new features and bug fixes.
affects: All recent versions (v0.x.x)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'daytona'
The 'daytona' Python SDK package is not installed in the current Python environment.
fix
Install the package using pip: `pip install daytona`
DaytonaConnectionException: Failed to connect to Daytona API
The Daytona server (daemon) is not running or is inaccessible from the client application due to network issues, DNS failure, connection refused, or TLS errors.
fix
Ensure the Daytona server is running locally (e.g., `daytona server -y` or `daytona serve`) and check network connectivity or firewall rules if connecting remotely.
DaytonaAuthenticationException: Unauthorized
The Daytona SDK cannot authenticate with the API because the API key or JWT token is missing, invalid, or incorrectly configured.
fix
Provide a valid API key via the `DAYTONA_API_KEY` environment variable or by passing it directly to the `DaytonaConfig` object during client initialization.
failed to create workspace
The Daytona CLI or SDK failed to create a sandbox/workspace, often due to the underlying Docker daemon not running, insufficient resources, or an invalid repository/image definition.
fix
Ensure Docker Desktop or the Docker daemon is running and accessible. Check Daytona server logs for more specific errors. If a previous failed attempt left a stale workspace, delete it with `daytona delete <workspace-name>`.
Upgrade
Version history
0.207.0latest on PyPI · released Aug 24, 2026
Audit
Dependencies
pythonrequiredRequires Python 3.8 or newer, but less than 4.0.
Agent activity
22 hits · last 30 days
node
18
OpenAI (training)
1
Resources
daytona — pip install daytona · libregistry