Skip to main content

Leap0 plugin for Google ADK (sandbox, Python code interpreter, filesystem)

Project description

leap0-adk

Google ADK plugin for running Python in a Leap0 sandbox using the code interpreter, plus filesystem read, write, list, and delete. One sandbox is shared by all tools for the lifetime of the plugin.

Install

pip install leap0-adk

Dependencies: google-adk, leap0 (Python SDK).

Configuration

Set your Leap0 API key (or pass api_key= to Leap0Plugin):

export LEAP0_API_KEY="your-key"

Optional: LEAP0_BASE_URL if you use a non-default control plane.

Usage

Always delete the sandbox when your agent session ends so you do not leave sandboxes running.

import asyncio

from google.adk.agents import Agent
from google.adk.runners import InMemoryRunner
from leap0_adk import Leap0Plugin


async def main() -> None:
    plugin = Leap0Plugin()
    try:
        agent = Agent(
            model="gemini-2.0-flash",
            name="leap0_agent",
            tools=plugin.get_tools(),
        )
        async with InMemoryRunner(
            app_name="my_app",
            agent=agent,
            plugins=[plugin],
        ) as runner:
            await runner.run_debug(
                "Run Python: x = 40 + 2; print(x). Then write the result to /tmp/answer.txt and read it back."
            )
    finally:
        plugin.destroy_sandbox()
        await plugin.close()


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

destroy_sandbox() calls the Leap0 API to delete the sandbox. close() also deletes the sandbox and, if the plugin created the Leap0Client itself, closes the HTTP client.

Examples

Runnable scripts live under examples/. They use Gemini via OpenRouter (OPENROUTER_API_KEY, pip install 'leap0-adk[openrouter]'). See examples/README.md.

Tools

Tool Purpose
execute_code_in_leap0 Python via code_interpreter.execute (optional context_id, timeout_ms, env_vars)
leap0_fs_read Read UTF-8 file (path, optional offset / limit / head / tail)
leap0_fs_write Write UTF-8 file (path, content, optional permissions)
leap0_fs_list Directory listing (path, optional recursive, exclude)
leap0_fs_delete Delete file or directory (path, optional recursive)

TypeScript/JavaScript execution is not exposed in this version (Python only).

Development

pip install -e ".[dev]"
pytest

License

Apache-2.0 (see LICENSE).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

leap0_adk-0.1.0.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

leap0_adk-0.1.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file leap0_adk-0.1.0.tar.gz.

File metadata

  • Download URL: leap0_adk-0.1.0.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for leap0_adk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cf5ef9fc29cf691ae23492cc8176353b45c65b6e72cf0f8e2cb8afac8f86ee64
MD5 b5e18e19a3299e6ae910067a043ed454
BLAKE2b-256 7607e73cd910444b83152bcbb59a8c67631a2417d42d159dd1a8df71de9fe996

See more details on using hashes here.

Provenance

The following attestation bundles were made for leap0_adk-0.1.0.tar.gz:

Publisher: release.yml on leap0-dev/leap0-adk-plugin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file leap0_adk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: leap0_adk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for leap0_adk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d84214e5334281cb69ee16e1f8ca6b7109bb9d98237e11fbb1d90cfd07838ae8
MD5 3001f7f6745b4c57318aa9947a36b3bf
BLAKE2b-256 57ffeb5781ff096166febb96055cb4b3b369fef8e8f1141a644d4ab3650a534c

See more details on using hashes here.

Provenance

The following attestation bundles were made for leap0_adk-0.1.0-py3-none-any.whl:

Publisher: release.yml on leap0-dev/leap0-adk-plugin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page