Skip to main content

Agent frameworks & SDKs

Google ADK

Give Google ADK agents an isolated sandbox for code, shell commands and files. Use ADK's built-in E2BEnvironment, or the e2b-⁠adk plugin to hand the model ready-made sandbox tools.

Maintained by
E2B
How it works
Built into ADK, plus a plugin
Package
e2b-adk
Language
Python

Set it up

Get started

Paste the prompt into your coding agent, or follow the steps yourself.

Paste this into your coding agent

Add E2B sandboxes to this Google ADK project.

  1. 1.Install e2b-adk using the project's package manager.
  2. 2.The plugin needs the E2B_API_KEY environment variable. If it isn't set, ask me for my API key from https://console.e2b.dev/?tab=keys. Never hardcode it.
  3. 3.Follow the Google ADK guide at https://docs.e2b.dev/agents/google-adk. Create an E2BPlugin, give my agent plugin.get_tools(), and register the plugin on the App so the runner creates and closes the sandbox.
  4. 4.Run the agent once and show me the output that came from the sandbox.

Or set it up yourself

  1. 1. Install the plugin

    pip install e2b-adk
  2. 2. Set your API keys

    export E2B_API_KEY="..."
    export GOOGLE_API_KEY="..."
  3. 3. Create the plugin and agent

    from google.adk.agents import Agent
    from google.adk.apps import App
    
    from e2b_adk import E2BPlugin
    
    plugin = E2BPlugin()
    agent = Agent(
        model="gemini-2.5-flash",
        name="data_analyst",
        instruction="You are a data analyst. Compute numbers by running real pandas with run_code.",
        tools=plugin.get_tools(),
    )
    app = App(name="data_analysis", root_agent=agent, plugins=[plugin])
  4. 4. Run the agent

    from google.adk.runners import InMemoryRunner
    
    DATASET = """month,region,marketing_spend,revenue
    2024-01,North,12000,48000
    2024-02,North,15000,61000
    2024-01,South,8000,26000
    2024-02,South,11000,30000"""
    
    async with InMemoryRunner(app=app) as runner:
        await runner.run_debug(
            f"Here is marketing spend and revenue as CSV:\n\n{DATASET}\n\n"
            "Save it to sales.csv, then tell me which region converts spend into "
            "revenue more efficiently and which month performed best."
        )

Security

What runs in the sandbox

Tool calls your agent makes run in an isolated sandbox, away from the machine running ADK.

  • Coderun_code runs code in a stateful kernel, so variables persist across calls.
  • ToolsSix tools share one sandbox: run_code, run_command, write_file, read_file, list_files and start_background_command.
  • LifetimeThe plugin creates the sandbox on the first tool call and kills it when the runner closes. Each call extends the timeout.
  • Idle gapsPass lifecycle with on_timeout pause and auto_resume to keep the sandbox across gaps longer than timeout.

3B+ sandboxes started

Give every agent a machine