Skip to content

feat(sandbox): resources override on create and snapshot restore - #5

Merged
anilguleroglu merged 3 commits into
mainfrom
feat/agent-sandbox-sdk-docs
Jun 29, 2026
Merged

feat(sandbox): resources override on create and snapshot restore#5
anilguleroglu merged 3 commits into
mainfrom
feat/agent-sandbox-sdk-docs

Conversation

@anilguleroglu

Copy link
Copy Markdown
Contributor

Summary

Add resources ({cpuCores,memoryMb,diskMb,pids}) to SandboxCreateRequest and SandboxRestoreRequest so SDK clients can size a sandbox and a snapshot resume.

Test

Typecheck clean; mirrors the console-ee API (Cognipeer/console-ee#38).

🤖 Generated with Claude Code

https://claude.ai/code/session_01D9WLaq5Lui1Yrk2NTh7wn3

Add `resources` ({cpuCores,memoryMb,diskMb,pids}) to SandboxCreateRequest and
SandboxRestoreRequest so SDK clients can size a sandbox and a snapshot resume.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D9WLaq5Lui1Yrk2NTh7wn3
Copilot AI review requested due to automatic review settings June 27, 2026 09:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

anilguleroglu and others added 2 commits June 29, 2026 09:49
- sandbox.preview(id): list previewable ports + their proxy URLs.
- sandbox.createPreviewLink(id, port, opts?): mint a session-less, expiring
  share link for a running app.
- sandbox.previewUrl(id, port, path?): build the authenticated proxy path.
- Types: SandboxPreviewPort/Info/ShareLink; SandboxSummary.preview + resources.
- Docs: dev-agent build → preview → push example + method reference.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0181JPYLhTDFsGJzRNbh1ujD
- sandbox.setPreview(id, {enabled?, public?}): toggle preview on/off and
  public (share links) vs private (login-only), applied live.
- create() accepts previewEnabled / previewPublic.
- preview() / SandboxPreviewInfo now expose enabled + public.
- Docs: setPreview usage + method reference.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0181JPYLhTDFsGJzRNbh1ujD
Copilot AI review requested due to automatic review settings June 29, 2026 12:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

Comment thread src/resources/sandbox.ts
async preview(id: string): Promise<SandboxPreviewInfo> {
const sbx = await this.get(id);
return (
sbx.preview ?? { enabled: true, public: false, ports: [], sharingEnabled: false, blocked: false }
Comment thread src/resources/sandbox.ts
Comment on lines 14 to 19
SandboxSessionCommandLogs,
SandboxSnapshotSummary,
SandboxSummary,
SandboxPreviewInfo,
SandboxPreviewShareLink,
} from '../types';
Comment thread src/resources/sandbox.ts
Comment on lines 213 to +220
async restoreSnapshot(
snapshotId: string,
data: { name?: string; persist?: boolean; blockNetwork?: boolean } = {},
data: {
name?: string;
persist?: boolean;
blockNetwork?: boolean;
resources?: { cpuCores?: number; memoryMb?: number; diskMb?: number; pids?: number };
} = {},
Comment thread src/types.ts
Comment on lines +2463 to 2468
/** Port preview enabled for this sandbox (default true). */
previewEnabled?: boolean;
/** Allow public (session-less share-link) preview; default false = private. */
previewPublic?: boolean;
/** Override the template's resource limits. */
resources?: { cpuCores?: number; memoryMb?: number; diskMb?: number; pids?: number };
Comment thread docs/api/sandbox.md
// p.enabled / p.public / p.sharingEnabled
```

When `public` is off, `createPreviewLink` is refused and existing links are revoked; only the authenticated proxy (`previewUrl` / `Open`) works.
@anilguleroglu
anilguleroglu merged commit 846b5ac into main Jun 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants