Skip to content

Feat: Agent Engine Sandbox Code Executor#317

Open
AmaadMartin wants to merge 14 commits into
google:mainfrom
AmaadMartin:feat/vertex-ai-sandboxes
Open

Feat: Agent Engine Sandbox Code Executor#317
AmaadMartin wants to merge 14 commits into
google:mainfrom
AmaadMartin:feat/vertex-ai-sandboxes

Conversation

@AmaadMartin
Copy link
Copy Markdown
Collaborator

@AmaadMartin AmaadMartin commented Apr 29, 2026

Link to Issue or Description of Change

If no issue exists, describe the change:
Ported agent_engine_sandbox_code_executor from adk-python to adk-js to support executing code generated by agents in a secure sandbox environment using Vertex AI.

Problem: Need to support executing code generated by agents in a secure sandbox environment using Vertex AI in the JS SDK, matching the feature available in the Python SDK.

Solution: Implemented AgentEngineSandboxCodeExecutor in TypeScript, leveraging @google-cloud/vertexai's API for sandbox management and code execution. The implementation handles session state to reuse sandboxes when possible and falls back to creating new ones if needed or expired.

Testing Plan
Please describe the tests that you ran to verify your changes. This is required for all PRs that are not small documentation or typo fixes.

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.
    Summary of passed tests:
  • 25 unit tests passed in core/test/code_executors/agent_engine_sandbox_code_executor_test.ts.
  • Achieved 100% line and branch coverage for agent_engine_sandbox_code_executor.ts (based on coverage report showing 100% for the file in the code_executors directory).

Manual End-to-End (E2E) Tests:

  • Added integration test tests/integration/agents/agent_with_sandbox_executor_test.ts which verifies the integration of the executor with an LLM agent.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

Additional context
This depends on the Agent Engine Session Service PR

@AmaadMartin AmaadMartin force-pushed the feat/vertex-ai-sandboxes branch 3 times, most recently from d4384b4 to fc2381f Compare April 29, 2026 21:55
@AmaadMartin AmaadMartin force-pushed the feat/vertex-ai-sandboxes branch from fc2381f to a740804 Compare May 8, 2026 20:36
data: file.content, // Assumed to be already base64 encoded based on CodeExecutionInput definition
metadata: {
attributes: {
file_name: Buffer.from(file.name).toString('base64'),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to encode that to base64?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Vertex AI SDK expects Chunk objects for input which include base64 encoded data.

@AmaadMartin AmaadMartin force-pushed the feat/vertex-ai-sandboxes branch from 6461335 to f969164 Compare May 11, 2026 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants