Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ fragment the warm pools):
| `medium` | 2 | 1G |
| `large` | 4 | 4G |
| `xlarge` | 4 | 8G |
| `2xlarge` | 8 | 16G |

### Dataset volumes

Expand Down
2 changes: 1 addition & 1 deletion docs/mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Build: `cd mcp && go build -o sandbox-mcp .`

| tool | what it does |
|---|---|
| `create_sandbox` | claim a microVM and return its id plus deadline; optional `template`, `net` (`none` default, or `egress`), `size` (`small` default, `medium`, `large`, `xlarge`) and `ttl_seconds` (0 means one hour); warm claims take milliseconds, nothing renews the deadline |
| `create_sandbox` | claim a microVM and return its id plus deadline; optional `template`, `net` (`none` default, or `egress`), `size` (`small` default, `medium`, `large`, `xlarge`, `2xlarge`) and `ttl_seconds` (0 means one hour); warm claims take milliseconds, nothing renews the deadline |
| `exec` | run a shell command to completion (5-minute cap); returns stdout, stderr and the exit code; a hibernated sandbox wakes transparently |
| `spawn` | start a command detached and return its pid; output goes to a 256 KiB ring buffer that `logs` replays |
| `ps` | list tracked processes (exec, spawn, pty) with state, exit code and start time |
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ sb = client.new("ghcr.io/cocoonstack/sandbox/rt:24.04",
| parameter | values | default | meaning |
|---|---|---|---|
| `net` | `"none"`, `"egress"` | `"none"` | Cloud Hypervisor network shape: `none` disables the NIC and uses vsock-only I/O; `egress` attaches a bridge/CNI NIC |
| `size` | `"small"`, `"medium"`, `"large"`, `"xlarge"` | `"small"` | resource tier: 1cpu/512M, 2cpu/1G, 4cpu/4G, 4cpu/8G |
| `size` | `"small"`, `"medium"`, `"large"`, `"xlarge"`, `"2xlarge"` | `"small"` | resource tier: 1cpu/512M, 2cpu/1G, 4cpu/4G, 4cpu/8G, 8cpu/16G |
| `volumes` | bare names or `{name, mount?, mode?}` mappings | `None` | attach and mount up to eight unique catalog dataset disks; an omitted mount defaults to `/volumes/<name>`; `mode` is `"ro"` (default) or `"rw"` — `"rw"` requires the catalog entry's `writable: true`; accepted by `Client.new` and `Template.new` |
| `mount` | bool | `True` | mount every requested volume. `False` attaches the devices and leaves the mounting to the workload; a mapping carrying `mount` is then a `TypeError` |
| `ttl_seconds` | int | server default 5m | sandbox TTL, server-capped at 24h. The node reaps the sandbox after the TTL even if the client vanishes |
Expand Down
2 changes: 1 addition & 1 deletion mcp/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
var tools = []tool{
{
"create_sandbox", "Claim a fresh microVM sandbox and return its id plus deadline. Warm claims take milliseconds; a cold template boots in well under a second. Every sandbox-scoped tool takes the returned sandbox_id. The sandbox is destroyed at its deadline unless released earlier; nothing renews it.",
schema(props{"template": str("template image ref, or a name published by promote; empty uses the server default"), "net": str("network lane: none (default, no NIC, vsock-only I/O) or egress (bridge NIC, outbound network)"), "size": str("resource tier: small (default), medium, large, xlarge"), "ttl_seconds": integer("sandbox lifetime in seconds; 0 means one hour, and nothing renews it")}), toolCreateSandbox,
schema(props{"template": str("template image ref, or a name published by promote; empty uses the server default"), "net": str("network lane: none (default, no NIC, vsock-only I/O) or egress (bridge NIC, outbound network)"), "size": str("resource tier: small (default), medium, large, xlarge, 2xlarge"), "ttl_seconds": integer("sandbox lifetime in seconds; 0 means one hour, and nothing renews it")}), toolCreateSandbox,
},
{
"exec", "Run a shell command in a sandbox, wait for it to exit, and return stdout, stderr, and the exit code as JSON. The call is cut off after 5 minutes; for servers or long jobs use spawn instead. A hibernated sandbox wakes transparently on this call.",
Expand Down
18 changes: 10 additions & 8 deletions sandboxd/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ const (
NetNone NetShape = "none"
NetEgress NetShape = "egress"

SizeSmall Size = "small"
SizeMedium Size = "medium"
SizeLarge Size = "large"
SizeXLarge Size = "xlarge"
SizeSmall Size = "small"
SizeMedium Size = "medium"
SizeLarge Size = "large"
SizeXLarge Size = "xlarge"
Size2XLarge Size = "2xlarge"

RestoreCopy RestoreMode = "copy"
RestoreOnDemand RestoreMode = "ondemand"
Expand All @@ -47,10 +48,11 @@ var (
VolumeNameRe = regexp.MustCompile(`^[a-z][a-z0-9_-]{0,19}$`)

sizeSpecs = map[Size]SizeSpec{
SizeSmall: {CPU: 1, Memory: "512M", MemoryBytes: 512 << 20},
SizeMedium: {CPU: 2, Memory: "1G", MemoryBytes: 1 << 30},
SizeLarge: {CPU: 4, Memory: "4G", MemoryBytes: 4 << 30},
SizeXLarge: {CPU: 4, Memory: "8G", MemoryBytes: 8 << 30},
SizeSmall: {CPU: 1, Memory: "512M", MemoryBytes: 512 << 20},
SizeMedium: {CPU: 2, Memory: "1G", MemoryBytes: 1 << 30},
SizeLarge: {CPU: 4, Memory: "4G", MemoryBytes: 4 << 30},
SizeXLarge: {CPU: 4, Memory: "8G", MemoryBytes: 8 << 30},
Size2XLarge: {CPU: 8, Memory: "16G", MemoryBytes: 16 << 30},
}

guestOSMountRoots = []string{
Expand Down
9 changes: 5 additions & 4 deletions sdk/go/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ const (
// NetEgress attaches the node's bridge or CNI network.
NetEgress NetShape = "egress"

Small Size = "small"
Medium Size = "medium"
Large Size = "large"
XLarge Size = "xlarge"
Small Size = "small"
Medium Size = "medium"
Large Size = "large"
XLarge Size = "xlarge"
XXLarge Size = "2xlarge"

volumeModeRO = "ro"
volumeModeRW = "rw"
Expand Down