Python SDK
Local installation, ACT verification, optional middleware, and custody behavior.
The source distribution is openagentid-sdk 0.1.0, imported as openagent_sdk, requiring Python 3.10 or later. Its core dependencies are cbor2 and cryptography; FastAPI is an optional integration.
python -m pip install ./openagent-sdk/sdks/python
# Optional framework dependencies:
python -m pip install './openagent-sdk/sdks/python[fastapi]'The quickstart is a complete command-line verification program with binary token/key inputs. Verifier accepts trusted public keys, issuer, audience, required Scope values, and optional timing policy. verify() returns verified ActClaims or raises a typed error. decode_unverified() is inspection only and must never authorize an action.
Modules
| Module | Public responsibilities |
|---|---|
act | Envelope/claims, verification, builder, size/version/algorithm constants |
scope | Three-segment scope parsing and matching |
keys | Generate/restore seed-derived keys, file/environment helpers |
agent | Agent and session facade |
middleware | FastAPI dependency and Starlette middleware factory |
errors | Configuration, encoding, signature, time, audience, issuer, and scope failures |
Framework boundary
require_act(verifier, scopes=...) returns a dependency callable; require_act_starlette returns a middleware class. Wire the returned dependency using your framework's actual dependency API and request typing. Inspect and exercise the integration before exposing a route. A verifier object by itself does not attach middleware or deny requests.
Key restoration
The Python implementation takes a BLAKE3 branch when that module is importable and an HKDF-SHA256 fallback otherwise. Its BLAKE3 call shape must match the installed binding. Changing optional dependencies can change or break encryption-key derivation. Preserve your tested environment and use the custody checklist. This is independent of ACT token interoperability.
Source: openagent-sdk/sdks/python/pyproject.toml, src/openagent_sdk/__init__.py, and the modules listed above. See package references for the source manifest and exported declarations.