Agent Sandbox Registry

python-sdk

Decision: Authentication Module

无中文版

.agents/notes/implemented/feature/2026-09-02-transport-auth.md

Decision: Authentication Module

Status: implemented Implemented: 2026-09-02

Problem

Dual auth (API Key + AK/SK) with dual token (Platform X-API-KEY + envd X-Access-Token). Need a clean abstraction for header injection and token lifecycle.

Decision

Auth provider is selected automatically based on available credentials, with API Key taking priority.

API Design

class ApiKeyAuth:
    def headers(self) -> dict[str, str]: ...        # -> {"X-API-KEY": <key>}

class AkSkAuth:
    async def headers(self) -> dict[str, str]: ...  # exchanges AK/SK -> temp API key, caches TTL=3600s

# envd access token is cached per sandbox and injected as {"X-Access-Token": <token>}
# Provider selection: API Key takes priority over AK/SK when both are present.

Implementation

Alternatives considered

Dependencies

Test Strategy

Acceptance criteria