Sandbox
Lifecycle Events
Monitor sandbox state changes with lifecycle event logs.
Overview
Every sandbox records lifecycle events as it transitions between states. You can retrieve these events to monitor sandbox activity, debug issues, or build audit trails. Lifecycle logs are persisted and remain available even after a sandbox has been killed or stopped.
Retrieving Lifecycle Events
const events = await sandbox.getLogs();
for (const ev of events.logs) {
console.log(`[${ev.timestamp}] ${ev.line}`);
}
// [2026-03-06T10:00:52Z] sandbox.lifecycle.created
// [2026-03-06T10:00:52Z] sandbox.lifecycle.running
// [2026-03-06T10:05:30Z] sandbox.lifecycle.paused
// [2026-03-06T10:10:00Z] sandbox.lifecycle.resumed
// [2026-03-06T11:00:52Z] sandbox.lifecycle.killedcurl "https://api.lelantos.ai/sandboxes/SANDBOX_ID/logs" \
-H "X-API-Key: lel_your_key_here"Event Types
| Event | Description |
|---|---|
sandbox.lifecycle.created | Sandbox was provisioned and is starting. |
sandbox.lifecycle.running | Sandbox is active and ready to accept commands. |
sandbox.lifecycle.paused | Sandbox was paused (state preserved). |
sandbox.lifecycle.resumed | Sandbox was resumed from paused state. |
sandbox.lifecycle.killed | Sandbox was explicitly terminated via API. |
sandbox.lifecycle.stopped | Sandbox was terminated by the reaper (timeout expired). |
sandbox.lifecycle.error | An error occurred during a lifecycle transition. |
Pagination
For sandboxes with many events, use start and limit parameters to paginate:
// Get the first 10 events
const page1 = await sandbox.getLogs({ start: 0, limit: 10 });
// Get the next 10 events
const page2 = await sandbox.getLogs({ start: 10, limit: 10 });curl "https://api.lelantos.ai/sandboxes/SANDBOX_ID/logs?start=0&limit=10" \
-H "X-API-Key: lel_your_key_here"Historical Sandboxes
Lifecycle events are available for all sandboxes, including those that have already been killed or stopped. This makes it possible to audit past sandbox activity without keeping sandboxes running.
You can retrieve logs for any sandbox by its ID, regardless of its current state:
const client = new LelantosClient({
apiKey: process.env.LELANTOS_API_KEY!,
});
// Get logs for a sandbox that was killed yesterday
const events = await client.getSandboxLogs("sbx_abc123");