Skip to main content

Metrics

from nullspace import Machine

with Machine.create(template="base") as machine:
    for metric in machine.get_metrics():
        print(metric)
For streaming updates, use Monitor.

Timeout

Set a timeout at create time or update it while the machine is running. Each client below is an equivalent alternative for the same setting. Note that the SDKs and CLI take a relative duration (seconds) while the HTTP API takes timeout_ms.
machine = Machine.create(template="base", timeout=600)
machine.set_timeout(120, timeout_action="destroy")
set_timeout is a refresh: each call resets the deadline to the new window from now. The endpoint echoes the effective lease back so you can schedule the next refresh without guessing:
  • timeout_ms — the window now in effect
  • timeout_at — the absolute deadline (RFC 3339)
  • remaining_ms — milliseconds left until timeout_at, clamped at 0
  • timeout_action — what fires at the deadline
The SDK set_timeout / setTimeout return this lease, and the same timeout_at / remaining_ms appear on MachineInfo (from get/list):
lease = machine.set_timeout(120, timeout_action="destroy")
print(lease.remaining_ms, lease.timeout_at)
There are two related timeout knobs:
  • on_timeout is create-time lifecycle policy. Use "destroy" or "pause".
  • timeout_action is used by set_timeout(). Use "destroy" or "hibernate".
The default timeout behavior destroys the machine when it expires. Use on_timeout="pause" at create time when persistence-capable deployments should hibernate the machine instead. The TypeScript SDK does not expose autoResume or a pause timeout policy on create, so configure pause-on-timeout with auto-resume from the Python SDK, CLI, or HTTP API:
machine = Machine.create(
    template="base",
    timeout=600,
    on_timeout="pause",
    auto_resume=True,
)
auto_resume=True is valid only with pause/hibernate timeout behavior. Updating an auto-resumable machine to destroy-on-timeout is rejected so paused alias routing cannot become inconsistent.

Keepalive while in use

When an agent loop needs to hold a machine open for as long as work is running, use the opt-in keepalive helper instead of hand-rolling a refresh loop. It refreshes the lease immediately, then on an interval (default: half the timeout window), and stops cleanly when the block exits.
with machine.keep_alive(timeout_secs=300):
    run_long_agent_loop(machine)   # lease refreshed in the background
# refresher stopped here; the normal timeout takes over again
Keepalive is a client-side convenience built on set_timeout; the server contract stays an explicit refresh. Pass refresh_every_secs / refreshEverySecs to control the cadence.

No session ceiling

Refreshing a timeout has no upper bound: there is no per-tier maximum session length and no cap on how long or how often you can extend a lease. A machine lives exactly as long as you keep it alive (and bills only for the time it is running or paused). This is deliberate — long-lived agents and human sessions never hit an artificial wall and never need special-case handling. The only timeout that matters is the one you set.

Capacity and limits

During private beta, machine capacity is intentionally limited. Treat create timeouts as recoverable and make scripts idempotent with explicit cleanup.