Skip to main content

daytona-adk

Google ADK plugin for secure code execution in Daytona sandboxed environments. This plugin enables ADK agents to execute Python, JavaScript, and TypeScript code, run shell commands, upload scripts and datasets, and read outputs from files in isolated sandboxes.

Installation

pip install daytona-adk

This release uses the Daytona SDK 2.x v0 namespace (daytona[v0-sdk]>=2,<3). If your code also uses the daytona SDK directly, move those imports and calls to daytona.v0 as well: one Python environment can only hold one daytona version.

Self-hosted / custom API URL: SDK 2.x targets Daytona Cloud only. If you need a custom API URL (self-hosted Daytona), stay on the last release built on Daytona SDK 0.x: pip install "daytona-adk<1".

Configuration

You must configure credentials for both Daytona (sandbox infrastructure) and Google Gemini (the LLM model used by ADK agents).

Daytona API Key

Get your API key from Daytona Dashboard.

You can configure it in one of three ways:

  1. Set the DAYTONA_API_KEY environment variable:

    export DAYTONA_API_KEY="your-daytona-api-key"
    
  2. Add it to a .env file in your project root:

    DAYTONA_API_KEY=your-daytona-api-key
    
  3. Pass the API key directly when instantiating DaytonaPlugin:

    from daytona_adk import DaytonaPlugin
    
    plugin = DaytonaPlugin(api_key="your-daytona-api-key")
    

Google API Key (for Gemini LLM)

Get your API key from Google AI Studio.

This key is required to access Google's Gemini models (e.g., gemini-2.0-flash, gemini-1.5-pro).

You need to set it as an environment variable:

export GOOGLE_API_KEY="your-google-api-key"

Or add it to your .env file:

GOOGLE_API_KEY=your-google-api-key

Quick Start

import asyncio
from google.adk.agents import Agent
from google.adk.runners import InMemoryRunner
from daytona_adk import DaytonaPlugin


async def main():
    # Create the Daytona plugin
    plugin = DaytonaPlugin()

    # Create an agent with Daytona tools
    agent = Agent(
        model="gemini-2.0-flash",
        name="agent_with_sandbox",
        tools=plugin.get_tools(),
    )

    # Run with InMemoryRunner
    async with InMemoryRunner(
        app_name="my_app",
        agent=agent,
        plugins=[plugin],
    ) as runner:
        response = await runner.run_debug(
            "Execute this Python code: print('Hello from Daytona!')"
        )
        print(response)


if __name__ == "__main__":
    asyncio.run(main())

Usage Patterns

from google.adk.agents import Agent
from google.adk.apps import App
from google.adk.runners import InMemoryRunner
from daytona_adk import DaytonaPlugin

plugin = DaytonaPlugin()

agent = Agent(
    model="gemini-2.0-flash",
    name="agent_with_sandbox",
    tools=plugin.get_tools(),
)

app = App(
    name="my_app",
    root_agent=agent,
    plugins=[plugin],
)

async with InMemoryRunner(app=app) as runner:
    response = await runner.run_debug("Execute Python: print('Hello!')")

Using with Runner Directly

from google.adk.agents import Agent
from google.adk.runners import InMemoryRunner
from daytona_adk import DaytonaPlugin

plugin = DaytonaPlugin()

agent = Agent(
    model="gemini-2.0-flash",
    name="agent_with_sandbox",
    tools=plugin.get_tools(),
)

async with InMemoryRunner(
    app_name="my_app",
    agent=agent,
    plugins=[plugin],
) as runner:
    response = await runner.run_debug("Run command: echo 'Hello!'")

Available Tools

The plugin provides the following tools to ADK agents:

Tool Description
execute_code_in_daytona Execute Python, JavaScript, or TypeScript code
execute_command_in_daytona Run shell commands
upload_file_to_daytona Upload scripts or data files to the sandbox
read_file_from_daytona Read script outputs or generated files
start_long_running_command_daytona Start background processes (servers, watchers)

Tool Parameters

execute_code_in_daytona

  • code (required): The code snippet to execute
  • language (required): Programming language - python (default), javascript, or typescript
  • env: Environment variables as key-value pairs
  • argv: Command line arguments
  • timeout: Timeout in seconds

execute_command_in_daytona

  • command (required): The shell command to execute
  • cwd: Working directory
  • env: Environment variables
  • timeout: Timeout in seconds

upload_file_to_daytona

  • file_path (required): Destination path for the file
  • content (required): File content to upload

read_file_from_daytona

  • file_path (required): Path of the file to read

start_long_running_command_daytona

  • command (required): The command to start
  • timeout: Timeout in seconds

Plugin Configuration

DaytonaPlugin(
    api_key="your-api-key",           # Daytona API key (or use DAYTONA_API_KEY env var)
    plugin_name="daytona_plugin",     # Plugin identifier
    sandbox_name="my-sandbox",        # Optional sandbox name
    env_vars={"KEY": "value"},        # Environment variables for the sandbox
    labels={"env": "dev"},            # Custom labels
    auto_stop_interval=15,            # Auto-stop after N minutes (0 to disable)
    auto_delete_interval=60,          # Auto-delete stopped sandbox after N minutes
)

Examples

See the examples/ directory for complete working examples:

Usage Patterns:

Specific Use Cases:

Architecture

packages/adk-plugin/
├── daytona_adk/
│   ├── __init__.py           # Package exports
│   ├── plugin.py             # DaytonaPlugin (extends BasePlugin)
│   └── tools.py              # ADK tool implementations
├── examples/
│   ├── patterns/
│   │   ├── with_app.py       # App pattern example
│   │   └── with_runner.py    # Runner pattern example
│   ├── multi_language_execution.py  # Multi-language code execution
│   ├── file_operations.py           # Script upload and file reading
│   └── long_running_process.py      # Background process management
├── tests/
│   └── test_tools.py         # Tool unit tests
└── pyproject.toml

Key Components

  1. DaytonaPlugin: Extends BasePlugin

    • Creates and manages sandbox lifecycle
    • Provides tools via get_tools()
    • Implements lifecycle callbacks
  2. Tools: ADK tool implementations using BaseTool

    • Each tool wraps Daytona SDK operations
    • Shared sandbox instance for state persistence

License

Apache 2.0 - See LICENSE file for details.

References

Metadata

Release files for daytona-adk 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for daytona-adk 1.0.0
File Size Uploaded Provenance Actions
daytona_adk-1.0.0.tar.gz 16.9 kB With provenance Details for daytona_adk-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for daytona-adk 1.0.0
File Interpreter ABI Platform Actions
daytona_adk-1.0.0-py3-none-any.whl Python 3 none any Details for daytona_adk-1.0.0-py3-none-any.whl

Total release size: 29.7 kB

Release files / daytona_adk-1.0.0.tar.gz

Download URL daytona_adk-1.0.0.tar.gz
Size 16.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8485895a584578d3676abb4f92e2c0af60b6cf6b64babb32fabe758a98a442b7
BLAKE2b-256 checksum
How to use checksums
b9e8a303f3e3d425d5d0c6a6a24a91cb5512f37e5ffe8b9901bb14a83c2a09a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / daytona_adk-1.0.0-py3-none-any.whl

Download URL daytona_adk-1.0.0-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa9495523ec53ca86de2bb0e256e19d758261c119433ad5a77aab9ebc8f63fd2
BLAKE2b-256 checksum
How to use checksums
606c2a02e9a320fd8a890081537bec3bf35b986f4bf8a18168939eb21f71acff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for daytona-adk 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for daytona_adk-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page