Skip to main content

brokkr-client

Ergonomic Python client for the Brokkr broker API.

pip install brokkr-client

The import name is brokkr (from brokkr import BrokkrClient); the PyPI distribution name is brokkr-client.

Version

The SDK version matches the broker version. Install the release that has the same version as your broker. See the releases page.

First deployment

This example makes a folder of manifests the desired state of a stack, then prints the result. It uses a generator PAK. A generator owns the stacks that it creates. An admin can create a generator with brokkr-broker create generator --name <name> or POST /api/v1/generators. The broker shows the PAK only once.

Put one manifest in a folder:

# manifests/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: hello-brokkr
  namespace: default
data:
  greeting: hello

Then apply the folder:

import asyncio

from brokkr import BrokkrClient


async def main() -> None:
    client = BrokkrClient(
        "http://localhost:3000",  # broker URL; the client adds /api/v1
        token="<generator PAK>",
    )
    result = await client.apply("hello-brokkr", "./manifests", ["env:dev"])
    print("status:", result.status)  # created | updated | unchanged
    if result.deployment_object is not None:
        obj = result.deployment_object
        print("stack:", obj.stack_id)
        print("sequence id:", obj.sequence_id)


asyncio.run(main())

The base URL can be the broker root (http://localhost:3000) or end in /api/v1. The client adds /api/v1 when it is absent and never adds it twice. The brokkr CLI uses the same rule.

apply creates the stack if it does not exist, adds the targeting labels (env:dev), and submits a new revision only when the folder changed. Run it again with no change and the status is unchanged. Agents whose labels match the stack's targeting deploy the revision.

With an admin PAK, name the generator that owns the stack: await client.apply("hello-brokkr", "./manifests", generator="<generator name>").

What the wrapper adds

This is a thin wrapper around the auto-generated brokkr-client-generated package (produced by openapi-python-client from the broker's OpenAPI spec). The wrapper adds:

  • A single-credential constructor that injects the Authorization header on every request. The three security schemes the spec declares (admin_pak / agent_pak / generator_pak) all map to the same header and the broker disambiguates at runtime. The wrapper hides that detail.
  • submit_manifests and apply, which read a folder (or file) of manifests, validate each document, and submit it as a stack's desired state.
  • BrokkrError, a single exception type that wraps the generated typed ErrorResponse and exposes .code for stable pattern-matching.
  • An opt-in retry(...) helper with exponential backoff for transient transport / 5xx failures. Retry is per-call so callers decide which operations (typically idempotent GETs) are safe.

Pagination iterators are intentionally absent: the v1 broker API returns full collections without cursor tokens. Stream-style adapters belong here when the API adds pagination.

The wrapper is intentionally small. Most of the surface is the generated client; reach for it via client.api when the wrapper doesn't cover what you need.

For the full guide, see the Python SDK documentation.

Metadata

Release files for brokkr-client 0.10.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 brokkr-client 0.10.0
File Size Uploaded
brokkr_client-0.10.0.tar.gz 9.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for brokkr-client 0.10.0
File Interpreter ABI Platform
brokkr_client-0.10.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.0 kB

Release files / brokkr_client-0.10.0.tar.gz

Download URL brokkr_client-0.10.0.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
dce3bbd9deee5e0a45746780dc63a4697417ec26e2be3253b22ce9c9fbe3c12c
BLAKE2b-256 checksum
How to use checksums
e9064479693529289c3a20d6fa140d0b2541c03cde1b4d988a84b7fbe15d637a
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 Oct 13, 2026.

Transparency log

Release files / brokkr_client-0.10.0-py3-none-any.whl

Download URL brokkr_client-0.10.0-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0889a7081b345ada1d63de6de2647252251b419bb014828f2f3573505caa0196
BLAKE2b-256 checksum
How to use checksums
7af1f7a5bdde13ee5067a6106495b265f2ac88408f23d62039538b25f578f311
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 Oct 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.10.0 This release

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.4

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

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