Skip to main content

Agent frameworks & SDKs

Agno

Give Agno agents an isolated sandbox for code. Agno's official E2BTools toolkit runs the Python your agents write in E2B, not on the machine running Agno.

Maintained by
Agno
How it works
Built into agno as E2BTools
Package
agno
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 Agno project.

  1. 1.Install agno and e2b_code_interpreter using the project's package manager.
  2. 2.The toolkit 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 Agno guide at https://docs.e2b.dev/agents/agno and give my agents E2BTools with an explicit include_tools allowlist, so the Python they write runs in an E2B sandbox. Call shutdown_sandbox() in a finally block.
  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 dependencies

    uv pip install agno e2b_code_interpreter openai
  2. 2. Set your API keys

    export E2B_API_KEY="e2b_..."
    export OPENAI_API_KEY="..."
  3. 3. Give the toolkit to an agent

    from agno.agent import Agent
    from agno.models.openai import OpenAIResponses
    from agno.tools.e2b import E2BTools
    
    e2b_tools = E2BTools(
        timeout=600,
        sandbox_options={"allow_internet_access": False},
        include_tools=["run_python_code"],
    )
    
    agent = Agent(
        name="Code Execution Sandbox",
        model=OpenAIResponses(id="gpt-5.4-mini"),
        tools=[e2b_tools],
        instructions=[
            "Use the E2B sandbox to execute Python code for calculations.",
            "Verify the result before responding.",
        ],
    )
  4. 4. Run your agent

    try:
        agent.print_response(
            "Write Python code to generate the first 10 Fibonacci numbers."
        )
    finally:
        e2b_tools.shutdown_sandbox()

Security

What runs in the sandbox

The code your agents write runs in an isolated sandbox, away from the machine running Agno.

  • CodePython and commands the agent runs through E2BTools, executed in an E2B Code Interpreter sandbox.
  • Toolsinclude_tools limits which functions the agent can call. Leave out the host file-transfer helpers for untrusted agents.
  • LifetimeOne sandbox per E2BTools instance, reused across calls. timeout bounds it; shutdown_sandbox() ends it.
  • Networksandbox_options={"allow_internet_access": False} cuts outbound access when the task doesn't need it.

3B+ sandboxes started

Give every agent a machine