Skip to main content

Python SDK for AgentPKI — cryptographic identity for AI agents. PASETO v4 passports, Ed25519 signing, RFC 9421 HTTP Message Signatures.

Project description

@agentpki/sdk — Python

Python SDK for AgentPKI — cryptographic identity for AI agents.

pip install agentpki
from agentpki import generate_key_pair, sign_passport, verify_passport
import time

kp = generate_key_pair()
now = int(time.time())

token = sign_passport(
    {
        "v": 1,
        "iss": "example.com",
        "sub": "agent:example.com/research-bot-v1",
        "iat": now,
        "exp": now + 3600,
        "jti": "0e4f8a2c91b34e7b9c5d8a1e2f3b4c5d",
        "tier": 1,
        "scope": ["read:articles"],
    },
    private_key=kp.private_key,
    kid="example-2026-q2",
)

result = verify_passport(token, kp.public_key)
assert result.valid
assert result.payload["iss"] == "example.com"

See examples/round_trip.py for a complete sanity check covering signing, parsing, verification, tamper detection, expiry enforcement, lifetime cap, and RFC 9421 HTTP Message Signatures.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentpki-0.1.0a1.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentpki-0.1.0a1-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file agentpki-0.1.0a1.tar.gz.

File metadata

  • Download URL: agentpki-0.1.0a1.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for agentpki-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 4c60c66f48e8ace831bd092a9274583205fa127caa58c9262d0e54a9eced1848
MD5 210ef1377c50497108d6470d756cabc6
BLAKE2b-256 0e9ddaf07825ba9cf2627e486454b7086f6d1adcc458a878525c5768e8f314bd

See more details on using hashes here.

File details

Details for the file agentpki-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: agentpki-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for agentpki-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 45caf4f6afa15b3bae8cfa3d98243f556705ef57277180925b4b1751052c7bfd
MD5 63f37b0519d97ad9a6806209b691d917
BLAKE2b-256 0e28663606f0637194aa3994884c7cbd5bbfc0171507e70f34a80640ef198549

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page