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.
| Client | For | Main methods |
|---|---|---|
createTaraModels | Models API | list, embed, rerank, image, speech, search |
createTaraSandboxes | Sandboxes | info, list, get, start, stop, exec, readFile, writeFile, preview |
createTaraApps | Apps API (signed in) | list, describe, run(app, action, inputs, { yes, key }) |
createTaraChat | Chats (signed in) | list, read, send, events, stop, answer, style, saveStyle |
createTaraSpaces | Spaces (signed in) | Spaces, files and doors |
createTaraArtifacts | Artifacts (signed in) | Artifacts and their versions |
createTaraApi | Sign-in and bookings | Device 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.