From 5781294cc506495acb527ae9db1acc82c0a2369e Mon Sep 17 00:00:00 2001 From: "lesly.franco" <5101854+leslyarun@users.noreply.github.com> Date: Thu, 19 Mar 2026 00:02:43 +0530 Subject: [PATCH] fix: update GkeCodeExecutor sandbox import from agentic_sandbox to k8s_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 #4883 --- src/google/adk/code_executors/gke_code_executor.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/google/adk/code_executors/gke_code_executor.py b/src/google/adk/code_executors/gke_code_executor.py index b44aa19357..fb4d160d84 100644 --- a/src/google/adk/code_executors/gke_code_executor.py +++ b/src/google/adk/code_executors/gke_code_executor.py @@ -29,13 +29,13 @@ from .code_execution_utils import CodeExecutionInput from .code_execution_utils import CodeExecutionResult -try: - from agentic_sandbox import SandboxClient -except ImportError: - SandboxClient = None - if TYPE_CHECKING: - from agentic_sandbox import SandboxClient + from k8s_agent_sandbox import SandboxClient +else: + try: + from k8s_agent_sandbox import SandboxClient + except ImportError: + SandboxClient = None # Expose these for tests to monkeypatch. client = k8s.client