partython-brain
Python SDK for the Partython AI brain — embed conversational, sales-aware AI in your app or backend.
pip install partython-brain
Quick start
from partython_brain import Brain
import os
brain = Brain(api_key=os.environ["PARTYTHON_API_KEY"])
result = brain.respond(
channel="web",
channel_user_id="user-abc",
message_text="I'm planning a 5-year-old's birthday with 12 guests — any unicorn theme ideas?",
)
print(result["response"])
# → "A unicorn theme for a 5-year-old with 12 guests — fun! Let me show you our..."
API
Brain(api_key, base_url=None, timeout=30, session=None)
| Param | Default | Description |
|---|---|---|
| api_key | (required) | Your pk_live_... API key |
| base_url | https://brain.partython.com |
Override for self-hosted |
| timeout | 30.0 |
Per-call timeout in seconds |
| session | new requests.Session |
Custom session for retries / connection pool |
brain.respond(...)
Keyword args (all required unless noted):
channel: str—"web"|"whatsapp"|"sms"|"api"...channel_user_id: str— stable id for the conversation participantmessage_text: str— the customer's messagemetadata: dict | None— optional pass-through metadatadedup_key: str | None— idempotency key (webhook event id)has_image: bool— hint for the smart router
Returns dict with response, assistant_name, request_id, metadata.
Errors
from partython_brain import BrainAuthError, BrainRateLimitError
try:
brain.respond(...)
except BrainRateLimitError as e:
# back off — retry-after info is in e.body
...
except BrainAuthError as e:
# key invalid or revoked
...
| Exception | When it fires |
|---|---|
BrainAuthError |
401 / 403 — key invalid, revoked, or no scope |
BrainRateLimitError |
429 — per-key per-minute limit hit |
BrainNotFoundError |
404 — tenant misconfigured |
BrainServerError |
5xx upstream |
BrainNetworkError |
Network or timeout |
License
MIT
Metadata
Release files for partython-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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| partython_brain-1.0.0.tar.gz | 5.2 kB | Without provenance | Details for partython_brain-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| partython_brain-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for partython_brain-1.0.0-py3-none-any.whl |
Total release size: 11.1 kB
Release files / partython_brain-1.0.0.tar.gz
| Download URL | partython_brain-1.0.0.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
97c6e325011f226c2698388f0987b0f2a51399e04315a744f93b9fa2ec3202fa
|
|
BLAKE2b-256 checksum How to use checksums |
317f84082550678506d7bc85ff1fc9701b1da4d844b74d135124999a06c451f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / partython_brain-1.0.0-py3-none-any.whl
| Download URL | partython_brain-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
210e842305a8ed67a3479fee6c53b69dde1deb0768456ad0f4f7561e645fa627
|
|
BLAKE2b-256 checksum How to use checksums |
eacf925cf2d1ed8cdbbb506149e7a1031973d463d9d2103e1eef1807512a8609
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for partython-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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.