Python SDK for SpanoAI — shared working memory + a message bus for multi-agent AI systems
Project description
spanoai (Python SDK)
Python client for SpanoAI — shared working memory (a context store) plus a durable message bus for multi-agent AI systems. Sync and async, fully typed.
pip install spanoai
Quickstart
from spanoai import SpanoAI
spano = SpanoAI(api_key="sk_...", agent="researcher")
spano.sessions.create("run-1")
# shared memory
spano.context.write("run-1", "researcher", "findings", {"revenue": "$4.2M"})
entry = spano.context.read("run-1", "researcher", "findings")
print(entry["value"]["data"]) # {'revenue': '$4.2M'}
# message bus — ask another agent and block for the reply
res = spano.bus.request("run-1", "reviewer", "review", {"data": {"pr": 1}}, timeout_ms=5000)
print(res["reply"]["payload"]["data"])
Async
import asyncio
from spanoai import AsyncSpanoAI
async def main():
async with AsyncSpanoAI(api_key="sk_...", agent="planner") as spano:
await spano.context.write("run-1", "planner", "goal", "ship it")
async for event in spano.stream("run-1"):
print(event["event"])
break
asyncio.run(main())
Surface
The Python surface mirrors the TypeScript SDK 1:1 (snake_case):
context:write,read,append,increment,await_key,search,history,list,deletebus:dispatch,broadcast,claim,ack,reply,request,await_reply,list_dlq,replay_dlqsessions:create,get,list,join,leave,abort,endartifacts:upload,download,init_upload,complete,get_metadata,download_url,deletestream(session, on_event)(sync) /stream(session)async iterator
read() returns None on a miss. Other non-2xx responses raise
SpanoAIError(status, code, request_id). Mutating calls auto-generate an
operationId and reuse it across retries (5xx / 429 / network) so a retry
replays idempotently.
Configuration
SpanoAI(
api_key="sk_...",
base_url="http://localhost:8000", # default
agent="default", # X-SpanoAI-Agent identity
max_retries=3,
timeout=30.0,
)
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spanoai-0.1.0.tar.gz.
File metadata
- Download URL: spanoai-0.1.0.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a9a54c0c0e0585462b4da18f917ae5f637e7c006072078909aa4230cfd128a3
|
|
| MD5 |
87356c26ce5b5b76872b02abb6c82bd6
|
|
| BLAKE2b-256 |
e6a285b21adf4cf582da86b1406189557f02766d60a3a20bd8f8f3a84a3aeb97
|
File details
Details for the file spanoai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: spanoai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f992df381965ad30cba6b10cc81040140101c4cccd3a1c1bec4327ee609ca35
|
|
| MD5 |
9a7aa38defc8524461db0a85787b6a92
|
|
| BLAKE2b-256 |
b70ec9301f2f66cb59e22cef56ad330d8ca31c1e3a8cbab94ab91ae90a79e027
|