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.
pip install leap0-adkDependencies: google-adk, leap0 (Python SDK).
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.
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.
Runnable scripts live under examples/. They use Gemini via OpenRouter (OPENROUTER_API_KEY, pip install 'leap0-adk[openrouter]'). See examples/README.md.
| 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).
pip install -e ".[dev]"
pytestApache-2.0 (see LICENSE).