TypeScript SDK

TypeScript SDK

Install the TypeScript client and find the method for every Blazing Agents operation.

@blazingagents/sdk gives your Node.js backend a typed client for every Blazing Agents operation. You configure agents and their resources through methods like client.agents.create(), and you run turns with client.chat(), which streams in the format the AI SDK useChat hook reads.

Server-side only

Your API key can reach every resource in your tenant. Keep it in backend code and never send it to a browser or mobile app.

Install

The SDK needs Node.js 24 or later and the ai package version 7 alongside it.

npm install @blazingagents/sdk ai

Initialize the client

import { BlazingAgents } from "@blazingagents/sdk";

export const client = new BlazingAgents({
  apiKey: process.env.BLAZING_AGENTS_API_KEY!,
});

The client talks to https://api.blazingagents.com, so you only pass your key. Creating it makes no network request. See Client for request correlation, a custom fetch, and response logging.

Common workflow

Connect a model provider, create an agent, and run a first turn:

import { BlazingAgents } from "@blazingagents/sdk";

const client = new BlazingAgents({
  apiKey: process.env.BLAZING_AGENTS_API_KEY!,
});

const provider = await client.providers.create({
  name: "OpenRouter",
  providerType: "openrouter",
  baseUrl: null,
  apiKey: process.env.OPENROUTER_API_KEY!,
});

const agent = await client.agents.create({
  name: "Support agent",
  providerId: provider.id,
  model: "openai/gpt-6-luna",
});

const result = await client.chat({
  agentId: agent.id,
  message: {
    id: crypto.randomUUID(),
    role: "user",
    parts: [{ type: "text", text: "How can I reset my password?" }],
  },
});

console.log(`Session: ${await result.sessionId}`);
console.log(await result.toResponse().text());

The last line prints the raw stream events, including the answer in text-delta events. Save the session ID and pass it as sessionId on the next chat() call to continue the conversation. In a web app, return result.toResponse() from your route instead of reading it. For one-off text or JSON without a session, use completion() or object().

Client objects

ObjectWhat it manages
BlazingAgentsClient options plus chat(), completion(), and object()
agentsAgents, their versions, avatars, and MCP settings
workspacesWorkspaces and their network rules
agent({ agentId }).skillsOne agent's skills and skill files
sessionsConversation history and tool approvals
providersModel provider keys and model lists
mcpConnectionsRemote MCP servers and their sign-in
memoriesNotes an agent keeps across sessions
artifactsFiles agents publish, and their downloads
tasksBackground tasks, runs, and schedules
promptsReusable prompt templates
usageToken and request usage
tenantTenant name and settings
chatConnectionsSlack and Telegram bots
chatDeliveriesFailed and ambiguous deliveries across your Slack and Telegram bots
merchantConnection, merchantBindings, merchantUsageEventsBilling your users

Every method takes one input object. Put IDs, fields, and an optional abortSignal side by side in it. See Cancellation.

Errors

Every failed request throws BlazingAgentsError. Branch on its code, and log its requestId if you contact support. See Client errors for the full list of fields and SDK codes.

Next

On this page