Skip to content

fix: update GkeCodeExecutor sandbox import from agentic_sandbox to k8s_agent_sandbox#4884

Closed
leslyarun wants to merge 1 commit intogoogle:mainfrom
leslyarun:fix/gke-sandbox-import-name
Closed

fix: update GkeCodeExecutor sandbox import from agentic_sandbox to k8s_agent_sandbox#4884
leslyarun wants to merge 1 commit intogoogle:mainfrom
leslyarun:fix/gke-sandbox-import-name

Conversation

@leslyarun
Copy link
Copy Markdown

Description

The k8s-agent-sandbox package renamed its Python module from agentic_sandbox to k8s_agent_sandbox in kubernetes-sigs/agent-sandbox#322 (merged Feb 18, 2026). The GkeCodeExecutor sandbox support added in #4111 (merged Mar 2, 2026) used the old module name, causing ImportError at runtime when using executor_type="sandbox".

Changes

src/google/adk/code_executors/gke_code_executor.py:

  • from agentic_sandbox import SandboxClientfrom k8s_agent_sandbox import SandboxClient (both runtime and TYPE_CHECKING imports)

Testing

Before fix:

from google.adk.code_executors import GkeCodeExecutor
executor = GkeCodeExecutor(namespace="test", executor_type="sandbox", sandbox_template="test")
# ImportError: k8s-agent-sandbox not found.

After fix:

from google.adk.code_executors import GkeCodeExecutor
executor = GkeCodeExecutor(namespace="test", executor_type="sandbox", sandbox_template="test")
# Works correctly

Fixes #4883

@google-cla
Copy link
Copy Markdown

google-cla bot commented Mar 18, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical ImportError encountered in the GkeCodeExecutor when attempting to use the sandbox executor type. The issue stemmed from a recent renaming of the Python module within the k8s-agent-sandbox dependency. By updating the import statements to use the new module name, this change ensures that the GkeCodeExecutor can correctly load and utilize the SandboxClient, restoring intended functionality.

Highlights

  • Import Path Update: Updated the SandboxClient import path from agentic_sandbox to k8s_agent_sandbox in GkeCodeExecutor to reflect a recent module rename in the k8s-agent-sandbox package.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly updates the import for SandboxClient from agentic_sandbox to k8s_agent_sandbox to fix an ImportError. I have one suggestion to refactor the import block to improve long-term maintainability.

…s_agent_sandbox

The k8s-agent-sandbox package renamed its module from `agentic_sandbox`
to `k8s_agent_sandbox` in kubernetes-sigs/agent-sandbox#322 (Feb 18, 2026).
The import in GkeCodeExecutor was added after the rename (Mar 2, 2026)
but used the old module name, causing ImportError at runtime when using
executor_type="sandbox".

Also consolidates the runtime and TYPE_CHECKING imports into a single
if/else block for maintainability.

Fixes google#4883
@leslyarun leslyarun force-pushed the fix/gke-sandbox-import-name branch from bb2df51 to 5781294 Compare March 18, 2026 18:32
@wuliang229
Copy link
Copy Markdown
Collaborator

Need to update the toml file as well. I will make a separate commit.

@wuliang229 wuliang229 closed this Mar 18, 2026
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.

GkeCodeExecutor sandbox mode: ImportError due to wrong module name (agentic_sandbox vs k8s_agent_sandbox)

2 participants