LelantosLelantos
Sandbox

Metadata

Attach custom metadata to sandboxes for filtering and organization.

Overview

Metadata lets you attach custom key-value pairs to sandboxes at creation time. Use metadata to tag sandboxes with identifiers like user IDs, session IDs, environment names, or any other organizational labels. You can then filter sandboxes by metadata when listing them.

Attaching Metadata

Pass a metadata map (string to string) when creating a sandbox:

const sandbox = await client.createSandbox({
  templateID: "base",
  metadata: {
    userId: "user_abc123",
    sessionId: "sess_xyz789",
    environment: "staging",
    purpose: "code-review",
  },
});

Filtering by Metadata

Use metadata to find specific sandboxes when listing:

const sandboxes = await client.listSandboxes({
  metadata: {
    userId: "user_abc123",
  },
});

for (const sb of sandboxes) {
  console.log(sb.sandboxID, sb.metadata);
}

This is particularly useful when your application manages sandboxes for multiple users or workflows and needs to look up the right sandbox later.

Use Cases

KeyExample ValuePurpose
userIduser_abc123Associate sandbox with a specific user.
sessionIdsess_xyz789Link sandbox to an application session.
environmentstagingTag by deployment environment.
agentIdagent_001Track which AI agent owns the sandbox.
taskIdtask_456Associate sandbox with a specific task or job.

Both metadata keys and values must be strings. There is no limit on the number of metadata entries, but keep entries concise for best performance when filtering.

On this page