APOA Python SDK
Python SDK for the Agentic Power of Attorney (APOA) standard -- authorization infrastructure for AI agents.
Install
pip install apoa
Quick Start
from apoa import (
APOA,
generate_key_pair,
)
private_key, public_key = generate_key_pair()
apoa = APOA(private_key=private_key)
token = apoa.tokens.create_grant(
principal="did:apoa:alex",
agent="did:apoa:docs-assistant",
service="knowledge-base",
scopes=["articles:search", "articles:summarize"],
constraints={"external_sharing": False},
expires_in="24h",
)
valid = apoa.tokens.validate(token.raw, public_key=public_key)
print(valid.valid) # True
result = apoa.authorizations.check(token, "knowledge-base", "articles:summarize")
print(result.authorized) # True
result = apoa.authorizations.check(token, "knowledge-base", "articles:delete")
print(result.authorized) # False
Features
- Token lifecycle: create, sign (Ed25519/ES256), validate, parse
- Scope matching: hierarchical pattern matching (
articles:*matchesarticles:read) - Constraint enforcement: boolean denial at the SDK level, rich constraints at the protocol level
- Authorization: revocation + scope + constraints + hard/soft rules in one call
- Delegation chains: parent-to-child with cryptographically enforced attenuation
- Cascade revocation: revoke parent, kill all children instantly
- Audit trail: append-only action log per token
- Cross-SDK compatibility: tokens created by the TypeScript SDK validate in Python and vice versa
Cross-SDK Compatibility
Tokens are JWTs. A token signed by @apoa/core (TypeScript) validates in apoa (Python) and vice versa. The serialization layer handles camelCase (JWT payload) to snake_case (Python) mapping automatically.
API
Three usage styles:
Application facade
Recommended for apps. Configure keys once, then use namespaced resources.
from apoa import APOA
apoa = APOA(private_key=key)
token = apoa.tokens.create_grant(
principal="did:apoa:alex",
agent="did:apoa:docs-assistant",
service="knowledge-base",
scopes=["articles:search"],
expires_in="24h",
)
apoa.authorizations.check(token, "knowledge-base", "articles:search")
Protocol client
Use this when you want direct access to stores, resolvers, and protocol-level options.
from apoa import create_client
client = create_client(default_private_key=key)
client.authorize(token, "knowledge-base", "articles:search")
Standalone imports
Useful for scripts, tests, adapters, and focused protocol operations.
from apoa import authorize, check_scope
check_scope(token, "knowledge-base", "articles:search")
See the full spec and TypeScript SDK for more.
License
Apache 2.0
Metadata
Release files for apoa 0.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| apoa-0.3.3.tar.gz | 36.2 kB | With provenance | Details for apoa-0.3.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| apoa-0.3.3-py3-none-any.whl | Python 3 | none | any | Details for apoa-0.3.3-py3-none-any.whl |
Total release size: 65.5 kB
Release files / apoa-0.3.3.tar.gz
| Download URL | apoa-0.3.3.tar.gz |
|---|---|
| Size | 36.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
79084971c3d43c3a3c22a3ad2f30181b6c923287f008a15635a20f37f65bdbfe
|
|
BLAKE2b-256 checksum How to use checksums |
087ba2e49a6de63c204b3dbb3aadd50aac00ad887ad87cf411b85f111730c0b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 9, 2026.
Transparency logRelease files / apoa-0.3.3-py3-none-any.whl
| Download URL | apoa-0.3.3-py3-none-any.whl |
|---|---|
| Size | 29.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
85afdf26452fd45489de2562c93f568a1c5d39a586651618deb4bdfd936d8ddc
|
|
BLAKE2b-256 checksum How to use checksums |
5582fa2c076089018626ae47b2399a085ef5c1ac0de8b8194d705aa6bf31c2a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 9, 2026.
Transparency logSecurity for apoa 0.3.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for apoa-0.3.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 9, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.