PersonaClient and async AsyncPersonaClient take identical
arguments.
Constructor reference
Validation at construction
Bothbase_url and credential are validated synchronously at construction: passing an empty
or missing value raises a plain ValueError (TransportConfig: "base_url" is required /
TransportConfig: "credential" is required) before any network call is made. No connection is
established at construction time — building a client is cheap and stateless beyond these options.
Environment variables
The SDK does not read environment variables itself — configuration is explicit. The convention (used throughout the docs, the Integration Guide, and the SDK’s own tests) is:
You are free to use any names you like; the point is that the credential must come from an
environment variable or secret manager, never from source code or a client bundle.
Configuration scenarios
1. Control-plane client (Project-level)
Acts as the Project itself. Use for provisioning and administration: Providers, Agent/Skill/ Knowledge/MCP configuration CRUD, audit logs,whoami().
2. Runtime-plane client (per end user)
Constructed per request, scoped to whoever is actually using your product right now — after your own auth has confirmed who that is. Required for Threads, Files, and Chat; makes Agent/Skill/Knowledge/MCP create/list calls act on that user’s behalf (scope: 'mine').
3. Bumping 429 retries
4. Sharing an httpx connection pool
async with — closing a PersonaClient never closes a
client you passed in via http_client=; only a client the SDK created for you gets closed. Close
shared_http_client yourself, once, at app shutdown.
Cost of construction
Constructing a client is cheap and stateless beyond these options — there’s no connection pool or warm-up step (one is only created lazily on the first request). It’s fine (and recommended) to construct a fresh, per-request runtime-plane client rather than trying to share one instance across users, which would mix identities. A single control-plane client per process is fine to share.How each option flows into a request
Every request the SDK makes is assembled from these options:max_retries times (see
Behavior & edge cases); everything else
raises immediately. There is no other header customization surface on the public client — the
transport is internal. If you need to send custom headers for an endpoint the SDK doesn’t wrap yet,
use httpx directly against the API Reference endpoints.