Skip to main content
Blazing Agents logo

Blazing Agents Python SDK

Build production agents in Python with a typed client for the Blazing Agents API.

Documentation · PyPI

The official Python SDK is a client for the Blazing Agents /v1 API that your backend uses to manage Agents and run them for your users. It supports CPython 3.11 and newer.

Features

  • A typed method for every /v1 operation an API key can call: Agents, Skills, Sessions, Memories, Prompts, Tasks, Workspaces, Artifacts, Providers, MCP Connections, Chat Connections, usage, spending limits, Tenant settings, and merchant monetization.
  • Chat streams in the AI SDK UI message stream format, with steering, Tool approvals, and backend functions that run in your process.
  • Text and structured-object generation.
  • End-user scoped clients through for_user.
  • A chat relay (AsyncChatRelay, ChatRelay) that serves the TypeScript SDK's browser chat hooks from your backend with any web framework.
  • Lazy pagination, uploads, and downloads.
  • Request IDs and typed errors.
  • Matching synchronous and asynchronous clients with Pydantic models.

Installation

pip install blazing-agents

Quick start

Create a Full API key in the Blazing Agents dashboard and set BLAZING_AGENTS_API_KEY in your server environment. The key acts for your whole Tenant, so keep it on your backend and never send it to a browser.

from blazing_agents import BlazingAgents

client = BlazingAgents()

answer = client.completion(
    agent_id="ag_...",
    prompt="Write a friendly welcome message.",
)
print(answer)

Replace ag_... with an Agent ID from the dashboard.

For requests from your users, scope the client to the user ID that your backend verified at sign-in, never to an ID from the request body. A scoped client reaches only that End-user's Agents, Sessions, and Workspace. An unscoped Agent shares one Workspace across all your users, so give each user an Agent of their own:

from uuid import uuid4

from blazing_agents import ChatStream


def create_agent_for_user(user_id: str) -> str:
    agent = client.for_user(user_id).agents.create(
        name="Assistant",
        provider_id="prv_...",
        model="openai/gpt-6-luna",
    )
    return agent.id


def chat_as_user(user_id: str, agent_id: str, text: str) -> ChatStream:
    return client.for_user(user_id).chat(
        agent_id=agent_id,
        message={
            "id": str(uuid4()),
            "role": "user",
            "parts": [{"type": "text", "text": text}],
        },
    )

Call create_agent_for_user once per user and store the Agent ID with the user. A scoped chat with an Agent created without the scope fails with 404. chat_as_user returns the chat as a stream of server-sent event bytes. Send it to the browser as a text/event-stream response, and AI SDK useChat reads it. For asyncio applications, AsyncBlazingAgents has the same methods.

Chat for browser apps

A browser holds no API key, so useBlazingAgentsChat from the TypeScript SDK posts every chat, history, and steering request to one URL on your backend. AsyncChatRelay answers it as the signed-in user; your backend adds only its sign-in. The relay depends on no web framework. With FastAPI:

from blazing_agents import AsyncBlazingAgents, AsyncChatRelay, RelayContext
from fastapi import FastAPI, Request
from fastapi.responses import StreamingResponse

client = AsyncBlazingAgents()


async def resolve_context(request: Request) -> RelayContext | None:
    user_id = await verified_user_id(request)  # your sign-in
    if user_id is None:
        return None  # answered with 401
    return RelayContext(agent_id=await agent_id_for(user_id), user_id=user_id)


relay = AsyncChatRelay(client=client, resolve_context=resolve_context)
app = FastAPI()


@app.post("/api/chat")
async def chat(request: Request) -> StreamingResponse:
    answer = await relay.handle(request, await request.body())
    return StreamingResponse(
        answer, status_code=answer.status_code, headers=answer.headers
    )

ChatRelay is the blocking twin for frameworks such as Flask.

Examples

The examples repository has complete TypeScript and Python apps built on the Blazing Agents SDKs.

Documentation

Read the Python SDK documentation for client setup, End-user scoping, chat and generation, a guide to each resource, and error handling.

Development

uv sync --locked
uv run ruff check .
uv run ruff format --check .
uv run python scripts/run_typechecks.py
uv run python scripts/run_tests.py

See CONTRIBUTING.md for the changelog convention and the release process.

License

MIT

Metadata

Release files for blazing-agents 0.36.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blazing-agents 0.36.0
File Size Uploaded Provenance Actions
blazing_agents-0.36.0.tar.gz 74.5 kB With provenance Details for blazing_agents-0.36.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for blazing-agents 0.36.0
File Interpreter ABI Platform Actions
blazing_agents-0.36.0-py3-none-any.whl Python 3 none any Details for blazing_agents-0.36.0-py3-none-any.whl

Total release size: 196.7 kB

Release files / blazing_agents-0.36.0.tar.gz

Download URL blazing_agents-0.36.0.tar.gz
Size 74.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3d2794f4a83ddfb72b5458fd33bbd1cd93f8e266882bcb14bd93c38bf0d56384
BLAKE2b-256 checksum
How to use checksums
624c63c9a516fa0989c6c8098c443d124948c086a15a846afcfbb65a0fa78156
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / blazing_agents-0.36.0-py3-none-any.whl

Download URL blazing_agents-0.36.0-py3-none-any.whl
Size 122.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45d1131d755c0eecc9e0c24dc6dbee30dbb4bd1868f3e881cf17313e884f0a2f
BLAKE2b-256 checksum
How to use checksums
267a1841d714c68c88cdf0aa993bf70b4c45a0a81799dd10d2d18c91f957bd23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for blazing-agents 0.36.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for blazing_agents-0.36.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.36.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page