List sandboxes
Sandbox.list returns a paginator. Without a state filter it includes both running and paused sandboxes. Filters are evaluated by the AgentBox API before pagination.
mjs
import { Sandbox } from "@abox-dev/sdk";
const sandbox = await Sandbox.create({
metadata: { purpose: "list-example" },
});
try {
const paginator = Sandbox.list({
query: {
state: ["running"],
metadata: { purpose: "list-example" },
},
});
while (paginator.hasNext) {
for (const info of await paginator.nextItems()) {
console.log(info.sandboxId, info.state);
}
}
} finally {
await sandbox.kill();
}Use hasNext and nextItems in JavaScript or has_next and next_items in Python until the paginator is exhausted. A page may be empty only when no sandbox matches the query.
The query can filter by state, metadata, template, and start time. Page size, continuation token, and order are documented in the Sandbox SDK reference.