Skip to main content
personaai is the official Python client for everything on this page — auth header injection, typed resource methods for Agents/Skills/Knowledge/MCP/Providers/Threads/Files, and streaming AG-UI chat, all wrapping the same REST + AG-UI API described in the API Reference. It ships both a sync client (PersonaClient) and an async client (AsyncPersonaClient) built on the same httpx-based transport — use whichever matches your framework.
Server-side only, same as everything else on this page. The SDK sends your Project’s credential on every call — a server-side secret. Never construct PersonaClient/AsyncPersonaClient in code an untrusted party can read (a Jupyter notebook you share publicly, a serverless function that logs its environment, etc.). See the Integration Guide for the full reasoning.

Prerequisites

  • Python 3.9+ (3.9–3.13 are tested — see Compatibility).
  • A Project credential minted in Developer Studio, shaped "<keyId>.<secret>". This is the only thing that authenticates the SDK.
  • A base URL — https://api.persona.hasanraiyan.me in production.
The SDK has exactly one runtime dependency: httpx>=0.27 (installed automatically). No requests, no aiohttp, no separate AG-UI protocol package.

Install

Installed under the PyPI name persona-agent-sdk (personaai was already too close to an unrelated existing PyPI project’s name) but imported as personaai in code — from personaai import PersonaClient.
If you’re iterating on the SDK’s own source instead of consuming the published package, build it locally and point another project at the folder directly:

Initialize a client

Both clients take the same arguments — two positional (base_url, credential), then keyword options. See Configuration for the full reference.
Constructing a client is cheap — no connection happens at construction time — so it’s fine (and recommended) to build a fresh runtime-plane client per request, scoped to whoever is making it.

Minimal working example

Or async, identical shape:
Both clients also work as context managers — with PersonaClient(...) as persona: / async with AsyncPersonaClient(...) as persona: — which closes the underlying httpx client for you on exit.

First streaming chat call

Chat runs an Agent as the asserted external user, streaming AG-UI events over SSE. It requires a runtime-plane client (external_user_id set) — a bare Project credential has no Subject to chat as, and the server rejects it with 400 EXTERNAL_USER_REQUIRED.
See Chat, streamed for the full event model, interrupts, and resuming human-in-the-loop decisions.

Where to go next

Out of scope

Project/Members/Credentials management (creating Projects, inviting Members, minting/revoking credentials) is intentionally not part of this SDK — those routes are Clerk-session (human-admin) authenticated, a structurally different auth model than the machine-credential calls this SDK makes end to end. Manage them from Developer Studio instead.