Skip to main content

adk_code/
compat.rs

1//! Migration compatibility guide.
2//!
3//! This module documents the migration path from the legacy `adk-code` types
4//! to the new `adk-sandbox` + redesigned `adk-code` types.
5//!
6//! ## Migration Guide
7//!
8//! | Old Type (deprecated) | New Type | Crate |
9//! |----------------------|----------|-------|
10//! | [`CodeExecutor`](crate::CodeExecutor) | [`SandboxBackend`](adk_sandbox::SandboxBackend) | `adk-sandbox` |
11//! | [`ExecutionRequest`](crate::ExecutionRequest) | [`ExecRequest`](adk_sandbox::ExecRequest) | `adk-sandbox` |
12//! | [`ExecutionResult`](crate::ExecutionResult) | [`ExecResult`](adk_sandbox::ExecResult) | `adk-sandbox` |
13//! | [`RustSandboxExecutor`](crate::RustSandboxExecutor) | [`RustExecutor`](crate::RustExecutor) | `adk-code` |
14//! | [`RustSandboxConfig`](crate::RustSandboxConfig) | [`RustExecutorConfig`](crate::RustExecutorConfig) | `adk-code` |
15//! | `RustCodeTool` (adk-tool) | [`CodeTool`](crate::CodeTool) | `adk-code` |
16//!
17//! ## Key API Differences
18//!
19//! ### `CodeExecutor` → `SandboxBackend`
20//!
21//! The old `CodeExecutor` trait had lifecycle methods (`start`, `stop`, `restart`,
22//! `is_running`) and a complex `ExecutionRequest` with `SandboxPolicy`. The new
23//! `SandboxBackend` trait is minimal: `execute(ExecRequest) -> Result<ExecResult, SandboxError>`.
24//!
25//! ### `ExecutionRequest` → `ExecRequest`
26//!
27//! The old `ExecutionRequest` had `payload` (enum with `Source` and `GuestModule`),
28//! `sandbox` (policy struct), `identity`, and `argv`. The new `ExecRequest` is flat:
29//! `language`, `code`, `stdin`, `timeout`, `memory_limit_mb`, `env`.
30//!
31//! ### `RustSandboxExecutor` → `RustExecutor`
32//!
33//! The old executor embedded isolation logic. The new `RustExecutor` delegates
34//! execution to a `SandboxBackend`, separating compilation from isolation.
35//! Constructor changes from `RustSandboxExecutor::default()` to
36//! `RustExecutor::new(backend, config)`.
37//!
38//! ## Timeline
39//!
40//! - **v0.5.0**: Old types deprecated with `#[deprecated]` attributes
41//! - **v0.6.0**: Old types removed