Skip to Content
Tara Docs

SDK

@tara/sdk, the TypeScript client every TaraSpace app uses.

@tara/sdk is the TypeScript client that the web, the terminal and the desktop app use to talk to TaraSpace. Apps show; the servers decide, and the SDK is how apps ask them.

The SDK is not published to npm yet. Until it is, call the Models API and MCP directly; everything below maps one-to-one to those routes.

Clients

Each client takes { baseUrl, token }, where token is an async function returning the bearer token, and an optional fetch.

ClientForMain methods
createTaraModelsModels APIlist, embed, rerank, image, speech, search
createTaraSandboxesSandboxesinfo, list, get, start, stop, exec, readFile, writeFile, preview
createTaraAppsApps API (signed in)list, describe, run(app, action, inputs, { yes, key })
createTaraChatChats (signed in)list, read, send, events, stop, answer, style, saveStyle
createTaraSpacesSpaces (signed in)Spaces, files and doors
createTaraArtifactsArtifacts (signed in)Artifacts and their versions
createTaraApiSign-in and bookingsDevice sign-in (waitForDevice), slots, bookings

Example

import { createTaraModels, createTaraSandboxes } from "@tara/sdk";

const options = { baseUrl: "https://<your TaraSpace address>", token: async () => process.env.TARA_API_KEY! };

const models = createTaraModels(options);
const vectors = await models.embed("<embedding model>", ["first text", "second text"]);

const sandboxes = createTaraSandboxes(options);
const box = await sandboxes.start(300);
const out = await sandboxes.exec(box.id, "python3 -c 'print(6*7)'");
console.log(out.stdout);
await sandboxes.stop(box.id);

Errors

Every client throws TaraError with status and a readable message. See Keys and errors.

Chat replies

createTaraChat follows TaraSpace's chat model: send saves the message and returns at once, events watches the reply, and only stop ends it. replyParts and threadStyle turn a reply into what to draw for the person's chat style, so every app shows replies the same way.