Bug Description
GkeCodeExecutor with executor_type="sandbox" fails at instantiation because the code imports from agentic_sandbox import SandboxClient, but the declared dependency k8s-agent-sandbox provides the module as k8s_agent_sandbox.
Steps to Reproduce
pip install google-adk k8s-agent-sandbox kubernetes
from google.adk.code_executors import GkeCodeExecutor
executor = GkeCodeExecutor(
namespace="agent-sandbox-system",
executor_type="sandbox",
sandbox_template="python-code-sandbox",
sandbox_gateway_name="",
timeout_seconds=300,
cpu_limit="2",
mem_limit="2Gi",
)
Expected Behavior
GkeCodeExecutor should instantiate successfully when k8s-agent-sandbox is installed.
Actual Behavior
ImportError: k8s-agent-sandbox not found. To use Agent Sandbox, please install
google-adk with the extensions extra: pip install "google-adk[extensions]"
Even though k8s-agent-sandbox IS installed. The root cause:
gke_code_executor.py:33 does from agentic_sandbox import SandboxClient
- This fails because
k8s-agent-sandbox provides the module as k8s_agent_sandbox, not agentic_sandbox
SandboxClient becomes None
_check_sandbox_dependency validator raises ImportError on instantiation
Root Cause
The import name doesn't match the package's actual module name:
|
Expected by google-adk |
Actual in k8s-agent-sandbox |
| Import |
from agentic_sandbox import SandboxClient |
from k8s_agent_sandbox import SandboxClient |
| Module dir |
agentic_sandbox/ |
k8s_agent_sandbox/ |
| top_level.txt |
— |
k8s_agent_sandbox |
Verified on both k8s-agent-sandbox==0.1.1.post3 and 0.2.1 — neither provides an agentic_sandbox module.
Suggested Fix
Change the import in gke_code_executor.py:
# Before
try:
from agentic_sandbox import SandboxClient
except ImportError:
SandboxClient = None
# After
try:
from k8s_agent_sandbox import SandboxClient
except ImportError:
SandboxClient = None
Workaround
Create a shim module agentic_sandbox/__init__.py on PYTHONPATH:
from k8s_agent_sandbox import SandboxClient
__all__ = ["SandboxClient"]
Environment
- google-adk: 1.27.2
- k8s-agent-sandbox: 0.2.1
- Python: 3.13
- Kubernetes: GKE with Agent Sandbox controller + WarmPool
Related
Bug Description
GkeCodeExecutorwithexecutor_type="sandbox"fails at instantiation because the code importsfrom agentic_sandbox import SandboxClient, but the declared dependencyk8s-agent-sandboxprovides the module ask8s_agent_sandbox.Steps to Reproduce
Expected Behavior
GkeCodeExecutorshould instantiate successfully whenk8s-agent-sandboxis installed.Actual Behavior
Even though
k8s-agent-sandboxIS installed. The root cause:gke_code_executor.py:33doesfrom agentic_sandbox import SandboxClientk8s-agent-sandboxprovides the module ask8s_agent_sandbox, notagentic_sandboxSandboxClientbecomesNone_check_sandbox_dependencyvalidator raisesImportErroron instantiationRoot Cause
The import name doesn't match the package's actual module name:
from agentic_sandbox import SandboxClientfrom k8s_agent_sandbox import SandboxClientagentic_sandbox/k8s_agent_sandbox/k8s_agent_sandboxVerified on both
k8s-agent-sandbox==0.1.1.post3and0.2.1— neither provides anagentic_sandboxmodule.Suggested Fix
Change the import in
gke_code_executor.py:Workaround
Create a shim module
agentic_sandbox/__init__.pyonPYTHONPATH:Environment
Related
executor_type="sandbox"support)