Python SDK

Artifacts

List, inspect, download, and delete the files your agents publish, with the Python SDK.

client.artifacts gives you the files your agents chose to publish, such as reports or exports. Each artifact is a fixed copy of the file at publish time. It keeps the IDs of the agent and session that published it, even after those are deleted.

Examples assume client = BlazingAgents(). Every method also accepts extra_headers and timeout. On AsyncBlazingAgents, await the same method names and use async for with iter().

for artifact in client.artifacts.iter(agent_id="ag_0123456789abcdef"):
    download = client.artifacts.create_download_url(artifact_id=artifact.artifact_id)
    print(artifact.filename, download.url)

Available operations

MethodDescriptionReturns
list()Get one page of artifactsArtifactsPage
iter()Iterate every artifactIterator[Artifact]
get()Get one artifact's detailsArtifact
create_download_url()Get a five-minute download linkArtifactDownloadUrl
delete()Delete an artifactNone

Methods

list()

Gets one page of 50 artifacts, newest first.

page = client.artifacts.list(agent_id="ag_0123456789abcdef", session_id="ss_0123456789abcdef")

Signature: list(*, agent_id=..., session_id=..., cursor=...) -> ArtifactsPage

Filter by agent, session, or both. Pass the previous page's next_cursor as cursor. Returns ArtifactsPage with data: list[Artifact] and next_cursor: str | None. Raises APIStatusError with validation_failed or invalid_cursor.

iter()

Iterates every matching artifact, fetching pages as you go.

for artifact in client.artifacts.iter(session_id="ss_0123456789abcdef"):
    print(artifact.filename, artifact.size_bytes)

Signature: iter(*, agent_id=..., session_id=..., cursor=...) -> Iterator[Artifact]

Takes the same parameters as list(). No request is sent until you start iterating. On the async client, use async for directly on iter(...); do not await it.

get()

Gets one artifact's details without downloading it.

artifact = client.artifacts.get(artifact_id="at_0123456789abcdef")
print(artifact.filename, artifact.media_type, artifact.size_bytes)

Signature: get(*, artifact_id: str) -> Artifact

Returns Artifact. Raises not_found.

create_download_url()

Creates a direct download link that expires after five minutes.

download = client.artifacts.create_download_url(artifact_id=artifact.artifact_id)
print(download.url, download.expires_at)

Signature: create_download_url(*, artifact_id: str) -> ArtifactDownloadUrl

Anyone with the link can download the file until it expires, so keep it out of logs and share it only with the intended user. Returns ArtifactDownloadUrl with url and expires_at. Raises not_found, or service_unavailable when downloads are temporarily unavailable.

delete()

Permanently deletes an artifact.

client.artifacts.delete(artifact_id=artifact.artifact_id)

Signature: delete(*, artifact_id: str) -> None

The original file in the agent's workspace is not touched. Deleting the same artifact again raises not_found.

Response models

Artifact

FieldTypeDescription
artifact_idstrArtifact ID (at_...)
tenant_idstrYour tenant ID
agent_idstrAgent that published it
session_idstrSession it was published in
filenamestrFile name
media_typestrMIME type
size_bytesintSize in bytes
user_idstrEnd user, or "" for tenant level
metadatadict[str, object]Metadata
created_at, updated_atdatetimeTimestamps

Next

On this page