Brain Python SDK
Install with python -m pip install aex-brain==2.0.0. Requires Python 3.11+;
there are no runtime dependencies. Import the client from brain and generated
TypedDict definitions from brain.types. The wheel includes PEP 561 type data.
import os
from contextlib import closing
from brain import Brain
brain = Brain('http://127.0.0.1:8080', os.environ['BRAIN_API_KEY'])
session = brain.create({
'harness': 'pi', 'config': {'model': 'openai/gpt-4.1-mini', 'tools': []},
})
message = brain.send(session['id'], {'type': 'user.message', 'text': 'Hello!'})
with closing(brain.observe(session['id'])) as events:
for event in events:
if event['type'] == 'assistant.message':
print(event['data']['text'])
if event.get('input_id') != message['id']:
continue
if event['type'] == 'session.error':
raise RuntimeError(event['data']['message'])
if event['type'] == 'session.status' and event['data']['status'] == 'idle':
break
This is a synchronous client. timeout=30 configures the socket timeout, including
stream reads. Requests are never automatically retried. BrainError preserves the
HTTP status, server error code, and request ID. Closing the observer does not stop
execution; call interrupt(session_id) for that.
Pass runtime_tools=[RuntimeTool(...)] to create() to run Python functions in
your client over an SDK-owned SSE/HTTP connection. Keep the process alive, honor
context.cancelled, and call dispose() on shutdown. Use rebind() after recovery;
callbacks are never automatically replayed.
Pin the package and matching server image commit recorded by the release workflow. SDK reference · Server setup
Metadata
Release files for aex-brain 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| aex_brain-2.0.0.tar.gz | 6.7 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aex_brain-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.6 kB
Release files / aex_brain-2.0.0.tar.gz
| Download URL | aex_brain-2.0.0.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6a26988ab43cf0d950880972044d8103305433abe47be7550e14d73731df338c
|
|
BLAKE2b-256 checksum How to use checksums |
803ad158d66d3bdfca774fb537cdc5df76956464c28e89a2550cdf31c82d4912
|
| 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 17, 2026.
Transparency logRelease files / aex_brain-2.0.0-py3-none-any.whl
| Download URL | aex_brain-2.0.0-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5046d81c560eda6acfbea7fe44d968b890fe634975238e0a9745ef37be7308ce
|
|
BLAKE2b-256 checksum How to use checksums |
417fcae4a6c742171579f74507189c9d90c1473234ef53f9b16b176d22c75c04
|
| 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 17, 2026.
Transparency logSecurity for aex-brain 2.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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for aex_brain-2.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 Oct 17, 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.