Client
Create one BlazingAgents instance for a Tenant credential and reuse its generation methods and resource properties. The SDK adds the bearer header, serializes requests, and validates successful JSON resource responses.
Overview
The constructor signature is new BlazingAgents(options: BlazingAgentsOptions).
| Option | Required | Default | Behavior |
|---|---|---|---|
apiKey: string | Yes | — | Sent as Authorization: Bearer <apiKey> on every request. |
baseUrl?: string | No | http://localhost:8787 | Trailing slashes are removed. |
fetch?: BlazingAgentsFetch | No | globalThis.fetch | Replaces the transport for instrumentation, tests, or runtime integration. |
Resources
BlazingAgents exposes agents, sessions, sandboxes, skills, providers, mcpConnections, memories, prompts, apiKeys, usage, artifacts, tasks, and tenant, plus chat(), completion(), and object().
Cancellation
Generation inputs accept signal. sessions.decideToolApproval() and sessions.joinToolApprovalContinuation() accept { signal }; other resource methods do not expose per-request cancellation. If fetch throws, including because a signal aborts, the SDK raises BlazingAgentsError with code: "network_error".
Errors
BlazingAgentsError has code, optional HTTP status, and a cross-package isInstance() guard. Branch on code, not the changeable human-readable message. See the canonical BlazingAgentsErrorCode catalog.
Example
import { BlazingAgents } from "@blazing-agents/sdk";
const client = new BlazingAgents({
apiKey: process.env.BLAZING_AGENTS_API_KEY!,
baseUrl: "https://api.example.com/",
fetch: async (input, init) => {
console.log(init?.method ?? "GET", input);
return fetch(input, init);
},
});
const { agents } = await client.agents.list();