The repository or configuration that created this release differ from a previous release. View details.
bma-sdk
Python client for the BMA REST API, generated from
contracts/bma/rest.openapi.yaml, plus
the BMA extensions to the Anthropic Managed Agents API.
| Version | see CHANGELOG |
| Contract | BMA REST snapshot recorded in contracts/bma/lock.json |
| Python | 3.10 or newer; depends on httpx and pydantic 2 |
pip install bma-sdk
from bma_sdk import Bma
# token, base_url, org_id and project_id default to BMA_TOKEN, BMA_BASE_URL,
# BMA_ORG_ID and BMA_PROJECT_ID
bma = Bma()
created = bma.agents.sessions.create(agent_id, idempotency_key="task-1")
bma.agents.inputs.create(
agent_id,
session_id=created.session.id,
content_blocks=[{"type": "text", "text": "Start the task."}],
)
for ev in bma.agents.events.stream(agent_id, session_id=created.session.id, stream_deltas=True):
if ev.event == "model_output": # narrows ev.data to ModelOutputEvent
print(ev.sequence, ev.data.content_blocks)
elif ev.event == "tool_call_update":
print(ev.data.tool_call_id, ev.data.state)
Pass base_url (or set BMA_BASE_URL) for your deployment: the origin, for
example https://api.staging.bma.beeos.ai; the client adds /api/v1 (a value
already ending in /api/v1 is accepted). The default https://api.bma.beeos.ai
is not live yet. org_id / project_id default to BMA_ORG_ID / BMA_PROJECT_ID; every
method accepts org_id= / project_id= to override them. AsyncBma has the same resources with
async methods.
- Methods follow
contracts/bma/sdk.resources.yaml: path IDs are positional, query, header and body fields are keyword arguments with their wire names. Omitted arguments are not sent;Nonesends JSONnull. - Types: responses are pydantic models and request objects are
TypedDicts (
TextContentBlockParam...), all inbma_sdk.types. Responses are built without validation, so fields a newer server adds are kept. - Pagination: every list whose response is
{data, next_<param>}(cursor,page,before_id/after_id,before_sequence/after_sequence) returns aSyncCursorPage(data,next_cursor= the next value of that parameter); iterating it walks every page (AsyncBma:awaitfor the first page,async forfor all).agents.events.listpages forward, or backward when you passbefore_sequence. - Event stream: frames are discriminated by
event. Like EventSource, the stream reconnects from the last durable frame (Last-Event-ID) when the connection drops, the server ends the response, or on aservice_unavailableerror frame, discarding a frame cut off at the end; it never ends on its own and raises oncemax_retriesreconnects in a row received no data. Any other error frame raisesEventStreamError. - Errors and retries:
BmaApiErrorsubclasses by status (NotFoundError,ConflictError,RateLimitError...) withcode. Reads and calls that accept anIdempotency-Keyretry 408/429/5xx and connection errors with a generated key reused across attempts; other writes retry only 429/503 and requests that never reached the server; 409 is never retried. Defaults: 2 retries, 60 s timeout (Bma(max_retries=, timeout=),bma.with_options(...),timeout=per call). The timeout is httpx's per-phase timeout (connect, write, read, pool), so long uploads and downloads are not cut off; pass anhttpx.Timeoutto set the phases orNonefor no timeout. A file objectbodyis rewound for a retry when it is seekable; an unseekable stream is sent once and never retried. - Downloads:
files.download,agents.artifacts.download, ... return thehttpx.Response;bma.agents.artifacts.download_verified(artifact, max_bytes=...)verifies size and sha256.
Custom tools
from pydantic import BaseModel
from bma_sdk import ToolContext, ToolError, define_tool
class Weather(BaseModel):
city: str
def get_weather(input: Weather, ctx: ToolContext) -> str:
return f"Sunny in {input.city}"
weather = define_tool(name="get_weather", description="Current weather", input_model=Weather, run=get_weather)
# weather.definition goes into the agent config under tools.get_weather
bma.agents.tool_calls.runner(agent_id, session_id=session_id, tools=[weather]).until_done()
Raise ToolError(text) to report a failed call to the model. With
AsyncBma, tools may be async and run concurrently. The runner reconnects
its event stream without limit by default (max_reconnects= bounds it),
treats a 409 on submit (another consumer answered) as handled, and
until_done() raises the error that stopped it; it returns only after
stop().
BMA extensions to the Anthropic facade
Use the official Anthropic SDK for /v1/agents, /v1/environments,
/v1/sessions and events. The routes BMA adds:
from bma_sdk.facade_extensions import FacadeExtensions, bma_sequence
with FacadeExtensions(api_key=api_key, base_url="https://host", project_id="proj_...") as ext:
ticket = ext.sessions.desktop.stream(session_id, desktop_session_id=desktop_id)
ext.sessions.files.upload(session_id, file=("report.pdf", data))
page = ext.sessions.files.list(session_id, limit=100)
Models such as ModelConfigOverride and MCPServerBMAAuth are in
bma_sdk.facade_extensions.types; bma_sequence(event) reads the resume
cursor of an Anthropic SDK event.
The executor protocol (executor, harness and agent ends) is the separate
package bma-executor-sdk.
Metadata
Release files for bma-sdk 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Change of provenance
The repository or configuration that created these release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bma_sdk-1.0.0.tar.gz | 154.2 kB | With provenance | Details for bma_sdk-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bma_sdk-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for bma_sdk-1.0.0-py3-none-any.whl |
Total release size: 308.2 kB
Release files / bma_sdk-1.0.0.tar.gz
Change of provenance
This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
| Download URL | bma_sdk-1.0.0.tar.gz |
|---|---|
| Size | 154.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f646236ac4e9e7ebda5cfd61a17c835410e9856384fa1d38ca804c89a7d826f5
|
|
BLAKE2b-256 checksum How to use checksums |
562d0f7579d63dc5b2fbc9443671c906eb8e27dcfb913a7c2ae546b8c8da0572
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 6, 2026.
Transparency logRelease files / bma_sdk-1.0.0-py3-none-any.whl
Change of provenance
This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
| Download URL | bma_sdk-1.0.0-py3-none-any.whl |
|---|---|
| Size | 154.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
41ff36d326fdda41673c45bf29c31851c537123896d337c435444bea759ce12f
|
|
BLAKE2b-256 checksum How to use checksums |
bda055c5373f61ee2089471094012089d85914baa21b3abf8f8d2b3aa48a3c56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 6, 2026.
Transparency logSecurity for bma-sdk 1.0.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.
Change of provenance
The repository and configuration that created this release differ from a previous release.
While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.
Repository
- Removed 0.4.1 github.com/beeos-ai/bma-sdks
- Added 1.0.0 github.com/beeos-ai/bma-sdk
Attestation for bma_sdk-1.0.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 6, 2026.
Transparency logA 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.