Skip to main content
Install the Python package:
Import BoxApi, configure auth, and call snake_case methods like box.create, box.prompt, and box.events.

Configure

Request models live under ascii_box_sdk.models. Prompting requires the selected provider to be configured for the authenticated account. If Codex or Claude Code credentials are missing, box.prompt(...) raises ApiException with code provider_not_configured.

Create, prompt, and clean up

Per-box environment variables

Pass env to inject variables into a single Box, on top of your account-level secrets (per-box values win on name conflicts). At most 100 variables, 64KB total.
Forked Boxes inherit the source Box’s env unless the fork supplies its own.

No-env boxes

When you hand a Box to your own end users, create it with no_env=True so none of your account secrets reach it. Model keys, GitHub token, dashboard environment variables, SSH identity, and secret files are all withheld. SSH, desktop, snapshots, public URLs, and forks still work. A fork of a no-env Box is always no-env and cannot be downgraded.

Methods

All methods are called on BoxApi. Request bodies use model classes from ascii_box_sdk.models.

Browse a stopped Box’s filesystem

Snapshot reads never touch the machine, so they work while the Box is archived:

Waiters and helpers

The package exports first-class waiters and deterministic file/command helper functions:
Use wait_for_prompt/wait_for_prompt_done instead of inferring completion from box.state plus event polling. Use stream_prompt or stream_events when you need incremental response/tool-call events as work runs.

Types

Python models use snake_case attributes. JSON serialization uses the API’s camelCase field names.

Errors

Methods raise ApiException for non-2xx responses. Log the status, reason, and response body when debugging, but redact API keys, Box secrets, SSH keys, and desktop URLs.

Streaming responses and tool calls

The Python helper module exports stream_events and stream_prompt for response streaming. They long-poll the Box v1 events cursor API; no separate SSE or WebSocket endpoint is required. response events carry text in event.data.content; streaming partials set event.data.is_streaming; tool-call events are response events with event.data.tools.
For a dashboard-style feed not tied to one prompt, use stream_events(box, box_id, type="prompt,response,git_checkpoint").