docs
DocumentationAPI referenceFor agents
SDKs
Markdown

TypeScript SDK

Use the current SDK build with explicitly selected compatibility routes.

Obtain the SDK#

Use the SDK build supplied for your deployment. Package names are provisional; this guide does not assume that a public npm release exists. Do not install an unrelated package with a similar name.

Create and clean up#

The current @tabs/sdk build can call the compatibility create, list and delete routes through tabs.api.request. This is an explicit choice of API, not an automatic fallback from tabs.sandboxes.create. The creation acknowledgement is not a connected envd guest descriptor. Keep the original createAttempt for any uncertain retry; applications that need restart-safe retries must persist it before sending.

This example deletes an acknowledged VM in finally. If create has an uncertain outcome, replay the unchanged request with createAttempt before deciding whether cleanup is needed. It does not call asE2B, commands or files, and does not claim that the native SDK adapter is ready. Use your configured secret manager or environment for TABS_API_KEY; the example never prints it.

ts
import { Tabs } from '@tabs/sdk';

const apiKey = process.env.TABS_API_KEY;
if (!apiKey) throw new Error('Set TABS_API_KEY.');
const tabs = new Tabs({
  apiKey,
  baseUrl: 'https://api.runtabs.dev',
  maxRetries: 0,
});
const createAttempt = crypto.randomUUID();
let sandboxID;
try {
  const result = await tabs.api.request('post', '/v2/sandboxes', {
    body: {
      templateID: 'ubuntu', metadata: { name: 'my-agent' },
      timeout: 300, autoPause: true,
    },
  }, { idempotencyKey: createAttempt });
  sandboxID = result.sandboxID;
  const running = await tabs.api.request('get', '/v2/sandboxes', {});
  // This is control-plane access, without guest command/file credentials.
} finally {
  if (sandboxID) await tabs.api.request('delete', '/sandboxes/{sandboxID}', {
    path: { sandboxID },
  }, { idempotencyKey: crypto.randomUUID() });
}

Native SDK methods#

The SDK exposes a broader contract than this deployed gateway. Calling a native create method does not implicitly switch to the compatibility API. Check capabilities and preserve unsupported responses instead of fabricating a guest descriptor.