@sandboxrouter/sdk 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # sandboxRouter
2
2
 
3
- **One API for every sandbox.** A free, open-source router for the places an AI agent can run code: Agent37, Alibaba Cloud, AWS (Bedrock AgentCore and Lambda MicroVMs), Azure Container Apps, Beam, Blaxel, Boat, Cloudflare, CodeSandbox, Daytona, Dedalus Machines, Deno, E2B, exe.dev, Fly.io Sprites, Freestyle, HOPX, InstaBox, Koyeb, Maritime, Modal, Morph, Northflank, Novita, OpenScale, Runloop, Sail, Superserve, Tensorlake, Upstash Box and Vercel, plus Docker on your own machine. It picks a provider by price, speed or capability, and falls back to the next one when a provider is down or rate-limited.
3
+ **One API for every sandbox.** A free, open-source router for the places an AI agent can run code: Agent37, Alibaba Cloud, AWS (Bedrock AgentCore and Lambda MicroVMs), Azure Container Apps, Beam, Blaxel, Boat, Cloudflare, CodeSandbox, Daytona, Dedalus Machines, Deno, DigitalOcean Harness Runtime, E2B, exe.dev, Fly.io Sprites, Freestyle, Google Cloud Agent Platform, HOPX, InstaBox, Koyeb, Maritime, Modal, Morph, Northflank, Novita, OpenScale, Runloop, Sail, Superserve, Tensorlake, Upstash Box and Vercel, plus Docker on your own machine. It picks a provider by price, speed or capability, and falls back to the next one when a provider is down or rate-limited.
4
4
 
5
5
  E2B quickstart (Node 22.19+ and an E2B API key):
6
6
 
@@ -52,12 +52,13 @@ List price while running, 2 vCPU / 4 GB, cheapest first; waitlisted sign-ups fol
52
52
  | [Boat](https://sandboxrouter.ai/providers/boat) | $0.018 | $20/mo (credited) | passed (2026-11-14) | [pricing](https://docs.boat.dev/pricing.md) |
53
53
  | [Maritime](https://sandboxrouter.ai/providers/maritime) | $0.022 | $20/mo (credited) | passed (2026-11-13) | [pricing](https://maritime.sh/pricing) |
54
54
  | [Sailboxes (Sail Research)](https://sandboxrouter.ai/providers/sail) | up to $0.062 | none | passed (2026-11-14) | [pricing](https://docs.sailresearch.com/sailboxes-pricing.md) |
55
- | [Northflank](https://sandboxrouter.ai/providers/northflank) | $0.067 | none | not run yet | [pricing](https://northflank.com/pricing) |
56
- | [Morph Cloud](https://sandboxrouter.ai/providers/morph) | $0.100 | none | not run yet | [pricing](https://cloud.morph.so/web/pricing) |
55
+ | [Northflank](https://sandboxrouter.ai/providers/northflank) | $0.067 | none | passed (2026-11-18) | [pricing](https://northflank.com/pricing) |
56
+ | [Morph Cloud](https://sandboxrouter.ai/providers/morph) | $0.100 | none | passed (2026-11-18) | [pricing](https://cloud.morph.so/web/pricing) |
57
57
  | [exe.dev](https://sandboxrouter.ai/providers/exedev) | $0.105 | $15/mo | not run yet | [pricing](https://exe.dev/docs/standalone-vms.md) |
58
58
  | [Novita AI Agent Sandbox](https://sandboxrouter.ai/providers/novita) | $0.117 | none | passed (2026-11-13) | [pricing](https://docs.novita.ai/guides/sandbox-pricing) |
59
+ | [DigitalOcean Harness Runtime](https://sandboxrouter.ai/providers/digitalocean) | up to $0.126 | none | not run yet | [pricing](https://docs.digitalocean.com/products/managed-agents/agent-harness-runtime/details/pricing/) |
59
60
  | [Freestyle](https://sandboxrouter.ai/providers/freestyle) | $0.134 | none | passed (2026-11-13) | [pricing](https://www.freestyle.sh/docs/vms/pricing-and-limits) |
60
- | [Beam](https://sandboxrouter.ai/providers/beam) | $0.140 | $20/mo (credited) | not run yet | [pricing](https://www.beam.cloud/pricing) |
61
+ | [Beam](https://sandboxrouter.ai/providers/beam) | $0.140 | $20/mo (credited) | passed (2026-11-18) | [pricing](https://www.beam.cloud/pricing) |
61
62
  | [CodeSandbox SDK (Together)](https://sandboxrouter.ai/providers/codesandbox) | $0.149 | none | not run yet | [pricing](https://docs.together.ai/docs/together-code-sandbox-legacy) |
62
63
  | [Fly.io Sprites](https://sandboxrouter.ai/providers/sprites) | up to $0.164 | none | passed (2026-11-13) | [pricing](https://fly.io/sprites) |
63
64
  | [Blaxel](https://sandboxrouter.ai/providers/blaxel) | $0.166 | none | passed (2026-11-13) | [pricing](https://blaxel.ai/pricing) |
@@ -80,10 +81,11 @@ List price while running, 2 vCPU / 4 GB, cheapest first; waitlisted sign-ups fol
80
81
  | [Azure Container Apps dynamic sessions](https://sandboxrouter.ai/providers/azure) | skipped (max 1 vCPU) | none | not run yet | [pricing](https://learn.microsoft.com/en-us/azure/container-apps/billing#dynamic-sessions) |
81
82
  | [Daytona](https://sandboxrouter.ai/providers/daytona) | skipped (default image is 1 vCPU / 1 GB; a bigger size needs image.daytona) | none | passed (2026-11-13) | [pricing](https://www.daytona.io/pricing) |
82
83
  | [Alibaba Cloud Agent Sandbox](https://sandboxrouter.ai/providers/alibaba) | skipped (max 2 GB memory) | none | not run yet | [pricing](https://www.alibabacloud.com/help/en/agent-sandbox/product-overview/billing-overview) |
84
+ | [Google Cloud Agent Platform](https://sandboxrouter.ai/providers/google) | skipped (max 1 vCPU) | none | passed (2026-11-18) | [pricing](https://cloud.google.com/products/gemini-enterprise-agent-platform/pricing) |
83
85
  | [E2B](https://sandboxrouter.ai/providers/e2b) | skipped (default image is 2 vCPU / 0.5 GB; a bigger size needs image.e2b) | none | passed (2026-11-13) | [pricing](https://e2b.dev/pricing) |
84
86
  | [Docker (local)](https://sandboxrouter.ai/providers/docker) | free | none | passed (2026-11-13) | [pricing](https://docs.docker.com/engine/) |
85
87
 
86
- Checked 2026-11-04 to 2026-11-17.
88
+ Checked 2026-11-04 to 2026-11-18.
87
89
 
88
90
  ## Install
89
91
 
package/dist/catalog.d.ts CHANGED
@@ -12,11 +12,17 @@ export interface ProviderInfo {
12
12
  incrementSeconds?: number;
13
13
  /** A fixed charge per sandbox created, USD, on top of running time. */
14
14
  perSandboxUsd?: number;
15
- /** Start fees above a provider's included allowance. Estimates exclude these account-specific charges. */
15
+ /**
16
+ * The plan `perSandboxUsd` applies on, where the provider's paid plans waive it. The router still counts the
17
+ * fee; published tables leave it out and note it, the way they treat `conditionalStartFee`.
18
+ */
19
+ perSandboxPlan?: string;
20
+ /** Start fees above a provider's included allowance. Estimates exclude these account-specific charges. `when` says when they apply. */
16
21
  conditionalStartFee?: {
17
22
  minUsd: number;
18
23
  maxUsd: number;
19
24
  source: string;
25
+ when?: string;
20
26
  };
21
27
  /**
22
28
  * Active-CPU billing only: the share of the allocated CPU billed even when idle (Tensorlake bills at
@@ -54,13 +60,13 @@ export interface ProviderInfo {
54
60
  };
55
61
  /**
56
62
  * The size every sandbox gets unless a custom image (template, snapshot) is passed, whatever
57
- * vcpu/memoryGb ask for. Measured inside real sandboxes (nproc, MemTotal). The router skips the
63
+ * vcpu/memoryGb ask for. Use the documented stock template size or a measurement from a live sandbox. The router skips the
58
64
  * provider for requests bigger than this and prices it at this size.
59
65
  */
60
66
  defaultSize?: {
61
67
  vcpu: number;
62
68
  memoryGb: number;
63
- measured: string;
69
+ measured?: string;
64
70
  };
65
71
  /** Runs on your own machine (Docker). Never chosen automatically; name it to use it. */
66
72
  local?: boolean;
@@ -119,6 +125,31 @@ export declare function planLabel(id: ProviderId): string;
119
125
  * you have keys for, so a gated provider only gets work if you already have an account there.
120
126
  */
121
127
  export declare function listingOrder(spec?: SandboxSpec): ProviderInfo[];
128
+ export declare function digitalOceanSize(vcpu: number, memoryGb: number): {
129
+ readonly slug: "mars-1vcpu-1gb";
130
+ readonly vcpu: 1;
131
+ readonly memoryGb: 1;
132
+ } | {
133
+ readonly slug: "mars-2vcpu-2gb";
134
+ readonly vcpu: 2;
135
+ readonly memoryGb: 2;
136
+ } | {
137
+ readonly slug: "mars-2vcpu-4gb";
138
+ readonly vcpu: 2;
139
+ readonly memoryGb: 4;
140
+ } | {
141
+ readonly slug: "mars-4vcpu-8gb";
142
+ readonly vcpu: 4;
143
+ readonly memoryGb: 8;
144
+ } | {
145
+ readonly slug: "mars-16vcpu-32gb";
146
+ readonly vcpu: 16;
147
+ readonly memoryGb: 32;
148
+ } | undefined;
149
+ export declare const GOOGLE_SHELL_SIZE: {
150
+ readonly vcpu: 1;
151
+ readonly memoryGb: 2;
152
+ };
122
153
  export declare const CATALOG: ProviderInfo[];
123
154
  /** Cloudflare only rents fixed instance types: https://developers.cloudflare.com/containers/platform/limits/ */
124
155
  export declare const CLOUDFLARE_INSTANCES: readonly [{
@@ -299,6 +330,15 @@ export declare function vercelSandboxSize(spec: SandboxSpec): {
299
330
  vcpu: number;
300
331
  memoryGb: number;
301
332
  };
333
+ /** The per-sandbox fee a provider charges only on one plan (Sail's free plan), else 0. Published tables leave it out. */
334
+ export declare function planOnlyStartFee(id: ProviderId): number;
335
+ /** Every start fee that depends on the customer's account or plan, which published estimates exclude. */
336
+ export declare function accountStartFees(): Record<string, {
337
+ minUsd: number;
338
+ maxUsd: number;
339
+ source: string;
340
+ when?: string;
341
+ }>;
302
342
  /** How a provider turns running time into a bill: minimum, rounding and fixed per-sandbox charge. */
303
343
  export declare function billingRules(id: ProviderId): {
304
344
  minSeconds: number;
@@ -320,6 +360,11 @@ export declare function fixedSize(id: ProviderId, spec?: SandboxSpec): {
320
360
  vcpu: number;
321
361
  memoryGb: number;
322
362
  } | null;
363
+ /**
364
+ * The spec with a stand-in image for every provider whose default image fixes its size, so price tables can
365
+ * compare them at the asked size. Starting one for real needs your own image or template built at that size.
366
+ */
367
+ export declare function withOwnImages(spec: SandboxSpec): SandboxSpec;
323
368
  /** A spec this provider can take as-is: its default size if it has one, else the router default. */
324
369
  export declare function fittingSpec(id: ProviderId): {
325
370
  vcpu: number;
package/dist/catalog.js CHANGED
@@ -34,7 +34,50 @@ export function listingOrder(spec = { vcpu: DEFAULT_VCPU, memoryGb: DEFAULT_MEMO
34
34
  * size (or by your measured cold starts), ties broken alphabetically. Nobody gets a better slot.
35
35
  * Prices come from each provider's public pricing page; PRs that correct one are welcome.
36
36
  */
37
+ /** Sellable Harness Runtime microVM shapes. Use the same allocation for pricing and create. */
38
+ const DIGITALOCEAN_SIZES = [
39
+ { slug: "mars-1vcpu-1gb", vcpu: 1, memoryGb: 1 },
40
+ { slug: "mars-2vcpu-2gb", vcpu: 2, memoryGb: 2 },
41
+ { slug: "mars-2vcpu-4gb", vcpu: 2, memoryGb: 4 },
42
+ { slug: "mars-4vcpu-8gb", vcpu: 4, memoryGb: 8 },
43
+ { slug: "mars-16vcpu-32gb", vcpu: 16, memoryGb: 32 },
44
+ ];
45
+ export function digitalOceanSize(vcpu, memoryGb) {
46
+ return DIGITALOCEAN_SIZES.find((size) => size.vcpu >= vcpu && size.memoryGb >= memoryGb);
47
+ }
48
+ export const GOOGLE_SHELL_SIZE = { vcpu: 1, memoryGb: 2 };
37
49
  const ENTRIES = [
50
+ {
51
+ id: "digitalocean",
52
+ name: "DigitalOcean Harness Runtime",
53
+ pricing: {
54
+ vcpuHour: 0.044,
55
+ gbHour: 0.0095,
56
+ source: "https://docs.digitalocean.com/products/managed-agents/agent-harness-runtime/details/pricing/",
57
+ checked: "2026-11-18",
58
+ note: "Actual CPU and allocated memory, per second; storage and outbound traffic separate. Positive Harness Runtime balance required.",
59
+ },
60
+ capabilities: ["pause"],
61
+ limits: { maxVcpu: 16, maxMemoryGb: 32 },
62
+ credentials: [["DIGITALOCEAN_TOKEN"], ["DIGITALOCEAN_ACCESS_TOKEN"]],
63
+ docs: "https://docs.digitalocean.com/products/managed-agents/agent-harness-runtime/how-to/run-sandbox/",
64
+ },
65
+ {
66
+ id: "google",
67
+ name: "Google Cloud Agent Platform",
68
+ pricing: {
69
+ vcpuHour: 0.085,
70
+ gbHour: 0.009,
71
+ source: "https://cloud.google.com/products/gemini-enterprise-agent-platform/pricing",
72
+ checked: "2026-11-18",
73
+ note: "Standard shell template estimate for 1 vCPU / 2 GiB. Allocated Agent Compute and Agent Memory, per second; storage separate.",
74
+ },
75
+ capabilities: ["pause"],
76
+ limits: { maxVcpu: GOOGLE_SHELL_SIZE.vcpu, maxMemoryGb: GOOGLE_SHELL_SIZE.memoryGb },
77
+ defaultSize: GOOGLE_SHELL_SIZE,
78
+ credentials: [["GOOGLE_SANDBOX_ENGINE", "GOOGLE_SANDBOX_TEMPLATE"]],
79
+ docs: "https://docs.cloud.google.com/gemini-enterprise-agent-platform/scale/sandbox/shell-sandbox-quickstart",
80
+ },
38
81
  {
39
82
  id: "docker",
40
83
  name: "Docker (local)",
@@ -429,6 +472,7 @@ ENTRIES.push({
429
472
  name: "Sailboxes (Sail Research)",
430
473
  pricing: {
431
474
  perSandboxUsd: 0.01,
475
+ perSandboxPlan: "free",
432
476
  vcpuHour: 0.015,
433
477
  gbHour: 0.008,
434
478
  note: "on what the box uses (CPU time, RAM it holds, disk $0.0007/GiB-h), sampled per second and not rounded up; RAM counts the VM's file cache, up to its memory limit (16 GiB at least), so file-heavy work can hold more than you asked for; paused/sleeping free; $0.01 per new Sailbox on the free plan, waived on Pro and Enterprise",
@@ -588,6 +632,8 @@ ENTRIES.push({
588
632
  */
589
633
  const P = "2026-11-06";
590
634
  const BILLING = {
635
+ digitalocean: { billing: "active-cpu" },
636
+ google: { billing: "allocated" },
591
637
  docker: { billing: "allocated" },
592
638
  agent37: { billing: "allocated" },
593
639
  agentcore: { billing: "active-cpu" },
@@ -683,6 +729,21 @@ export function vercelSandboxSize(spec) {
683
729
  const vcpu = Math.min(8, needed <= 1 ? 1 : Math.ceil(needed / 2) * 2);
684
730
  return { vcpu, memoryGb: vcpu * 2 };
685
731
  }
732
+ /** The per-sandbox fee a provider charges only on one plan (Sail's free plan), else 0. Published tables leave it out. */
733
+ export function planOnlyStartFee(id) {
734
+ const p = CATALOG.find((c) => c.id === id)?.pricing;
735
+ return p?.perSandboxPlan ? (p.perSandboxUsd ?? 0) : 0;
736
+ }
737
+ /** Every start fee that depends on the customer's account or plan, which published estimates exclude. */
738
+ export function accountStartFees() {
739
+ return Object.fromEntries(CATALOG.flatMap((c) => {
740
+ if (c.pricing.conditionalStartFee)
741
+ return [[c.id, c.pricing.conditionalStartFee]];
742
+ if (c.pricing.perSandboxPlan && c.pricing.perSandboxUsd)
743
+ return [[c.id, { minUsd: c.pricing.perSandboxUsd, maxUsd: c.pricing.perSandboxUsd, source: c.pricing.source, when: `on its ${c.pricing.perSandboxPlan} plan` }]];
744
+ return [];
745
+ }));
746
+ }
686
747
  /** How a provider turns running time into a bill: minimum, rounding and fixed per-sandbox charge. */
687
748
  export function billingRules(id) {
688
749
  const p = CATALOG.find((c) => c.id === id)?.pricing;
@@ -716,6 +777,14 @@ export function fixedSize(id, spec = {}) {
716
777
  const d = info(id).defaultSize;
717
778
  return d && !spec.image?.[id] ? { vcpu: d.vcpu, memoryGb: d.memoryGb } : null;
718
779
  }
780
+ /**
781
+ * The spec with a stand-in image for every provider whose default image fixes its size, so price tables can
782
+ * compare them at the asked size. Starting one for real needs your own image or template built at that size.
783
+ */
784
+ export function withOwnImages(spec) {
785
+ const image = Object.fromEntries(CATALOG.filter((c) => c.defaultSize).map((c) => [c.id, "your-image"]));
786
+ return { ...spec, image: { ...image, ...spec.image } };
787
+ }
719
788
  /** A spec this provider can take as-is: its default size if it has one, else the router default. */
720
789
  export function fittingSpec(id) {
721
790
  return fixedSize(id) ?? { vcpu: DEFAULT_VCPU, memoryGb: DEFAULT_MEMORY_GB };
@@ -732,6 +801,10 @@ function fullHourlyCost(id, spec = {}) {
732
801
  const size = vercelSandboxSize(spec);
733
802
  return size.vcpu * pricing.vcpuHour + size.memoryGb * pricing.gbHour;
734
803
  }
804
+ if (id === "digitalocean") {
805
+ const shape = digitalOceanSize(vcpu, mem) ?? DIGITALOCEAN_SIZES[DIGITALOCEAN_SIZES.length - 1];
806
+ return shape.vcpu * pricing.vcpuHour + shape.memoryGb * pricing.gbHour;
807
+ }
735
808
  // Blaxel sizes by memory, about 2 GB per core.
736
809
  if (id === "blaxel")
737
810
  mem = Math.max(mem, vcpu * 2);
@@ -813,6 +886,8 @@ export function cpuHourlyAtFull(id, spec = {}) {
813
886
  return vercelSandboxSize(spec).vcpu * p.pricing.vcpuHour;
814
887
  if (id === "cloudflare")
815
888
  return cloudflareInstance(vcpu, mem).vcpu * p.pricing.vcpuHour;
889
+ if (id === "digitalocean")
890
+ return (digitalOceanSize(vcpu, mem)?.vcpu ?? p.limits.maxVcpu) * p.pricing.vcpuHour;
816
891
  if (id === "upstash")
817
892
  return fullHourlyCost(id, spec);
818
893
  if (id === "deno")
@@ -839,13 +914,13 @@ export function unfit(id, spec, require = []) {
839
914
  const reserved = spec.ports?.find((port) => p.limits.reservedPorts?.includes(port));
840
915
  if (reserved !== undefined)
841
916
  return `port ${reserved} is reserved by the provider`;
842
- if ((spec.vcpu ?? DEFAULT_VCPU) > p.limits.maxVcpu)
917
+ const fixed = fixedSize(id, spec);
918
+ if ((spec.vcpu ?? fixed?.vcpu ?? DEFAULT_VCPU) > p.limits.maxVcpu)
843
919
  return `max ${p.limits.maxVcpu} vCPU`;
844
- if ((spec.memoryGb ?? DEFAULT_MEMORY_GB) > p.limits.maxMemoryGb)
920
+ if ((spec.memoryGb ?? fixed?.memoryGb ?? DEFAULT_MEMORY_GB) > p.limits.maxMemoryGb)
845
921
  return `max ${p.limits.maxMemoryGb} GB memory`;
846
922
  // A default image's size is fixed. With no size asked for you get that size, so only a size you
847
923
  // name can be too big for it.
848
- const fixed = fixedSize(id, spec);
849
924
  if (fixed && ((spec.vcpu ?? 0) > fixed.vcpu || (spec.memoryGb ?? 0) > fixed.memoryGb))
850
925
  return `default image is ${fixed.vcpu} vCPU / ${fixed.memoryGb} GB; a bigger size needs image.${id}`;
851
926
  return null;
package/dist/cli.js CHANGED
@@ -75,6 +75,7 @@ Route flags: --provider e2b[,modal,...] --strategy balanced|verified|cheapest|
75
75
  --max-price USD (per hour, for this run: skip providers that would cost more)
76
76
  --no-fallback --fallback-any (also on setup errors like a bad key)
77
77
  --create-timeout SEC (per provider, default 120) --require gpu,custom-image
78
+ --image e2b=TEMPLATE,daytona=IMAGE (a provider's own image or template; lifts a default image's fixed size)
78
79
 
79
80
  Keys: one env var group per provider; "sandboxrouter providers" lists them and shows which are set.
80
81
  --by puts your GitHub username on a saved result, so the website can credit it.`;
@@ -105,6 +106,7 @@ const { values, positionals } = parseArgs({
105
106
  reuse: { type: "boolean" },
106
107
  spread: { type: "boolean" },
107
108
  setup: { type: "string" },
109
+ image: { type: "string" },
108
110
  seconds: { type: "string" },
109
111
  even: { type: "boolean" },
110
112
  parallel: { type: "string" },
@@ -148,6 +150,8 @@ const spec = {
148
150
  timeoutMinutes: num(values.timeout),
149
151
  expectedSeconds: num(values.expect),
150
152
  cpuUtilization: num(values.cpu),
153
+ // --image e2b=my-template,daytona=debian:12 : a provider's own image or template, which also lifts its default image's fixed size.
154
+ ...(values.image ? { image: Object.fromEntries(values.image.split(",").map((pair) => pair.split(/=(.*)/s).slice(0, 2).map((x) => x.trim()))) } : {}),
151
155
  };
152
156
  const providers = list(values.provider);
153
157
  const by = (() => {
package/dist/index.d.ts CHANGED
@@ -33,6 +33,8 @@ export { NorthflankProvider } from "./providers/northflank.js";
33
33
  export { BoatProvider } from "./providers/boat.js";
34
34
  export { ExeDevProvider } from "./providers/exedev.js";
35
35
  export { AgentCoreProvider } from "./providers/agentcore.js";
36
+ export { DigitalOceanProvider } from "./providers/digitalocean.js";
37
+ export { GoogleAgentPlatformProvider } from "./providers/google.js";
36
38
  export { AzureSessionsProvider } from "./providers/azure.js";
37
39
  export { LambdaMicrovmProvider, writeLambdaMicrovmBundle } from "./providers/lambda.js";
38
40
  export { AlibabaProvider } from "./providers/alibaba.js";
package/dist/index.js CHANGED
@@ -33,6 +33,8 @@ export { NorthflankProvider } from "./providers/northflank.js";
33
33
  export { BoatProvider } from "./providers/boat.js";
34
34
  export { ExeDevProvider } from "./providers/exedev.js";
35
35
  export { AgentCoreProvider } from "./providers/agentcore.js";
36
+ export { DigitalOceanProvider } from "./providers/digitalocean.js";
37
+ export { GoogleAgentPlatformProvider } from "./providers/google.js";
36
38
  export { AzureSessionsProvider } from "./providers/azure.js";
37
39
  export { LambdaMicrovmProvider, writeLambdaMicrovmBundle } from "./providers/lambda.js";
38
40
  export { AlibabaProvider } from "./providers/alibaba.js";
@@ -1,6 +1,6 @@
1
1
  import { readdirSync, readFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
- import { benchmarksPublishable, billingRules, CATALOG, cpuHourlyAtFull, hourlyCost } from "./catalog.js";
3
+ import { benchmarksPublishable, billingRules, CATALOG, cpuHourlyAtFull, hourlyCost, planOnlyStartFee } from "./catalog.js";
4
4
  import { BILLED_VS_LIST } from "./billing.js";
5
5
  import { AGENT_TASK_VERSION } from "./agent-bench.js";
6
6
  import { isCurrentTask, TASK_VERSION, taskByVersion, taskUsd } from "./task.js";
@@ -185,7 +185,8 @@ export function taskTable(reports, version = TASK_VERSION, cohort = DEFAULT_SIZE
185
185
  taskMs: taskMillis,
186
186
  phasesMs,
187
187
  hourlyUsd,
188
- taskUsd: taskUsd(id, size, createMs, taskMillis, cpuMs, ratio, false, maxCoreMs),
188
+ // A fee only one plan pays (Sail's free plan) is noted beside the table, not counted in it.
189
+ taskUsd: taskUsd(id, size, createMs, taskMillis, cpuMs, ratio, false, maxCoreMs) - planOnlyStartFee(id),
189
190
  reusedUsd: taskUsd(id, size, createMs, taskMillis, cpuMs, ratio, true, maxCoreMs),
190
191
  runs,
191
192
  ok,
@@ -194,7 +195,7 @@ export function taskTable(reports, version = TASK_VERSION, cohort = DEFAULT_SIZE
194
195
  ...(cpuMs !== undefined ? { cpuMs } : {}),
195
196
  activeCpu: cpuHourlyAtFull(id, size) > 0,
196
197
  minimumSeconds: rules.minSeconds,
197
- perSandboxUsd: rules.perSandboxUsd,
198
+ perSandboxUsd: rules.perSandboxUsd - planOnlyStartFee(id),
198
199
  measuredAt: xs.map((x) => x.date).sort().at(-1),
199
200
  }];
200
201
  });
@@ -405,6 +406,6 @@ export function agentTable(reports) {
405
406
  }
406
407
  }
407
408
  return [...latest.values()]
408
- .map(({ row, date, model }) => ({ ...row, name: CATALOG.find((c) => c.id === row.provider).name, measuredAt: date, model }))
409
+ .map(({ row, date, model }) => ({ ...row, ...(row.medianUsd !== undefined ? { medianUsd: Math.max(0, row.medianUsd - planOnlyStartFee(row.provider)) } : {}), name: CATALOG.find((c) => c.id === row.provider).name, measuredAt: date, model }))
409
410
  .sort((a, b) => b.ok / Math.max(1, b.requested ?? b.runs) - a.ok / Math.max(1, a.requested ?? a.runs) || (a.medianUsd ?? Infinity) - (b.medianUsd ?? Infinity));
410
411
  }
@@ -1,4 +1,4 @@
1
- import { CATALOG } from "./catalog.js";
1
+ import { CATALOG, planOnlyStartFee, withOwnImages } from "./catalog.js";
2
2
  import { median } from "./bench-store.js";
3
3
  import { Router, rankUsd, runHours } from "./router.js";
4
4
  import { VERIFIED } from "./verified.js";
@@ -32,10 +32,13 @@ export function priceIndex(verified = Object.keys(VERIFIED)) {
32
32
  return INDEX_LINES.map((line) => {
33
33
  const hours = runHours(line.spec);
34
34
  const costs = router
35
- .plan(line.spec, { strategy: "cheapest" })
35
+ // Every provider at the line's size, including those that need your own image to run it.
36
+ .plan(withOwnImages(line.spec), { strategy: "cheapest" })
36
37
  .filter((c) => !c.skip)
37
38
  // What the unit of work costs: a run of `hours`, times how many runs the line counts.
38
- .map((c) => ({ provider: c.provider, usd: rankUsd(c, hours) * hours * line.scale }));
39
+ // Without a fee only one plan pays, like the published tables.
40
+ .map((c) => ({ provider: c.provider, usd: (rankUsd(c, hours) * hours - planOnlyStartFee(c.provider)) * line.scale }))
41
+ .sort((a, b) => a.usd - b.usd);
39
42
  const best = costs[0];
40
43
  const round = (n) => Math.round(n * 1e6) / 1e6;
41
44
  return {
@@ -1,13 +1,13 @@
1
1
  import { DEFAULT_MEMORY_GB, DEFAULT_VCPU } from "../catalog.js";
2
2
  import { ProviderError } from "../types.js";
3
- import { DEFAULT_EXEC_TIMEOUT_S, dirname, optionalImport, shq, timeoutError, toBytes } from "../util.js";
3
+ import { DEFAULT_EXEC_TIMEOUT_S, dirname, optionalImport, timeoutError, toBytes } from "../util.js";
4
4
  /**
5
5
  * Beam (beam.cloud) sandboxes via the official `@beamcloud/beam-js` SDK (checked against 1.1.6).
6
6
  * Auth: BEAM_TOKEN and BEAM_WORKSPACE_ID (the TS SDK refuses requests without the workspace id).
7
7
  * new Sandbox({ name, cpu, memory: MiB, gpu?, image?, keepWarmSeconds, env }).create()
8
8
  * -> SandboxInstance (containerId is the sandbox id)
9
9
  * Sandbox.connect(id) reattach by id
10
- * instance.execShell(text, { cwd, env, wait }) start a process; .wait() -> exit code,
10
+ * instance.exec(argv, { cwd, env, wait }) start a process; .wait() -> exit code,
11
11
  * .stdout / .stderr are polled streams (async-iterable by line, or .read() for all so far)
12
12
  * instance.fs.writeBytes(path, buf) / fs.readBytes(path)
13
13
  * instance.terminate()
@@ -115,7 +115,8 @@ class BeamBox {
115
115
  try {
116
116
  // Never `wait: true`: that call returns only when the command exits, so the deadline below
117
117
  // could not start until it was already too late to enforce.
118
- proc = await this.sb.execShell(cmd, { cwd: opts.cwd, env, wait: false });
118
+ // Beam's gateway treats execShell input like argv on some accounts.
119
+ proc = await this.sb.exec(["sh", "-c", cmd], { cwd: opts.cwd, env, wait: false });
119
120
  }
120
121
  catch (err) {
121
122
  throw fail(err, "exec");
@@ -155,7 +156,7 @@ class BeamBox {
155
156
  catch {
156
157
  // Most likely a missing parent directory: create it and try once more.
157
158
  try {
158
- const p = await this.sb.execShell(`mkdir -p ${shq(dirname(path))}`, { wait: true });
159
+ const p = await this.sb.exec(["mkdir", "-p", "--", dirname(path)], { wait: true });
159
160
  await p.wait();
160
161
  await this.sb.fs.writeBytes(path, buf);
161
162
  }
@@ -0,0 +1,16 @@
1
+ import { type Provider, type ProviderSandbox, type SandboxSpec } from "../types.js";
2
+ export declare class DigitalOceanProvider implements Provider {
3
+ private token;
4
+ private baseUrl;
5
+ readonly id: "digitalocean";
6
+ constructor(token?: string | undefined, baseUrl?: string);
7
+ configured(): boolean;
8
+ /** @internal */
9
+ request<T>(method: string, path: string, body?: unknown, timeoutMs?: number): Promise<T>;
10
+ create(spec: SandboxSpec): Promise<ProviderSandbox>;
11
+ connect(nativeId: string): Promise<ProviderSandbox>;
12
+ /** @internal */
13
+ remove(path: string): Promise<void>;
14
+ private getSession;
15
+ private waitReady;
16
+ }
@@ -0,0 +1,174 @@
1
+ import { randomBytes } from "node:crypto";
2
+ import { digitalOceanSize, DEFAULT_MEMORY_GB, DEFAULT_VCPU } from "../catalog.js";
3
+ import { ProviderError } from "../types.js";
4
+ import { DEFAULT_EXEC_TIMEOUT_S, killedByTimeout, timeoutError, wrapCommand } from "../util.js";
5
+ import { ShellFiles } from "./shell-files.js";
6
+ /**
7
+ * DigitalOcean Harness Runtime. Start a harness-free microVM from an Environment Config,
8
+ * then use its session API to execute commands, pause, resume and delete. The temporary
9
+ * config is soft-deleted after the session is created. The service exposes an idle pause
10
+ * timeout rather than a wall-clock deletion deadline.
11
+ * https://docs.digitalocean.com/products/managed-agents/agent-harness-runtime/how-to/run-sandbox/
12
+ * https://docs.digitalocean.com/reference/api/reference/harness-runtime/
13
+ */
14
+ const ID = "digitalocean";
15
+ const API = "/v2/harness-runtime";
16
+ const BOOT_TIMEOUT_MS = 110_000;
17
+ const MAX_EXEC_SECONDS = 240;
18
+ function statusOf(session) {
19
+ return session.status?.replace(/^SESSION_STATUS_/, "");
20
+ }
21
+ const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
22
+ export class DigitalOceanProvider {
23
+ token;
24
+ baseUrl;
25
+ id = ID;
26
+ constructor(token = process.env.DIGITALOCEAN_TOKEN || process.env.DIGITALOCEAN_ACCESS_TOKEN, baseUrl = process.env.DIGITALOCEAN_HARNESS_URL ?? "https://api.digitalocean.com") {
27
+ this.token = token;
28
+ this.baseUrl = baseUrl;
29
+ }
30
+ configured() {
31
+ return !!this.token;
32
+ }
33
+ /** @internal */
34
+ async request(method, path, body, timeoutMs = 30_000) {
35
+ if (!this.token)
36
+ throw new ProviderError(ID, "DIGITALOCEAN_TOKEN is not set");
37
+ const response = await fetch(`${this.baseUrl.replace(/\/$/, "")}${API}${path}`, {
38
+ method,
39
+ headers: {
40
+ Authorization: `Bearer ${this.token}`,
41
+ Accept: "application/json",
42
+ ...(body === undefined ? {} : { "Content-Type": "application/json" }),
43
+ },
44
+ body: body === undefined ? undefined : JSON.stringify(body),
45
+ redirect: "error",
46
+ signal: AbortSignal.timeout(timeoutMs),
47
+ });
48
+ const text = await response.text();
49
+ if (!response.ok) {
50
+ let detail = text.slice(0, 280);
51
+ try {
52
+ detail = JSON.parse(text).message ?? detail;
53
+ }
54
+ catch { /* non-JSON error */ }
55
+ throw new ProviderError(ID, `${method} ${path}: HTTP ${response.status} ${detail}`, response.status);
56
+ }
57
+ return (text ? JSON.parse(text) : {});
58
+ }
59
+ async create(spec) {
60
+ const size = digitalOceanSize(spec.vcpu ?? DEFAULT_VCPU, spec.memoryGb ?? DEFAULT_MEMORY_GB);
61
+ if (!size)
62
+ throw new ProviderError(ID, "no Harness Runtime size can satisfy the requested vCPU and memory");
63
+ const name = `sbr-${randomBytes(8).toString("hex")}`;
64
+ // Keep the caller's env out of the durable config.
65
+ const idleSeconds = Math.max(60, Math.ceil((spec.timeoutMinutes ?? 30) * 60));
66
+ const manifest = [`name: ${name}`, "harness: none", `size: ${size.slug}`, `idle_timeout: ${idleSeconds}s`].join("\n");
67
+ const { config } = await this.request("POST", "/configs", {
68
+ name,
69
+ manifest_yaml: manifest,
70
+ });
71
+ if (!config?.id)
72
+ throw new ProviderError(ID, "create config returned no config id");
73
+ const configPath = `/configs/${encodeURIComponent(config.id)}`;
74
+ let session;
75
+ try {
76
+ const result = await this.request("POST", "/sessions", { name, config_id: config.id });
77
+ session = result.session;
78
+ if (!session?.session_id)
79
+ throw new ProviderError(ID, "create session returned no session id");
80
+ await this.waitReady(session);
81
+ await this.remove(configPath);
82
+ return new DigitalOceanBox(this, session.session_id, spec.env);
83
+ }
84
+ catch (err) {
85
+ if (session?.session_id)
86
+ await this.remove(sessionPath(session.session_id)).catch(() => { });
87
+ await this.remove(configPath).catch(() => { });
88
+ throw err;
89
+ }
90
+ }
91
+ async connect(nativeId) {
92
+ const path = sessionPath(nativeId);
93
+ const session = await this.getSession(path);
94
+ if (statusOf(session) === "PAUSED")
95
+ await this.request("POST", `${path}/resume`, undefined, BOOT_TIMEOUT_MS);
96
+ await this.waitReady(statusOf(session) === "PAUSED" ? await this.getSession(path) : session);
97
+ return new DigitalOceanBox(this, nativeId);
98
+ }
99
+ /** @internal */
100
+ async remove(path) {
101
+ try {
102
+ await this.request("DELETE", path);
103
+ }
104
+ catch (err) {
105
+ if (!(err instanceof ProviderError) || err.status !== 404)
106
+ throw err;
107
+ }
108
+ }
109
+ async getSession(path) {
110
+ const { session } = await this.request("GET", path);
111
+ if (!session?.session_id)
112
+ throw new ProviderError(ID, "session missing", 404);
113
+ return session;
114
+ }
115
+ async waitReady(session) {
116
+ const path = sessionPath(session.session_id);
117
+ const until = Date.now() + BOOT_TIMEOUT_MS;
118
+ while (Date.now() < until) {
119
+ const status = statusOf(session);
120
+ if (status === "READY")
121
+ return;
122
+ if (status === "FAILED" || status === "DESTROYED" || status === "PAUSED") {
123
+ throw new ProviderError(ID, `session is ${status.toLowerCase()}`, status === "DESTROYED" ? 404 : undefined);
124
+ }
125
+ await delay(500);
126
+ session = await this.getSession(path);
127
+ }
128
+ throw new ProviderError(ID, "session did not become ready", 504);
129
+ }
130
+ }
131
+ function sessionPath(id) {
132
+ return `/sessions/${encodeURIComponent(id)}`;
133
+ }
134
+ class DigitalOceanBox {
135
+ provider;
136
+ nativeId;
137
+ env;
138
+ files = new ShellFiles(ID, (command) => this.exec(command));
139
+ constructor(provider, nativeId, env) {
140
+ this.provider = provider;
141
+ this.nativeId = nativeId;
142
+ this.env = env;
143
+ }
144
+ async exec(command, opts = {}) {
145
+ const t0 = Date.now();
146
+ const seconds = Math.min(MAX_EXEC_SECONDS, Math.max(1, Math.ceil(opts.timeoutSeconds ?? DEFAULT_EXEC_TIMEOUT_S)));
147
+ const path = `${sessionPath(this.nativeId)}/sandbox/exec`;
148
+ const cmd = wrapCommand(command, { env: { ...this.env, ...opts.env } });
149
+ const result = await this.provider.request("POST", path, {
150
+ argv: ["sh", "-c", cmd],
151
+ workdir: opts.cwd,
152
+ timeout_seconds: seconds,
153
+ }, (seconds + 15) * 1000);
154
+ const { exit_code, stdout = "", stderr = "" } = result;
155
+ if (typeof exit_code !== "number" || !Number.isInteger(exit_code))
156
+ throw new ProviderError(ID, "exec returned no exit code");
157
+ const durationMs = result.duration_ms ?? Date.now() - t0;
158
+ if (killedByTimeout(exit_code, durationMs, seconds))
159
+ throw timeoutError(ID, seconds);
160
+ if (stdout)
161
+ opts.onStdout?.(stdout);
162
+ if (stderr)
163
+ opts.onStderr?.(stderr);
164
+ return { stdout, stderr, exitCode: exit_code, durationMs };
165
+ }
166
+ readFile(path) { return this.files.readFile(path); }
167
+ writeFile(path, data) { return this.files.writeFile(path, data); }
168
+ async pause() {
169
+ await this.provider.request("POST", `${sessionPath(this.nativeId)}/pause`, undefined, BOOT_TIMEOUT_MS);
170
+ }
171
+ async kill() {
172
+ await this.provider.remove(sessionPath(this.nativeId));
173
+ }
174
+ }
@@ -0,0 +1,23 @@
1
+ import { type Provider, type ProviderSandbox, type SandboxSpec } from "../types.js";
2
+ export declare class GoogleAgentPlatformProvider implements Provider {
3
+ private engine;
4
+ private template;
5
+ private token;
6
+ private baseUrl?;
7
+ readonly id: "google";
8
+ private auth?;
9
+ constructor(engine?: string | undefined, template?: string | undefined, token?: string | undefined, baseUrl?: string | undefined);
10
+ configured(): boolean;
11
+ private engineName;
12
+ private headers;
13
+ /** @internal */
14
+ request<T>(method: string, resource: string, body?: unknown, timeoutMs?: number): Promise<T>;
15
+ private sandboxName;
16
+ create(spec: SandboxSpec): Promise<ProviderSandbox>;
17
+ connect(nativeId: string): Promise<ProviderSandbox>;
18
+ /** @internal */
19
+ action(name: string, action: "pause" | "resume"): Promise<void>;
20
+ /** @internal */
21
+ remove(name: string): Promise<void>;
22
+ private wait;
23
+ }