feat(integrations): Add E2BEnvironment for remote sandbox workspaces#6031
feat(integrations): Add E2BEnvironment for remote sandbox workspaces#6031Jacksunwei wants to merge 1 commit into
Conversation
|
Response from ADK Triaging Agent Hello @Jacksunwei, thank you for creating this PR! This is a great feature! To help get this reviewed and merged more smoothly, please address the following items in accordance with our contribution guidelines:
This information will help reviewers evaluate your PR more efficiently. Thanks again for your contribution! |
🔍 ADK Pull Request Analysis: PR #6031Title: feat(integrations): Add E2BEnvironment for remote sandbox workspaces Executive Summary
Detailed Findings & Analysis1. Objectives & Impact ("What does it do?")
2. Justification & Value ("Is it a valid and useful change?")
3. Principle & Style Alignment Checklist ("Does it follow rules?")
🛑 Review Decision GateI have completed my in-depth analysis of Pull Request #6031. Please review the findings above. How would you like to proceed with this Pull Request?
|
Provide a BaseEnvironment backed by an E2B sandbox, giving agents a persistent remote workspace for shell execution, file CRUD, and on-demand installs (pip/apt) without touching the host machine. The sandbox TTL is bounded to cap credit usage and is extended on each operation; an expired idle sandbox is transparently recreated.
Requires the new `e2b` extra. Includes a data-analysis sample that downloads a public dataset and analyzes it inside the sandbox.
from google.adk.integrations.e2b import E2BEnvironment
from google.adk.tools.environment import EnvironmentToolset
toolset = EnvironmentToolset(environment=E2BEnvironment())
Merge #6031 > **Stacked on #6030** (`fix/experimental-typing`). This PR targets that branch; please review/merge #6030 first, after which this will be retargeted to `main`. ## Summary Adds `E2BEnvironment`, a `BaseEnvironment` backed by an [E2B](https://e2b.dev) sandbox. It gives agents a persistent remote workspace for shell execution, file CRUD, and on-demand installs (`pip`/`apt`) without touching the host machine. - The sandbox TTL is bounded to cap credit usage and is extended on each operation; an expired idle sandbox is transparently recreated. - Lazy-imports the SDK behind a new `e2b` extra, so the base package stays lean. - Includes a data-analysis sample that downloads a public (GCS-hosted) dataset and analyzes it inside the sandbox. ## Usage ```python from google.adk.integrations.e2b import E2BEnvironment from google.adk.tools.environment import EnvironmentToolset toolset = EnvironmentToolset(environment=E2BEnvironment()) ``` ## Test plan - [x] `pytest tests/unittests/integrations/e2b/` (14 passed) - [x] `pyright src/google/adk/integrations/e2b/_e2b_environment.py` — 0 errors - [x] Sample agent loads (`contributing/samples/environment_and_skills/e2b_environment`) - [ ] Manual run against a live E2B sandbox (requires `E2B_API_KEY`) Co-authored-by: Wei Sun (Jack) <weisun@google.com> COPYBARA_INTEGRATE_REVIEW=#6031 from google:feat/e2b f2b5584 PiperOrigin-RevId: 929443164
|
Thank you @Jacksunwei for your contribution! 🎉 Your changes have been successfully imported and merged via Copybara in commit 92d608f. Closing this PR as the changes are now in the main branch. |
Summary
Adds
E2BEnvironment, aBaseEnvironmentbacked by an E2B sandbox. It gives agents a persistent remote workspace for shell execution, file CRUD, and on-demand installs (pip/apt) without touching the host machine.e2bextra, so the base package stays lean.Usage
Test plan
pytest tests/unittests/integrations/e2b/(14 passed)pyright src/google/adk/integrations/e2b/_e2b_environment.py— 0 errorscontributing/samples/environment_and_skills/e2b_environment)E2B_API_KEY)