Artifacts
client.artifacts reads immutable files an Agent deliberately delivered from its workspace. Scratch files are not Artifacts; Attribution is inherited from the producing Session.
Overview
Lists are Agent-scoped, newest first, and omit tombstones unless includeDeleted is true. Filter by Session or exact userId; cursors are opaque.
Methods
list()
list(agentId: string, options?: { cursor?: string; includeDeleted?: boolean; sessionId?: string; userId?: string }): Promise<ArtifactsListResponse> — GET .../artifacts. Deleted records carry deletedAt.
download()
download(agentId: string, artifactId: string): Promise<Response> — GET .../artifacts/:artifactId. The raw response preserves stored bytes, media type, content length, attachment disposition, and nosniff; consume it once with arrayBuffer(), text(), or a stream.
delete()
delete(agentId: string, artifactId: string): Promise<void> — DELETE .../artifacts/:artifactId. Deletion durably reclaims bytes and keeps a product tombstone.
Types
ArtifactListItem includes Artifact, Agent, Tenant, and Session IDs; filename, media type, byte size, Attribution, timestamps, and nullable deletedAt. Lists return { data, nextCursor }. See objects and schemas.
Errors
A tombstoned download returns HTTP 410 and the SDK maps it to not_found with status: 410. Missing or foreign records are non-enumerating not_found. See errors.
Example
import { BlazingAgents } from "@blazing-agents/sdk";
const client = new BlazingAgents({ apiKey: process.env.BLAZING_AGENTS_API_KEY! });
const agentId = "ag_0123456789abcdef";
const sessionId = "ss_0123456789abcdef";
const page = await client.artifacts.list(agentId, {
sessionId,
includeDeleted: false,
});
const artifact = page.data[0];
if (artifact) {
const response = await client.artifacts.download(agentId, artifact.artifactId);
const bytes = await response.arrayBuffer();
console.log(response.headers.get("content-type"), bytes.byteLength);
await client.artifacts.delete(agentId, artifact.artifactId);
}