{"id":7142,"library":"daytona-sdk","title":"Daytona SDK","description":"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]","status":"active","version":"0.166.0","language":"python","source_language":"en","source_url":"https://github.com/daytonaio/sdk","tags":["AI","developer tools","sandbox","execution environment","cloud","sdk","agent development","code execution"],"install":[{"cmd":"pip install daytona-sdk","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"wrong":"from daytona import Daytona","symbol":"AsyncDaytona","correct":"from daytona_sdk import AsyncDaytona"}],"quickstart":{"code":"import os\nfrom daytona import Daytona, DaytonaConfig\n\n# Configure with API key from environment variable (recommended) or direct string\napi_key = os.environ.get(\"DAYTONA_API_KEY\", \"\") # Replace with your actual key or ensure env var is set\n\nif not api_key:\n    print(\"Warning: DAYTONA_API_KEY not found in environment variables. Please set it or pass it directly.\")\n    # For demonstration purposes, you might uncomment and replace:\n    # api_key = \"YOUR_API_KEY_HERE\"\n    # if api_key == \"YOUR_API_KEY_HERE\":\n    #     raise ValueError(\"Please provide a valid Daytona API key.\")\n\nconfig = DaytonaConfig(api_key=api_key)\ndaytona = Daytona(config)\n\ntry:\n    # Create a sandbox\n    print(\"Creating Daytona sandbox...\")\n    sandbox = daytona.create()\n    print(f\"Created Sandbox ID: {sandbox.id}\")\n\n    # Run code securely inside the Sandbox\n    print(\"Running code in sandbox...\")\n    response = sandbox.process.code_run('print(\"Hello World from Daytona!\")')\n    print(f\"Code Output: {response.result}\")\n\n    # Optional: Execute a shell command\n    # shell_response = sandbox.process.exec(\"ls -la\")\n    # print(f\"Shell Command Output:\\n{shell_response.result}\")\n\nfinally:\n    # Clean up the sandbox (important to release resources)\n    if 'sandbox' in locals() and sandbox:\n        print(f\"Deleting Sandbox ID: {sandbox.id}...\")\n        sandbox.delete()\n        print(\"Sandbox deleted.\")\n","lang":"python","description":"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]"},"warnings":[{"fix":"Upgrade to v0.21.0+ and update sandbox creation calls to use `CreateSandboxFromSnapshotParams` for declarative provisioning, and configure resources via snapshots. Consult the official migration guide for details. [2]","message":"Major 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]","severity":"breaking","affected_versions":"<0.21.0"},{"fix":"When creating sandboxes, ensure resources are specified within the `CreateSandboxFromSnapshotParams` or other snapshot-related configurations. Direct `SandboxResources` configuration is deprecated. [2]","message":"Resource 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]","severity":"breaking","affected_versions":"<0.21.0"},{"fix":"Use `sandbox.delete()` for cleanup operations. Refer to the updated SDK documentation for current object structures and method calls. [2]","message":"Older 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]","severity":"deprecated","affected_versions":"<0.21.0"},{"fix":"Consider upgrading to v0.21.0 or newer to benefit from the Apache 2.0 license, which offers more flexibility for integration. [19]","message":"The 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]","severity":"gotcha","affected_versions":"<0.21.0"}],"env_vars":null,"search_vec":"'0.166.0':60 '1':64 '13':65 'activ':54 'agent':74 'ai':25,66 'ai-gener':24 'cloud':72 'code':27,49,76 'current':57 'daytona':1,4,13 'develop':67,75 'elast':20 'environ':36,71 'execut':35,50,70,77 'file':37 'generat':26 'git':40 'infrastructur':21 'interfac':30 'isol':34 'languag':42 'librari':11,52 'maintain':55 'manag':32 'offici':9 'open':16 'open-sourc':15 'oper':39,41 'process':47 'protocol':44 'provid':29 'python':5,10 'regular':62 'run':23 'sandbox':33,69 'sdk':2,6,73 'secur':18 'server':43 'sourc':17 'support':45 'system':38 'tool':68 'updat':63 'version':59","created_at":"2026-04-16T13:45:17.178507+00:00","updated_at":"2026-04-16T13:45:17.178507+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.187.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://www.daytona.io","github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/daytona-sdk/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","llm-agents","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-06-30","next_check":"2026-07-30","install_tag":null}}