TypeScript SDK¶
The official TypeScript / JavaScript client — npm install @telbox/sdk. Zero
runtime dependencies (uses the platform fetch); Node ≥ 18, Deno, Bun, browser.
import { TelboxClient, ir } from "@telbox/sdk";
const tb = new TelboxClient({ apiKey: "tb_live_…" }); // baseUrl defaults to api.telbox.ai
const agent = await tb.installTemplate("vip-watcher"); // or tb.createAgent(ir.agent(...))
const preview = await tb.dryRunAgent(agent.id); // no LLM, no side effects
const run = await tb.testRun(agent.id, "What's open this week?");
console.log(run.status, run.answer, run.trace);
Building agents¶
ir.* builds the AgentDefinitionIR. Argument bindings say where each tool
argument's value comes from:
| binding | meaning |
|---|---|
ir.literal(v) |
a fixed value |
ir.fromTrigger("message.message_id") |
from the firing event |
ir.fromStep("s1.result.hits[0].id") |
from an earlier step's result |
ir.prompt("hint") |
let the agent decide |
Triggers: ir.schedule(cron), ir.onMessage({ mention_required: true }),
ir.manual(). Guards: ir.guard("auto_act_limited", { approved_domains: ["acme.com"] }).
See Agents & the IR and Authority.
Methods¶
templates, tools, compile, dryRun, dryRunAgent, createAgent,
installTemplate, listAgents, getAgent, revokeAgent, testRun, listRuns,
getRun, createApiKey, agentMcpCall — each returns a typed result.
Errors¶
Every error extends TelboxError: AuthError (401/403), NotFoundError (404),
ValidationError (422), RateLimited (429, with .retryAfter), APIError.
Each has .status, .code, .body. Retries 429/5xx with backoff (maxRetries,
default 2).
Testable by injection
The client takes an injectable fetch (new TelboxClient({ apiKey, fetch })),
so you can unit-test your integration with no network.
Full README + source: sdks/typescript/ in the repo.