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 aiInitialize 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
| Object | What it manages |
|---|---|
BlazingAgents | Client options plus chat(), completion(), and object() |
agents | Agents, their versions, avatars, and MCP settings |
workspaces | Workspaces and their network rules |
agent({ agentId }).skills | One agent's skills and skill files |
sessions | Conversation history and tool approvals |
providers | Model provider keys and model lists |
mcpConnections | Remote MCP servers and their sign-in |
memories | Notes an agent keeps across sessions |
artifacts | Files agents publish, and their downloads |
tasks | Background tasks, runs, and schedules |
prompts | Reusable prompt templates |
usage | Token and request usage |
tenant | Tenant name and settings |
chatConnections | Slack and Telegram bots |
chatDeliveries | Failed and ambiguous deliveries across your Slack and Telegram bots |
merchantConnection, merchantBindings, merchantUsageEvents | Billing 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.