Expand description
Choosing between the two code-execution layers.
Code execution has two layers. Both are supported; neither is deprecated.
| Layer | Backend trait | Request and result | Built on it |
|---|---|---|---|
adk-sandbox | SandboxBackend | ExecRequest, ExecResult | RustExecutor, CodeTool, adk_sandbox::SandboxTool |
adk-code | CodeExecutor | ExecutionRequest, ExecutionResult, with a SandboxPolicy | RustSandboxExecutor, ContainerCommandExecutor, the embedded JavaScript and Monty executors, and adk-tool’s PythonCodeTool and JavaScriptCodeTool |
§Key API Differences
§SandboxBackend and CodeExecutor
CodeExecutor has lifecycle methods (start, stop, restart, is_running), reports
BackendCapabilities, and takes an ExecutionRequest whose
SandboxPolicy it validates against them. SandboxBackend is minimal:
execute(ExecRequest) -> Result<ExecResult, SandboxError>, with isolation coming from
the backend, such as a ProcessBackend under an OS enforcer.
§ExecutionRequest and ExecRequest
ExecutionRequest has payload (an enum with Source and GuestModule), sandbox
(the policy), identity, and argv. ExecRequest is flat: language, code,
stdin, timeout, memory_limit_mb, env.
§RustSandboxExecutor and RustExecutor
RustSandboxExecutor compiles and runs Rust as host processes. RustExecutor delegates
execution to a SandboxBackend, separating compilation from isolation; construct it
with RustExecutor::new(backend, config).
§Removed
adk-tool’s RustCodeTool was removed; CodeTool replaces it.