algovoi-passport-sdk
A small SDK for building passport-aware agents on the AlgoVoi payment rails. It turns the two agent patterns into a few lines each: an agent that presents its Agent Passport on outbound calls, and a relying-party agent that guards its endpoints by verifying presented passports offline and enforcing a policy.
Built on algovoi-passport-client.
Part of the AlgoVoi Payment Rails.
pip install algovoi-passport-sdk
Present your passport (agent side)
from algovoi_passport_sdk import PassportHolder
me = PassportHolder.from_env() # $ALGOVOI_AGENT_PASSPORT, or from_file(path)
# attach it to an outbound call
headers = me.apply({"Accept": "application/json"}) # adds X-Agent-Passport
metadata = me.a2a_metadata() # A2A message metadata
Guard your agent (relying-party side)
from algovoi_passport_sdk import PassportGuard, PassportPolicy
guard = PassportGuard(
issuer_url="https://pay.issuer.com", # resolves + caches key & CRL
policy=PassportPolicy(required_scopes=("pay:invoice",), min_spend_microusd=1_000_000),
)
decision = guard.check(incoming_headers, required_scope="pay:invoice")
if decision: # truthy only when admitted
verdict = decision.verdict # agent_did, scopes, spend, ...
... # grant the spend
else:
reject(decision.reason) # e.g. "revoked: REVOKED"
guard.check(...) accepts a raw credential, an x402 headers mapping, an A2A metadata
mapping, or a full A2A message; it pulls the passport out, verifies it offline
(fail-closed), and applies the policy. Issuer key and revocation list are cached with a TTL
(default 300s). For a strictly offline trust base, pin them instead of fetching:
guard = PassportGuard(issuer_keys={kid: pk_bytes}, crl={"revoked": [...]})
Policy
PassportPolicy fields, all optional:
required_scopes: every scope must be present on the passport.min_spend_microusd: a floor; the passport's own limit must cover it (a passport with no stated limit is treated as unbounded).allowed_agents: an allowlist ofagent_dids.require_revocation_check: default True; if the CRL cannot be confirmed the passport is denied asunverifiable, never admitted.
Per-call required_scope and min_spend on check(...) add to the policy.
FastAPI
from fastapi import FastAPI, Depends
from algovoi_passport_sdk import PassportGuard
from algovoi_passport_sdk.integrations import fastapi_passport_dependency
guard = PassportGuard(issuer_url="https://pay.issuer.com")
require_pay = fastapi_passport_dependency(guard, scope="pay:invoice")
app = FastAPI()
@app.post("/charge")
def charge(verdict = Depends(require_pay)): # 403 unless a valid, in-scope passport is presented
return {"agent": verdict.agent_did}
Install the extra with pip install 'algovoi-passport-sdk[fastapi]'.
License
Apache-2.0. (c) AlgoVoi. Keep the NOTICE attribution when you redistribute.
Metadata
Release files for algovoi-passport-sdk 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| algovoi_passport_sdk-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for algovoi_passport_sdk-0.1.1-py3-none-any.whl |
Release files / algovoi_passport_sdk-0.1.1-py3-none-any.whl
| Download URL | algovoi_passport_sdk-0.1.1-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
669720c09672b19c599d13eb14cf1a0c3ffcaec571359cedb57af516fb90dc57
|
|
BLAKE2b-256 checksum How to use checksums |
2e74c568b5a5838cfd1e37e212229c77b9ff6fe7779c6c85b1d2d648d2c77392
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for algovoi-passport-sdk 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.