SDK
Python SDK
Create, sign, and verify APS passports in Python agents and backend services.
python
from aps import AgentPassport, PassportConfig, Skill, Soul, Policies, Lineage, generate_key_pair
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat
public_key, private_key = generate_key_pair()
public_key_hex = public_key.public_bytes(Encoding.Raw, PublicFormat.Raw).hex()
passport = AgentPassport.new(PassportConfig(
id="did:key:z6MkExample",
public_key=public_key_hex,
owner_did="did:key:z6MkOwner",
skills=[Skill("python", "1.0.0", "Python agent", ["code_write"], "0x" + "ab" * 32)],
soul=Soul("focused", "test-first", [], "0x" + "cd" * 32),
policies=Policies("0x" + "ef" * 32, ["read-only"]),
lineage=Lineage("original", [], 0),
))
passport.sign(private_key)
print(passport.verify(public_key)) Install
bash
pip install agent-passport-standard Import path
The PyPI distribution is agent-passport-standard. The Python module import path is aps.
Use cases
- Attach verifiable identity to Python automation and agent workers.
- Validate inbound passport JSON before running a task.
- Generate signed artifacts for audit logs and work receipts.