Luxor Agent Cloud
Full Linux microVMs with streamed processes, memory snapshots, fork, volumes, templates and public previews through @luxorai/sandbox.
Installation
pnpm add sbox-sdk @luxorai/sandboxThis adapter needs Node 22+, as required by @luxorai/sandbox 1.7. The rest of sbox-sdk keeps its Node 20 requirement. The vendor SDK loads lazily on the first API operation.
Authentication and usage
Set LUXOR_API_KEY or LUXOR_AUTH_TOKEN to your sandbox key, prefix lx_. The SDK also accepts legacy TENKI_API_KEY and TENKI_AUTH_TOKEN. LUXOR_API_ENDPOINT overrides the default https://api.luxor.ai; legacy endpoint variables are resolved by the SDK. Pass apiKey, authToken or baseUrl explicitly to override environment resolution.
import { createSandboxClient } from "sbox-sdk";
import { luxor } from "sbox-sdk/luxor";
const client = createSandboxClient({ provider: luxor() });
// Identity lookup only. Never creates a VM.
const verified = await client.verify();
if (!verified.ok) throw verified.error;
const sandbox = await client.create({
metadata: { project: "agent" },
lifecycle: { maxAgeMs: 30 * 60_000 },
ports: [3000],
});
try {
const result = await sandbox.commands.run("echo hello; exit 3", {
cwd: "/home/tenki",
env: { MODE: "test" },
timeoutMs: 10_000,
});
console.log(result.stdout, result.exitCode);
await sandbox.files.write("/home/tenki/data.bin", new Uint8Array([0, 255]));
} finally {
await sandbox.destroy();
await client.dispose();
}destroy() calls the SDK's Session.close(), which terminates the VM and deletes its bound previews. Terminated session records can remain visible in the provider's history. dispose() only closes local SDK connections; it does not terminate sessions.
Capabilities
| Capability | Level | Notes |
|---|---|---|
streaming / background | native | run() streams, stderr kept separate |
killProcess | native | native handle kill/signal, or guest kill for a known PID |
stdin | native | open on spawn(); run() closes it unless you write straight away |
list | native | complete SDK pagination, metadata matched exactly |
pause | native | keeps RAM, PIDs and disk (preservesMemoryOnPause), the id does not change |
setTimeout | native | update({ maxDurationMs, sticky: false }), at most 24 hours |
snapshot / fork | native | disk and memory; fork takes 1 to 10 children and rejects attached volumes |
filesUpload | native | chunked streams, binary files above 32 MiB work |
exposePort | native | public URLs on a subdomain |
volumes | native | 1 MiB to 50 GiB |
templateBuild | native | Luxor registry images or snapshots |
metrics | native | averaged CPU and memory |
stop | unsupported | destroy() terminates the VM |
privatePreview | unsupported | previews are public |
egressControl | unsupported | egress is set at create only |
pty / ssh | unsupported | |
filesWatch / proxiedFetch | unsupported | |
codeInterpreter | unsupported | |
statefulKernel | unsupported | |
gpu / region | unsupported | |
secretsVault | unsupported | inline env secrets only |
Create contract
Idempotency is best-effort. Luxor has no server-side idempotency key. Every create tags the session with a hash of the idempotencyKey and, unless you set name, names it sbox-<hash>. A retry lists sessions by that tag before creating and reuses an active one, waiting for it to become ready and exposing any ports the first attempt did not reach. Terminated sessions are ignored. Concurrent creates with one key through the same provider instance share a single in-flight create. Two processes racing the same key can still each make a session, so keep one owner per key.
| Field | Level | Behavior |
|---|---|---|
resources.vcpus | exact | integer, 1 to 128 (workspace limits may be lower) |
resources.memoryMB | exact | even MiB, 128 to 524288 (workspace limits may be lower) |
resources.diskMB | approximate | rounded up to a whole GiB, within 5 to 100 GiB |
resources.shmMB | rejected | create() throws |
resources.gpu | rejected | create() throws |
lifecycle.idleTimeoutMs | rejected | Luxor has no activity-based idle timer |
lifecycle.maxAgeMs | exact | fixed lifetime, greater than 0 and at most 24 hours; 30 minutes when unset |
Limits. None are declared. The SDK does not publish the server's caps on tags or exposed ports, so limits is empty. Metadata is stored as hex tags, which Luxor lowercases harmlessly.
Sizes. Luxor has free-form CPU and memory, not fixed tiers, so size uses the default ladder (small through xlarge). Every preset lands inside the ranges above.
How the spec maps
| Input | Luxor behavior |
|---|---|
template, templateRef | Luxor registry image ID/ref, including digest refs from template builds |
fromSnapshot | snapshotId; creates a new session |
env, inline env secrets | Environment passed at creation |
metadata | Original metadata plus case-preserving encoded tags for AND filtering |
name / idempotencyKey | Session name (sbox-<hash> when unnamed) and an sbox-idem- lookup tag |
resources.vcpus, memoryMB, diskMB | Native CPU/MiB settings; disk rounds up to a whole GiB, within 5 to 100 GiB |
volumes | Native volume ID, mount path and read-only flag |
ports | Inbound enabled, then public exposure for each port |
network | Creation-only outbound on/off or domain/IPv4 CIDR allowlists |
lifecycle.maxAgeMs | maxDurationMs |
Region, automatic resume, named secrets without inline values, egress secrets, network.deny and credential injection fail explicitly. Template builds require at least 512 MiB. Requests for another provider's template reference fail validation.
list() uses the SDK's complete paginated session list, applies exact metadata/state matching and then limit. Metadata from sessions created outside this adapter may lack its encoded tags and will not match a metadata filter. Listing without a metadata filter still returns those sessions. limit: 0 returns no sessions. To inspect terminated records, request state: "destroyed".
Processes and files
Exec uses run(["sh", "-c", command]) with separate stdout/stderr streams, native PID, writable stdin (closed for run() unless you write in the same tick, so commands that read stdin see EOF), kill/signals, native cwd/env and the real exit code. Nonzero exits are data. Provider timeout results become SandboxError("Timeout"), including a timeout reported with exit code zero. exec.user is unsupported.
Background process handles can reconnect through the same sandbox handle. Reattaching an existing process from a different handle is unsupported. Signaling a known PID uses the native handle or the guest kill command.
File reads, writes, upload and download use native chunked streams, including binary files above the SDK's 32 MiB unary limit. Listing and stat use native APIs. Rename uses the core's shell fallback because the SDK has no rename method. File watching is unsupported.
Lifecycle, snapshots and fork
The default lifetime is 30 minutes from creation. Activity does not extend it. At expiry, used sessions normally pause, while unused sessions terminate. A paused session is retained only for the workspace's configured retention period. lifecycle.onIdle: "pause" accepts this provider expiry behavior; "stop" and "destroy" are unsupported. Luxor has no activity-based idle timer.
setTimeout(ms) updates the session to a bounded lifetime with sticky: false, rather than adding time with extend(). Each requested duration must be at most 24 hours. pause() and resume() preserve RAM, PIDs and disk, but close active TCP/preview/SSH connections. IDs do not change. Live state maps creation/resume to creating, pausing to suspending, user shutdown to stopped, and termination to destroyed.
const snapshot = await sandbox.snapshots!.create({ name: "checkpoint" });
// New session, not in-place restoration.
const restored = await client.create({ fromSnapshot: snapshot });
const [child] = await sandbox.fork({ count: 1 });Snapshots capture memory and disk. includesMemory reflects the returned memoryBytes; filesystem-only snapshot requests are unsupported. /tmp is cleared when a snapshot is taken, so keep durable files under /home/tenki or on a volume. Snapshot restore is not available in place. Fork supports 1–10 children and rejects attached volumes. On a partial fork failure, the adapter attempts to terminate the returned children. Luxor's native ForkFailedError is retained as the normalized error's cause, including IDs needed if cleanup failed. Fork also retains a provider snapshot; inspect fork_snapshot_id in child metadata and delete it after the children no longer need it.
Templates and volumes
const template = await client.templates!.build({
source: { image: "sandbox" },
name: "agent-base",
env: { APP_MODE: "agent" },
workdir: "/home/tenki",
startCmd: "node server.js",
readyCmd: "curl -f http://localhost:3000",
});
const instance = await client.create({ template });
const volume = await client.volumes!.create({ name: "data", sizeMB: 1024 });
const withData = await client.create({
volumes: [{ id: volume.id, mountPath: "/data" }],
});Template sources are Luxor-managed registry images or snapshots. fromImage() does not accept arbitrary Docker Hub images. Dockerfile builds, private OCI registry credentials and template users are unsupported. Environment, workdir, resources, startup and readiness commands use Luxor's typed TemplateSpec. Builds stay private in your workspace, emit build events, and tag templates with the content cache key. Lookups return only successful builds with an immutable image ref. Template deletion is not exposed by this adapter; use Luxor's native registry/template lifecycle tools to remove retained artifacts.
Volumes support 1 MiB–50 GiB. Create waits for availability. Lookup works by ID or name. Delete detaches nothing automatically, so destroy attached sessions before deleting a volume.
Previews, network and metrics
ports.expose(port) returns the SDK's URL with auth: { type: "public" }. ports.list() and unexpose() use the provider's exposure APIs. Inbound exposure is enabled at creation so later expose() calls work too.
Private previews are unsupported, and previewBrowserAuth is false. dial() is an authenticated raw socket transport, not a browser URL or WebSocket auth mechanism. Luxor's ssh() and SSH certificate API similarly require a raw SDK transport; they do not map to the unified SSH host/key credentials, so sandbox.ssh is unavailable.
Domain/CIDR egress restrictions work at creation only. An empty allowlist blocks outbound access rather than silently allowing everything. Workspace restrictions still apply. The egressControl capability and sandbox.network are unavailable because the SDK cannot mutate session policy after creation. Luxor supports secrets:// placeholder substitution through separately configured credential rules. That requires changes to guest requests and does not implement the unified network.inject contract, which adds headers outside the guest. The adapter rejects that mapping.
metrics() uses the session metrics endpoint for averaged CPU percentage and memory usage/limit. Missing samples stay undefined. getUsage() reports workspace quotas and is not used as runtime metrics.
Verification limits
The adapter has a typed MiniShell-backed offline conformance suite, including large binary files and template caching. Live resource creation must be tested separately in an authorized account. client.verify() is safe for a non-creating credential check; it calls whoAmI() only.