Agent Sandbox Registry

python-sdk

Decision: Full expansion of Server module capabilities (6 → 42 endpoints, 8 capability groups)

无中文版

.agents/notes/implemented/feature/2026-09-09-server-capability-expansion.md

Decision: Full expansion of Server module capabilities (6 → 42 endpoints, 8 capability groups)

Status: implemented Implemented: 2026-09-21

Problem

The agent_sandbox.server module previously exposed only 6 basic endpoints (health, commands, upload, download, shell, run command), giving limited capability coverage. To make Server a complete in-sandbox service layer, its coverage needed to expand to include filesystem CRUD, process management, PTY terminal, streaming output, system information, environment-variable management, Git operations, Code Interpreter, and browser automation — while keeping the architecture controllable: endpoints must be toggleable by capability group so that unneeded capabilities do not expand the attack surface.

Decision

Introduce a declarative RouteTable + CapabilityGroup capability toggle mechanism, expanding endpoints from 6 to 42 and organizing them into 8 capability groups.

8 capability groups

Group Endpoints Examples Default state
CORE 2 /health, /capabilities Always enabled, cannot be disabled
COMMANDS 2 GET /commands, POST /commands/{name} Enabled
FILE_OPS 11 /files/list, /files/stat, /files/mkdir, DELETE /files, /files/move, /files/search, /upload, /download, /files/upload-stream, /files/download-stream, /files/archive Enabled
PROCESS 6 /shell, /shell/stream, /process/start, /process/list, /process/{pid}, /process/{pid}/signal Enabled
SYSTEM 6 /system/info, GET /env, POST /env, /ports, /packages, /system/metrics Enabled
TERMINAL 3 + WS POST /pty/sessions, GET /pty/sessions, DELETE /pty/sessions/{id} + WebSocket PTY Enabled
DEV_TOOLS 3 /code/run, /git/status, /git/diff Disabled (opt-in)
BROWSER 8 /browser/navigate, /browser/screenshot, /browser/content, /browser/click, /browser/type, /browser/evaluate, /browser/pdf, /browser/console Disabled (opt-in)

Architectural improvements

  1. Declarative RouteTable: each route is defined as a RouteInfo record with method, path pattern ({param} placeholders compiled to regex), handler, CapabilityGroup, auth_required, streaming, and other attributes. At startup, routes are auto-registered based on the enabled CapabilityGroups. This replaces the current hardcoded if/elif branches for handle_* functions in do_GET/do_POST.

  2. Everything except /health is toggleable: /health and /capabilities belong to the CORE group and are always available and non-disable-able. All other endpoints can be enabled/disabled through CapabilityGroup. At runtime, this can be configured via the ABX_SERVER_DISABLED_GROUPS environment variable.

  3. Hidden commands (hidden): RegisteredCommand supports a hidden=True attribute; hidden commands do not appear in the GET /commands discovery endpoint but can still be invoked via POST /commands/{name}.

  4. Route files split by domain: route handlers are split into standalone modules by domain:

  5. routes.py — core routes (health/commands/upload/download/shell)
  6. routes_files.py — FILE_OPS group (9 endpoints)
  7. routes_process.py — PROCESS group (5 endpoints)
  8. routes_system.py — SYSTEM group + CORE/capabilities (7 endpoints)
  9. routes_pty.py — TERMINAL group (3 REST + WebSocket PTY)
  10. routes_browser.py — BROWSER group (8 endpoints, Playwright-backed)
  11. routes_devtools.py — DEV_TOOLS group (3 endpoints)

  12. WebSocket PTY terminal: uses the Python stdlib pty module plus the existing core dependency websockets (already required by the SDK) to provide an interactive terminal capability. The REST API manages sessions (create/list/delete) and WebSocket carries I/O. Supports input/resize/signal message types.

  13. Streaming shell (SSE): POST /shell/stream returns a Server-Sent Events stream, delivering the shell command's stdout/stderr in real time and emitting an exit event when the command exits.

  14. Browser automation (BROWSER group): 8 Playwright-backed endpoints supporting page navigation, screenshots, DOM-content retrieval, element clicks, text input, JavaScript execution, PDF generation, and console-log collection. Playwright is lazy-loaded and returns 503 when not installed.

File safety

API Design

# startup configuration
server = SandboxServer(
    port=8080,
    enabled_groups={"core", "commands", "file_ops", "process", "system", "terminal"},
    # dev_tools and browser must be explicitly enabled
)

Alternatives considered

Dependencies

Test Strategy

Acceptance criteria

Evidence