Agent Sandbox Registry

python-sdk

Decision: Self-implement E2B Protocol Instead of Wrapping SDK

无中文版

.agents/notes/implemented/architecture/2026-09-02-self-implement-e2b-protocol.md

Decision: Self-implement E2B Protocol Instead of Wrapping SDK

Status: implemented

Problem

We need to communicate with E2B-compatible sandbox APIs (Platform API + envd API). The choice is between wrapping the official E2B Python SDK or implementing the protocol directly.

Decision

Self-implement the E2B protocol using httpx + websockets. This gives us full control over: - Connect protocol (application/connect+json) encoding/decoding - Server-Streaming frame parsing - Dual token management (API Key for Platform, envdAccessToken for envd) - HTTP/2 connection pooling and domain partitioning - Alibaba Cloud-specific extensions (VPC, OSS, domain binding)

API Design

# Protocol implemented directly on httpx + websockets (no e2b SDK dependency):
# transport/  -> HttpTransport, WebSocketTransport, ConnectStreamReader
# protocol/   -> sandbox / filesystem / process / terminal Connect + REST wrappers

Alternatives considered

Dependencies

Test Strategy

Acceptance criteria

Consequences