Skip to content

leap0-dev/leap0-adk-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages