Registry / devops / daytona-sdk

daytona-sdk

JSON →
library0.166.0pypypi✓ verified 33d ago

The Daytona Python SDK is the official Python library for Daytona, an open-source, secure, and elastic infrastructure for running AI-generated code. It provides interfaces for managing sandboxes (isolated execution environments), file system operations, Git operations, language server protocol support, and process and code execution. The library is actively maintained and currently at version 0.166.0, with regular updates. [1, 13]

devopsllm-agentsai-ml
Install & Compatibility
Where this runs
tested against v0.187.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.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 83MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 11.0s · import 0.000s · 84MB
86MB installed
● package 86MB
Code
Verified usage

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

from daytona_sdk import AsyncDaytona

This quickstart demonstrates how to initialize the Daytona SDK, create an isolated sandbox environment, execute Python code within it, and then clean up the sandbox. Ensure your `DAYTONA_API_KEY` is set as an environment variable or passed directly to `DaytonaConfig`. [3, 6, 13]

import os from daytona import Daytona, DaytonaConfig # Configure with API key from environment variable (recommended) or direct string api_key = os.environ.get("DAYTONA_API_KEY", "") # Replace with your actual key or ensure env var is set if not api_key: print("Warning: DAYTONA_API_KEY not found in environment variables. Please set it or pass it directly.") # For demonstration purposes, you might uncomment and replace: # api_key = "YOUR_API_KEY_HERE" # if api_key == "YOUR_API_KEY_HERE": # raise ValueError("Please provide a valid Daytona API key.") config = DaytonaConfig(api_key=api_key) daytona = Daytona(config) try: # Create a sandbox print("Creating Daytona sandbox...") sandbox = daytona.create() print(f"Created Sandbox ID: {sandbox.id}") # Run code securely inside the Sandbox print("Running code in sandbox...") response = sandbox.process.code_run('print("Hello World from Daytona!")') print(f"Code Output: {response.result}") # Optional: Execute a shell command # shell_response = sandbox.process.exec("ls -la") # print(f"Shell Command Output:\n{shell_response.result}") finally: # Clean up the sandbox (important to release resources) if 'sandbox' in locals() and sandbox: print(f"Deleting Sandbox ID: {sandbox.id}...") sandbox.delete() print("Sandbox deleted.")
Debug
Known footguns
breakingMajor breaking changes were introduced in Daytona SDK v0.21.0, shifting from a 'declarative image builder' to a 'snapshot-based workflow'. This affects how sandboxes are created and how resources are managed. [2, 19]
breakingResource configuration for sandboxes is now tied to the snapshot rather than being directly configurable on the sandbox object during creation in the new workflow (v0.21.0+). [19]
deprecatedOlder sandbox management methods, such as `daytona.remove(sandbox)`, are no longer supported. Sandbox details are also now available as top-level properties on the `Sandbox` object. [2]
gotchaThe SDK license changed from AGPL to Apache 2.0 starting from v0.21.0. While this is generally less restrictive, users on older versions should be aware of the original AGPL license implications if they have not upgraded. [19]
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
35 hits · last 30 days
petalbot
9
ahrefsbot
3
bytedance
3
googlebot
3
dotbot
2
perplexity-user
2
script
1
chatgpt-user
1
Resources