Skip to main content
Lifecycle APIs expose customer-visible sandbox and snapshot transitions.
Lifecycle history and webhooks require hosted or local Supabase-backed state.

List events

from nullspace import Lifecycle

lifecycle = Lifecycle()
events = lifecycle.list_events(limit=20)
for event in events.events:
    print(event.operation, event.status)

Per-sandbox events

from nullspace import Sandbox

with Sandbox.create() as sandbox:
    sandbox.commands.run("true", shell=True)
    events = sandbox.list_lifecycle(limit=10)
    print([event.operation for event in events.events])

Stream events

Use stream_events() when code needs to react to lifecycle events without polling. The iterator reconnects automatically after transport drops. On every yield it records the event ID, then reconnects with after_event_id so the API can replay missed committed events before returning to live delivery.
from nullspace import Lifecycle, LifecycleOperation

lifecycle = Lifecycle()
try:
    for event in lifecycle.stream_events(
        operation=LifecycleOperation.CREATE,
        replay_limit=100,
    ):
        print(event.id, event.sandbox_id, event.operation, event.status)
finally:
    lifecycle.close()
from nullspace import AsyncLifecycle

lifecycle = AsyncLifecycle()
try:
    async for event in lifecycle.stream_events(live_only=True):
        print(event.id, event.operation)
finally:
    await lifecycle.close()
Supported filters include sandbox_id, snapshot_id, operation, status, live_only, after_event_id, replay_limit, and exact-match metadata. live_only=True skips the initial replay. After the first yielded event, the SDK still reconnects with after_event_id so reconnects do not lose events.

Webhooks

nullspace lifecycle webhooks create \
  --url https://example.com/nullspace/lifecycle \
  --operation create \
  --operation destroy \
  --signing-secret "$NULLSPACE_LIFECYCLE_WEBHOOK_SIGNING_SECRET"
nullspace lifecycle webhooks deliveries wh_123
nullspace lifecycle webhooks delivery wh_123 del_123
Concepts: Create, Destroy. API reference: listLifecycleEvents, listSandboxLifecycleEvents, and createLifecycleWebhook.