Agent Sandbox Registry

python-sdk

Decision: Data Models and Error Hierarchy

无中文版

.agents/notes/implemented/feature/2026-09-02-models-and-errors.md

Decision: Data Models and Error Hierarchy

Status: implemented Implemented: 2026-09-02

Problem

SDK needs typed data structures for all API interactions and a structured error system that provides actionable information to users.

Decision

Pydantic v2 models in models/ package. Error hierarchy rooted at SandboxError with code, message, suggestion, docs_url fields. Error codes range E1001-E6xxx, grouped by category: - E1xxx: Authentication errors - E2xxx: Sandbox lifecycle / creation errors - E3xxx: Execution errors - E4xxx: File operation errors - E5xxx: Network/transport errors - E6xxx: Session errors

All models use model_config = ConfigDict(frozen=True) for immutability where appropriate.

API Design

class SandboxError(Exception):
    code: str          # e.g. "E1001"
    message: str
    suggestion: str
    docs_url: str

# Category base classes
class AuthenticationError(SandboxError): ...   # E1xxx
class SandboxCreationError(SandboxError): ...  # E2xxx
class ExecutionError(SandboxError): ...        # E3xxx
class FileOperationError(SandboxError): ...    # E4xxx
class NetworkError(SandboxError): ...          # E5xxx
class SessionError(SandboxError): ...          # E6xxx

Implementation

Alternatives considered

Dependencies

Test Strategy

Acceptance criteria