Create
on_timeout="pause", auto_resume=True when preview URL traffic should wake
a paused machine before forwarding the original request. auto_resume=True is
only valid with pause/hibernate timeout behavior.
Use a template warm pool for ready capacity before a burst:
warm_pool_mode="require" fails with warm_pool_unavailable when no matching
ready instance is available. Snapshot restore, resume, fork, hibernate, and
pause do not use template warm-pool checkout.
Egress controls
Restrict a machine’s outbound network access with a typed egress policy. You can set it at create time and change it on a running machine without recreate.allow_all, deny_all, and custom. custom carries IPv4
allow_cidrs/deny_cidrs and an optional outbound rate_limit (set one of
kbit_per_sec or pps, with an optional burst). The policy is IPv4-only and
does not do domain/DNS filtering. Tightening (e.g. moving to deny_all) fails
closed; broadening only succeeds once the new rules apply. The policy survives
hibernate/resume. The rate limit is best-effort shaping, not a hard quota.
The legacy internet_access, network.deny_out, and network.allow_out fields
still work but cannot express a rate limit; internet_access=False is
fail-closed and cannot be re-opened by a stray allow rule.
Inspect and connect
Machine.connect(id) is an explicit reconnect operation. If id currently
points at a paused snapshot, connect() resumes it and returns the running
machine execution. Machine.get_info_by_id(id) is read-only and does not wake a
paused machine.
Pass fields=["id", "status"] to Machine.list() or
Machine.get_info_by_id() for compact raw dictionaries instead of full model
objects. This is useful for dashboards and polling loops that only need a few
attributes.
Preview URLs and timeout
on_timeout="pause", auto_resume=True, HTTP and
websocket traffic to those preview URLs wakes the paused machine, waits for the
bounded resume window, and then forwards to the resumed execution. If
auto-resume is disabled or the wake does not complete in time, the preview URL
returns 503 Service Unavailable with Retry-After: 5.
Use machine.create_preview_proxy_target(8080) when your application proxy
should forward to Nullspace with x-nullspace-preview-proxy-token instead of
putting signed edge tokens in browser-visible URLs.
Use redact_preview_url(...) or redact_preview_token(...) before printing
preview credentials to logs or terminal output.
Lifecycle events
Usemachine.stream_events() to tail lifecycle events related to one machine
without polling:
GET /v1/machines/{id}/lifecycle/ws, reconnects
automatically, and resumes with after_event_id from the last yielded event.
Use live_only=True to skip the initial replay while still keeping reconnects
gap-resistant after the first event.
Shared volume data is external durable storage. Resume and fork remount shared
volume attachments, but do not make VM memory or mutable rootfs state portable
across incompatible runtime hosts.
One-shot runs
run_once for simple tasks where the SDK should create a machine, run the
code, and clean up without exposing a long-lived handle.
Async API
fields behavior as the
synchronous SDK.
Concepts: Create, Destroy,
Fork. API reference:
createMachine, getMachine,
getHost, setTimeout.