What you can do
Everything is a flat method on
Bonya or Sandbox.
Bonya also has convenience methods that take a sandbox id, such as
client.create_session(sandbox_id, name, cmd). Each fetches the sandbox first,
so prefer calling on sandbox when you already hold one.Create sandboxes
Sandbox is a context manager that deletes the sandbox on exit. If create
exhausts its deadline the SDK raises SandboxCreationTimeoutError, which
carries the idempotency_key so you can retry the same creation.
Get, list, and find by name
Run commands
Streaming exec
Persistent sessions
^[a-z][a-z0-9-]{0,31}$.
Files
Previews
Lifecycle, snapshots, and forks
Jobs
run_job waits for the result; start_job returns immediately. Use
get_job_run(id), list_job_runs() and cancel_job_run(id) to track runs.
Schedules
cron_expressions, interval_seconds or
run_at_unix_nanos.
Templates
Registry connections, secrets, and secret sets
Organizations
BONYA_ORGANIZATION_ID, then
your personal organization. Creating organizations, members, invites and API
keys is done in the dashboard, not through the SDK.
Errors
Every error extendsBonyaError (with sandbox_id, idempotency_key, code).
Catch the class you care about: AuthenticationError, SandboxNotFoundError,
SandboxCreationTimeoutError, ExecFailedError, TimeoutError,
NoCapacityError, RateLimitedError, OutcomeUnknownError,
RemoteFileNotFoundError, and so on. API keys and capability tokens are
redacted from error messages.
problem+json; see Errors.