-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
tools[Component] This issue is related to tools[Component] This issue is related to tools
Description
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 kubernetesfrom 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:33doesfrom agentic_sandbox import SandboxClient- This fails because
k8s-agent-sandboxprovides the module ask8s_agent_sandbox, notagentic_sandbox SandboxClientbecomesNone_check_sandbox_dependencyvalidator raisesImportErroron 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 = NoneWorkaround
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
- PR execute-type param addition in GkeCodeExecutor #4111 (added
executor_type="sandbox"support) - k8s-agent-sandbox package: https://github.com/kubernetes-sigs/agent-sandbox/tree/main/clients/python/agentic-sandbox-client
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
tools[Component] This issue is related to tools[Component] This issue is related to tools