Official Python SDK for MUXI — infrastructure for AI agents.
Highlights
- Sync & async clients with pooled
httpxtransport - Context managers for automatic client cleanup
- Built-in retries, idempotency, and typed errors
- Streaming helpers for chat/audio and deploy/log tails
Need deeper usage notes? See the User Guide for streaming, retries, and auth details.
pip install muxi-clientfrom muxi import ServerClient, FormationClient
server = ServerClient(
url="https://server.example.com",
key_id="<key_id>",
secret_key="<secret_key>",
)
print(server.status())
formation = FormationClient(
server_url="https://server.example.com",
formation_id="<formation_id>",
client_key="<client_key>",
admin_key="<admin_key>",
)
print(formation.health())import asyncio
from muxi import AsyncServerClient, AsyncFormationClient
async def main():
server = AsyncServerClient(
url="https://server.example.com",
key_id="<key_id>",
secret_key="<secret_key>",
)
print(await server.status())
formation = AsyncFormationClient(
server_url="https://server.example.com",
formation_id="<formation_id>",
client_key="<client_key>",
admin_key="<admin_key>",
)
async for evt in await formation.chat_stream({"message": "hi"}):
print(evt)
break
asyncio.run(main())- Default (via server proxy):
server_url + /api/{formation_id}/v1 - Direct formation: set
base_url="http://localhost:9012/v1"(or useurlfor dev modehttp://localhost:8001/v1)
- Server: HMAC with
key_id/secret_keyon/rpc/*. - Formation:
X-MUXI-CLIENT-KEYorX-MUXI-ADMIN-KEYon formation API. - Idempotency:
X-Muxi-Idempotency-Keyauto-generated on every request. - SDK:
X-Muxi-SDK,X-Muxi-Clientheaders set automatically.
- Chat/audio: POST
/chator/audiochatwithstream=True; consume SSE events. - Deploy/log streams: methods return generators/async generators.
- Typed errors for auth/validation/rate-limit/server/connection.
- Default timeout 30s (streaming is unbounded); retries on 429/5xx/connection with backoff.