Skip to main content

Brain Python SDK

Install with python -m pip install aex-brain==1.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.

Pin the package and matching server image commit recorded by the release workflow. SDK reference · Server setup

Metadata

Release files for aex-brain 1.0.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 aex-brain 1.0.0
File Size Uploaded Provenance
aex_brain-1.0.0.tar.gz 4.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aex-brain 1.0.0
File Interpreter ABI Platform
aex_brain-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.8 kB

Release files / aex_brain-1.0.0.tar.gz

Download URL aex_brain-1.0.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5685a7e219ca62855c7c8d2c9d0ed054caf1b6f4500a56b35637682778369092
BLAKE2b-256 checksum
How to use checksums
69a874d71f77e752b3d23a1545641128ed7ec014e6cda6a38faffed4f0367937
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 16, 2026.

Transparency log

Release files / aex_brain-1.0.0-py3-none-any.whl

Download URL aex_brain-1.0.0-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0f057fb91ce01bf89ae31b5e5fba4414a4a63d946bb05abe1f0d634988846716
BLAKE2b-256 checksum
How to use checksums
6a36997212a5143d471efae13619b557c532237537d78ac580c5755cb9e7218e
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 16, 2026.

Transparency log

Security for aex-brain 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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aex_brain-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 Oct 16, 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.

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