Skip to main content
@deepest/sdk provides generated TypeScript types and a zero-dependency client covering the entire Public API V1 contract. Authorization, resource admission, and lifecycle behavior remain server decisions: the SDK never retries automatically, manages lifecycle orchestration, or masks errors. Use it from a trusted environment that can securely hold an Agent API Key. For an end-to-end Agent example, see For Agents.

Install from npm

@deepest/sdk (0.1.0, MIT) is ESM-only and supports Node.js 18 or later using standard fetch:
Use .mjs files or "type": "module" in package.json.

Create a client and read resources

Set DEEPEST_API_URL (https://console.deepest.dev or your configured control origin, without appending /v1) and DEEPEST_API_KEY in the caller’s environment:
Pass the control origin without /v1 (the SDK includes operation paths automatically). Never pass a Preview, Share, or Viewer runtime URL as baseUrl.

Select a specific Machine

Collection namespaces (computers, sandboxes, tools, vault, agentKeys, resources, invites) list or create resources; computer(id) and sandbox(id) operate on a specific stable ID:
Always identify Machines by id, not display_name. Use deepest.sandboxes and deepest.sandbox(id) for Sandboxes—Computer-only namespaces (ssh, desktop, assistance, snapshots, preview, shares, tools, resize, clone, storage) do not exist on Sandboxes.

TypeScript result handling

All SDK methods return a discriminated union { ok: true; ... } | Failure. A small helper can narrow results while keeping the structured failure envelope intact:
Valid API errors return as Failure envelopes rather than rejected promises, while invalid constructor options or path identifiers ("", ".", "..") throw a client-side TypeError before any network call.

Authentication modes

Pass exactly one of apiKey or getSessionToken:
  • apiKey: Standard mode for Agents, CLI scripts, and trusted backend services using an Account-wide Agent API Key.
  • getSessionToken: Async callback (() => Promise<string | null>) used by authenticated Web Console sessions to obtain a fresh Human-session token per request (required for agentKeys.*, invites.redeem, and assistance.begin/touch/complete). The SDK never caches Human tokens across calls—never prompt users to paste browser session tokens into scripts or Agents.

Transport and recovery guarantees

  • Identifier & URL safety: Resource IDs are encoded as path components; empty, ., and .. identifiers are rejected before dispatch.
  • No redirects or browser cookies: Requests use redirect: "error" and credentials: "omit". If you supply a custom fetch, preserve those guarantees and avoid logging Authorization headers or Secret payloads.
  • No automatic retries: Transport failures, non-JSON responses, or HTTP/envelope mismatches return { ok: false, resource_id, retry: "query-first", error: { code: "UNKNOWN", ... } }. When resource_id falls back to "request", it means no Machine ID was known—never treat "request" as a created Machine ID.
On UNKNOWN (retry: "query-first"), always observe the original resource or task effect before retrying. For uncertain computers.create, sandboxes.create, clone, or snapshots.create, preserve the exact original idempotency_key and request parameters.
Continue with Account resources, Commands, Errors, Reliability and recovery, or the API Reference.