Silvanexumdocs

TypeScript SDK

Install and use @silvanexum/sdk — a fully typed client for Node and modern runtimes.

@silvanexum/sdk is the official TypeScript/JavaScript client. It ships dual ESM + CJS with bundled type declarations and runs on Node ≥ 20 (using the built-in fetch). All domain types are generated from the API's Zod contracts.

Install

npm install @silvanexum/sdk
# pnpm add @silvanexum/sdk · yarn add @silvanexum/sdk · bun add @silvanexum/sdk

Construct the client

import { Silvanexum } from "@silvanexum/sdk";
 
const sx = new Silvanexum({
  apiKey: process.env.SILVANEXUM_API_KEY, // default: env SILVANEXUM_API_KEY
  baseUrl: "https://api.silvanexum.com",  // default: env SILVANEXUM_BASE_URL or prod
  timeoutMs: 60_000,                       // per-request timeout
  maxRetries: 2,                           // retries 429 / 5xx / connection errors
});
OptionTypeDefault
apiKeystringSILVANEXUM_API_KEY env
baseUrlstringSILVANEXUM_BASE_URL env or https://api.silvanexum.com
timeoutMsnumber60000
maxRetriesnumber2
fetchFetchLikeglobal fetch
defaultHeadersRecord<string,string>{}

Errors

Every failure throws a typed subclass of SilvanexumError. Each carries status, code, body, and requestId.

import {
  SilvanexumError,
  AuthenticationError,    // 401
  PermissionError,        // 403 — key missing a scope
  ValidationError,        // 400 / 422
  NotFoundError,          // 404
  InsufficientCreditsError, // 402
  RateLimitError,         // 429 (already retried with backoff)
  InternalServerError,    // 5xx
} from "@silvanexum/sdk";
 
try {
  await sx.runs.create({ agentId, prompt });
} catch (err) {
  if (err instanceof InsufficientCreditsError) {
    // top up credits, then retry
  } else if (err instanceof SilvanexumError) {
    console.error(err.status, err.code, err.requestId, err.message);
  }
}

sx.agents

const agents = await sx.agents.list();               // AgentView[]
const { agent, myRating } = await sx.agents.get(id);
 
const created = await sx.agents.create({
  name: "Support Triage",
  description: "Triages inbound tickets.",
  config: { provider: "anthropic", model: "claude-opus-4-8", systemPrompt: "You triage support tickets." },
  connectorIds: [],
});
 
await sx.agents.update(created.id, { description: "Triages + drafts replies." });
await sx.agents.publish(created.id);   // make public
await sx.agents.fork(otherAgentId);    // fork into your org
await sx.agents.rate(id, 5);
await sx.agents.lineage(id);           // fork graph
await sx.agents.delete(id);
MethodReturns
list() / listPublic()AgentView[]
get(id){ agent, myRating }
create(input) / update(id, input)AgentView
publish(id) / fork(id) / unbindIdentity(id)AgentView
rate(id, rating){ reputation, myRating }
lineage(id)AgentLineage
bindIdentity(id, { agentCardUrl })AgentView
delete(id)void

sx.agents.versions — signed M01 versions

const v = await sx.agents.versions.publish(agentId, { semver: "1.0.0", changelog: "First release" });
await sx.agents.versions.promote(agentId, "1.0.0");        // → stable/live channel
const { valid } = await sx.agents.versions.verify(agentId, "1.0.0");
const all = await sx.agents.versions.list(agentId);         // AgentVersionView[]

sx.runs

const run = await sx.runs.create({ agentId, prompt: "..." });   // captured + signed
const again = await sx.runs.rerun({ executionId: run.id });     // re-run (diffable)
const full = await sx.runs.get(run.id);
await sx.runs.setVisibility(run.id, "public");
const url = sx.runs.shareUrl(run.id);                            // https://silvanexum.com/runs/...
const recent = await sx.runs.recent(15);

sx.templates (M11)

Template endpoints are part of the M11 P0 spec and may be planned (not yet live) on your deployment — see the API reference.

const templates = await sx.templates.list({ vertical: "support", sort: "runs" });
const detail = await sx.templates.get(templates[0].id);
const agent = await sx.templates.deploy(detail.id, { params: { tone: "concise" } }, {
  idempotencyKey: crypto.randomUUID(),
});

sx.connectors

const c = await sx.connectors.create({ providerConfigKey: "github", displayName: "GitHub" });
const { sessionToken } = await sx.connectors.session(c.id);  // hand to Nango Connect on the client
const connected = await sx.connectors.confirm(c.id, connectionId);
// then attach by id: sx.agents.update(agentId, { connectorIds: [connected.id] })

sx.marketplace

const results = await sx.marketplace.search({ q: "legal", sort: "proof" }); // ranked by outcomes
const probe = await sx.marketplace.tryListing(results[0].id, "Sample input");
const purchase = await sx.marketplace.purchase(results[0].id, crypto.randomUUID()); // idempotent
const installs = await sx.marketplace.myInstalls();

sx.wallet

const wallet = await sx.wallet.get();                       // balanceCredits, ...
const page = await sx.wallet.ledger({ limit: 50 });
const { checkoutUrl } = await sx.wallet.buyCredits(1000);   // redirect the buyer
await sx.wallet.createPayout(500, crypto.randomUUID());     // idempotent

sx.suites, sx.keys, sx.models, sx.team, sx.overview

const run = await sx.suites.run(suiteId);          // run.status is the pass/fail gate
const valid = await sx.keys.validate("openai", "sk-...");
const models = await sx.models.live("anthropic");  // live, key-scoped
const { members, yourRole } = await sx.team.listMembers();
const stats = await sx.overview.get();

All return types are exported from the package (e.g. import type { AgentView, ExecutionView } from "@silvanexum/sdk").

On this page