Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .agents/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# `.agents/` — engineering record of the python-sdk repository

## Alibaba Cloud Container Edition Python Provider

[Design](notes/proposed/architecture/2026-11-24-alicloud-container-native-provider.md) · [Initial verification](evidence/verify/2026-11-24-alicloud-container-native-provider.md) · [Follow-up review and verification](evidence/verify/2026-11-24-alicloud-container-native-provider-recheck.md).

## Recent changes — 2026-11-10

- [Owner change index](notes/proposed/process/2026-11-10-recent-change-index.md) · [records verification](evidence/verify/2026-11-10-recent-change-index.md).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Verification: Container Edition Python Provider follow-up review

- Date: 2026-11-24
- Change: [PR #168](https://github.com/Alibaba-Agent-Sandbox/python-sdk/pull/168), reviewed starting revision `ab789cc27b77160aa1e9cc7f6419461fb5e0ccfc` and its follow-up patch
- Result: BLOCKED for live ACS/ACK acceptance
- Package under test: Client and Server SDK 0.4.0a7 from source, and locally built distributions
- Environment: Debian 13, Python 3.12.15

## What was verified

Two independent reviews checked the Container Edition routes and SDK behavior, and checked the user guides and acceptance prerequisites. The review traced the E2B interpreter's [HTTP route](https://github.com/e2b-dev/code-interpreter/blob/db9fdb1cfe6552455d58b1690971bdd3052538c6/template/server/main.py#L81-L129) into its [response wrapper](https://github.com/e2b-dev/code-interpreter/blob/db9fdb1cfe6552455d58b1690971bdd3052538c6/template/server/stream.py#L34-L40). The wrapper emits the public `end_of_execution` event even though the inner iterator consumes its own completion message. Executing the original parser on a well-formed result-only response returned exit code zero. The follow-up rejects responses without completion, with regressions for both gateway layouts.

## Commands run

- From `client-sdk`: `pytest -q tests/test_providers/test_alicloud_container.py tests/test_providers/test_bound_client.py tests/test_providers/test_registry_scoping.py tests/test_providers/test_engine_alicloud_container.py`
- From the repository root: `python -m pytest e2e/test_alicloud_container_native.py e2e/test_08_providers.py -k 'alicloud_container_native or container_refuses_without' -ra`
- `make lint format-check typecheck` and `make build dist-check`
- Installed only the built Client SDK wheel in a fresh environment. Used a private-route HTTP fixture in an isolated loopback namespace with an empty executable search path. The fixture returned a completed and an incomplete interpreter response, then accepted deletion and returned 404 for the owned ID.
- `make ci` through the server test stage and `pytest -q -m "not integration"` in `client-sdk` with isolated loopback. Repeated the two failed client cases against `ab789cc` and in an isolated PID namespace on the patched revision.
- `bash scripts/check-repo-health.sh`, `make hygiene` and `git diff --check`

## Results

| Scenario | Result | Notes |
| --- | --- | --- |
| Provider, bound client and registry tests | PASS | 47 passed, 4 external-engine cases skipped. The new result-only NDJSON regression rejects incomplete responses. |
| Provider credential refusal | PASS | One case passed without a configured Container Edition cluster. |
| Live lifecycle and interpreter cases | BLOCKED | Two cases skipped before I/O. No Container Edition manager endpoint or Key was available from the workspace configuration or process environment. |
| Lint, formatting, types and distributions | PASS | Both packages checked. Wheel-only imports and a local HTTP packaging probe passed. |
| Installed client wheel and private HTTP route | PASS | Verified both credential audiences, completion and truncation rejection, and deletion by ID. Fixture backend. |
| Local Server unit suite | PASS | 875 passed and one skipped with isolated loopback. |
| Local Client unit suite | PARTIAL | 2,459 passed, 36 skipped, 10 deselected, and two Managed Agents timing or process-domain assertions failed with a shared PID namespace. Both reproduced at `ab789cc` and passed with isolated PIDs on the patched revision. |

## Cleanup

The targeted tests used controlled transports or locally owned test processes. The live cases made no requests. No cloud resources were created.

## Problems found

The previous interpreter fixture used HTTP EOF as a success signal. The review also found that the initial guide required Jupyter for basic use and that the provider E2E credential-refusal check assumed the container provider was an external plugin. The guides now show basic and interpreter usage separately. The live test distinguishes an ordinary SandboxSet from an interpreter SandboxSet, uses cluster-specific credential masking, and verifies absence of returned IDs against that cluster. Its cleanup does not prove absence for a create that returned no ID.

## Not verified

Live ACS/ACK acceptance requires an existing cluster manager endpoint, its cluster Key and a SandboxSet for each selected case. The prerequisite [PR #167](https://github.com/Alibaba-Agent-Sandbox/python-sdk/pull/167) also remains a draft. No artifacts were released.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Verification: native Python Provider for Alibaba Cloud Container Edition

- Date: 2026-11-24
- PR: [#168](https://github.com/Alibaba-Agent-Sandbox/python-sdk/pull/168)
- Change: `2026-11-24-alicloud-container-native-provider`; stacked on [PR #167](https://github.com/Alibaba-Agent-Sandbox/python-sdk/pull/167) at `0f229aa8b28c45f1c2998947acbff9857e411310`
- Result: BLOCKED for ACS/ACK acceptance
- Package under test: editable Client SDK and Server SDK 0.4.0a7 development checkout
- Environment: Python 3.12 on Linux; no Container Edition cluster key or target was available in the existing workspace and SDK configuration

## What was verified

The native Provider is reached by both Python entry points. Contract tests run lifecycle calls, two gateway layouts, separate credentials, versioned connect and timeout, terminal-aware process execution, file I/O and default-context Jupyter. They exercise the SDK HTTP client with a test transport.

## Commands run

- `pytest -q tests/test_providers/test_alicloud_container.py tests/test_providers/test_bound_client.py tests/test_providers/test_registry_scoping.py` from `client-sdk`
- `make lint`, `make format-check`, `make typecheck`, `make build`, and `make dist-check`
- `bash scripts/check-repo-health.sh` and `make hygiene`
- `make test` in an isolated loopback network; ran the Client suite separately after the Server failure
- `pytest -q --tb=short -m "not integration"` from `client-sdk` with isolated loopback
- Re-ran the failing Server package probe with pip installed and compared the failing Client SSE test against the PR #167 base with isolated loopback and PID namespace
- `pytest -q test_alicloud_container_native.py` from `e2e`

## Results

| Scenario | Result | Notes |
| --- | --- | --- |
| Native and private routing, auth, write uncertainty, teardown | PASS | 47 targeted tests including bound and registry regressions. Controlled HTTP backend. |
| Installed Client wheel over loopback HTTP | PASS | Created one fixture sandbox, streamed a framed command, wrote and read a file, executed Jupyter and verified the deletion. The isolated process had no binaries on its PATH and installed the client wheel only. |
| Lint, format, mypy, distribution and records | PASS | Both package wheels and source archives build and pass distribution checks. |
| Full Server unit suite | PARTIAL | 879 passed; the package-list probe initially failed in a uv environment without pip. Installing pip and repeating the probe passed. |
| Full Client unit suite | PARTIAL | 2,467 passed, 35 skipped, 10 deselected, one Managed Agents SSE test timed out. The timeout reproduced against the PR #167 baseline. |
| Review round 1 | PASS | Reviewed lifecycle, framing, credential audiences and direct wheel integration against the pinned providers. |
| Review round 2 | PASS | Corrected legacy connect timeout, signaled exits, public Jupyter NDJSON ending, refresh omission semantics and plugin install validation. |
| ACS/ACK E2E | BLOCKED | One targeted test skipped. A cluster endpoint and its sandbox-manager key are required. |

## Cleanup

The local HTTP contract owned no remote resources. The isolated wheel probe shut down its loopback server after checking deletion. The live test skipped before making requests.

## Problems found

The Kruise manager reports a fixed envd version. Framing follows its actual Connect implementation. Older connect routes require an explicit timeout. The Jupyter HTTP response suppresses its internal completion message; the reader processes complete HTTP responses, and errors or malformed JSON are surfaced. A second audit found the bundled selection could shadow install verification of the Node plugin and corrected it.

## Not verified

Real ACS or ACK lifecycle, cluster-specific admission and internet/private ingress, and deployment-side SandboxSet operations. No package publication occurred.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Decision: Bundle the Alibaba Cloud Container Edition Python Provider

Status: proposed

## Problem

Python applications using an ACS or ACK sandbox-manager currently use the Node plugin through the local abx engine. The cluster offers a direct HTTP control plane and E2B-shaped data plane. The client should be able to operate existing SandboxSets without installing a second local runtime.

## Decision

Ship `alicloud-container` in the Client SDK wheel and select it by ID. Bound preparation resolves the shipped Provider directly and matches the lock version before selecting other approved artifacts. Keep the default Express target. The abx catalog plugin continues to own its Node execution and SandboxSet preparation. The Python plugin installation verifier checks the artifact it was asked to install, even where an SDK Provider also has that ID.

Reuse the existing HTTP, Connect process and file implementations. Keep account configuration, routing, lifecycle request shapes and the Jupyter endpoint in the Container Edition adapter. Scope the management key to the control plane. Derive all data URLs from the configured cluster gateway. An existing SandboxSet supplies the base compute configuration.

## API Design

- `ProviderSandbox.create(provider="alicloud-container", template="code-interpreter")` reads provider-scoped settings from the usual Client SDK configuration sources.
- `ProviderClient.prepare(lock, TransportConfig(...))` binds the shipped version using explicit provider options.
- Methods cover lifecycle, timeout, process and file operations, port resolution and the Jupyter default context. `connect` may resume or extend a lease. List returns one page.
- Jupyter execution checks the completion event emitted by the public `/execute` response wrapper. A response without that event raises a protocol error.
- Sandbox creation can be inconclusive after an upstream transport failure or gateway 5xx. `on_created` records IDs from valid receipts. Reconcile uncertain creation in the cluster before a new request.

## Alternatives considered

- Keep the Node bridge for Python. It preserves one host implementation but adds a separate process and runtime for a backend already within the SDK's HTTP capabilities.
- Add the Container gateway to the standard Express client. The management credentials, private data routing, connect and code contracts differ.
- Use a declarative REST preset. The preset cannot express the versioned connect behavior, path routing and Jupyter protocol.

## Dependencies

[Alibaba Cloud Container Edition guide](https://help.aliyun.com/zh/agent-sandbox/quick-start1/), [OpenKruise lifecycle](https://github.com/openkruise/agents/blob/25106aaaf6a73770b1ae1ee2cc0a06d6610cf279/pkg/servers/e2b/pause_resume.go), [OpenKruise v0.6.0 route table](https://github.com/openkruise/agents/blob/a1e0811323b71fd9a54efe26b0f4baf19106c84e/pkg/servers/e2b/routes.go), [OpenKruise listing](https://github.com/openkruise/agents/blob/25106aaaf6a73770b1ae1ee2cc0a06d6610cf279/pkg/servers/e2b/list.go) and [Jupyter response producer](https://github.com/e2b-dev/code-interpreter/blob/db9fdb1cfe6552455d58b1690971bdd3052538c6/template/server/messaging.py). Shares bound-client infrastructure with [PR #167](https://github.com/Alibaba-Agent-Sandbox/python-sdk/pull/167).

## Test Strategy

Validate both gateway layouts using the real SDK HTTP client with a controlled HTTP contract. Exercise management and data-plane authentication, v2 and v1 connect, list state, file transfers, Jupyter NDJSON, process exits, identity checks and ambiguous creates. Run the basic live case against a maintainer-provided ACS or ACK cluster and confirm deletion by ID. Run the separate interpreter case with a SandboxSet that exposes the Jupyter service.

## Acceptance criteria

The client wheel contains the Provider and requires no Node runtime. Both public Python entry points use it without starting the engine. The cluster test proves real commands, files, interpreter results and owned sandbox cleanup. Keep live acceptance open until a cluster with a suitable SandboxSet and credential is available.

## Evidence

- [Implementation and two-round review evidence](../../../evidence/verify/2026-11-24-alicloud-container-native-provider.md)
- [Follow-up review and verification evidence](../../../evidence/verify/2026-11-24-alicloud-container-native-provider-recheck.md)
8 changes: 7 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Agent Sandbox environment variables.
# Copy to .env and fill in real values. Each key has one name.

# Required: sandbox API key
# Required for Express: sandbox API key
ABX_SANDBOX_API_KEY=your_api_key_here

# Optional: platform URL and data-plane domain
Expand All @@ -11,6 +11,12 @@ ABX_SANDBOX_API_KEY=your_api_key_here
# Optional: provider (default alicloud-express)
# ABX_PROVIDER=alicloud-express

# Container Edition: specify the cluster manager key and a domain or management URL.
# ABX_ALICLOUD_CONTAINER_API_KEY=
# ABX_ALICLOUD_CONTAINER_DOMAIN=sandbox.example.com
# ABX_ALICLOUD_CONTAINER_BASE_URL=https://sandbox.example.com/kruise/api
# ABX_ALICLOUD_CONTAINER_PROTOCOL=private

# Optional: Alibaba Cloud official names
# ALIBABA_CLOUD_REGION_ID=cn-hangzhou
# ALICLOUD_ACCESS_KEY_ID=your_ak
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

## [Unreleased]

### Added

- Bundle a native Python Provider for Alibaba Cloud Agent Sandbox Container Edition.
`ProviderSandbox` selects it by ID, and `ProviderClient` can bind the matching bundled version.
/ 内置阿里云智能体沙箱容器版 Python Provider,支持按 ID 选择和显式绑定。

### Fixed

- Report incomplete Container Edition interpreter responses as protocol errors. / 容器版解释器响应缺少执行完成事件时报告协议错误。

### Documentation

- Synchronize CLI-dependent SDK documentation, HTTP MCP template deployment and source-acquisition error guidance. / 同步 SDK 文档中的 CLI 用法、HTTP MCP 模板部署与源码获取错误指引。
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Use `await` with `AsyncSandbox` and `ProviderSandbox`. Provider operations and i

## Other providers and application templates

Express is built in. Installable [provider plugins](https://github.com/Alibaba-Agent-Sandbox/awesome-providers) connect `ProviderSandbox` to other backends. Follow [provider setup](docs/en/guide/providers.md) before using one.
Express is built in. The SDK source also includes a native [Container Edition provider](docs/en/design/provider-alicloud-container.md). Installable [provider plugins](https://github.com/Alibaba-Agent-Sandbox/awesome-providers) connect `ProviderSandbox` to other backends. Follow [provider setup](docs/en/guide/providers.md) before using one.

Application templates package browser tools, coding agents and other services. Launch a template with the [abx CLI](https://github.com/Alibaba-Agent-Sandbox/agent-sandbox), then use its returned sandbox ID and the [template startup guide](docs/en/guide/template-workflows.md) to connect from Python. Named application commands require that service to be running.

Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ finally:

## 其他提供方与应用模板

极速版为内置后端。[提供方插件](https://github.com/Alibaba-Agent-Sandbox/awesome-providers)可让 `ProviderSandbox` 连接其他后端,使用前按[提供方指南](docs/zh/guide/providers.md)完成安装与配置。
SDK 内置极速版,源码版也可直接调用[容器版](docs/zh/design/provider-alicloud-container.md)。其他后端参见[提供方设置](docs/zh/guide/providers.md)。

应用模板封装浏览器工具、编码 Agent 等服务。先用 [abx CLI](https://github.com/Alibaba-Agent-Sandbox/agent-sandbox)启动模板,再根据返回的沙箱 ID 和[模板启动指南](docs/zh/guide/template-workflows.md)从 Python 连接。调用命名应用命令前,需要先启动对应服务。

Expand Down
17 changes: 9 additions & 8 deletions agent-sandbox-provider/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ python -m pip check
The image needs only `agent-sandbox-server==0.4.0a6`. Installing that package on the host does not update an existing image. Development source installations must use a matching client/server revision.
Do not install `agent-sandbox`; that PyPI project is unrelated.

Only `alicloud-express` is built in. Do not reinstall it and do not reuse
its id. `opensandbox`, `cubesandbox`, `e2b`, and `alicloud-container` are
official catalog ids in `awesome-providers`. Install those with
`registry:<id>`. Do not reuse them for a new backend. A new id matches
`^[a-z][a-z0-9]*(-[a-z0-9]+)*$`, length 2-40, and must not start with
`abx-`, `alicloud-`, or `shortcuts`.
The Python SDK source bundles `alicloud-express` and `alicloud-container`. Use
the Container Edition ID for the same backend, with its own cluster credentials.
The published 0.4.0a6 and 0.4.0a7 packages predate the built-in Container Edition adapter.
`opensandbox`, `cubesandbox`, `e2b`, and `alicloud-container` also have official
Node catalog artifacts in `awesome-providers`. A new backend needs a separate
ID matching `^[a-z][a-z0-9]*(-[a-z0-9]+)*$`, length 2-40, outside the reserved
`abx-`, `alicloud-`, and `shortcuts` prefixes.

The CLI loads `alicloud-express` plus installed `rest`, `exec` and `node`
plugins. It rejects `kind = "python"`. An in-code `Provider` subclass still
Expand All @@ -35,8 +36,8 @@ works from the Python SDK. Catalog providers (`opensandbox`, `e2b`,
`provider.mjs`): install with
`abx provider install alibaba-agent-sandbox/awesome-providers//<id> --allow-unpinned --yes` (or
`python -m agent_sandbox.providers install registry:<id> --yes`), then
`abx --provider <id>` or `ProviderSandbox.create(provider="<id>")`. The Python SDK
reaches `node` plugins through the local engine (`abx provider engine serve`,
`abx --provider <id>` or `ProviderSandbox.create(provider="<id>")`. The Python SDK selects the built-in Container Edition by ID. For Node plugins
it uses the local engine (`abx provider engine serve`,
started on demand; `abx` must be on `PATH` or in `ABX_BIN`) using
`EngineProvider`. Python `exec` and `rest` manifests still run in the Python
process. The catalog guide is
Expand Down
Loading
Loading