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.2.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.2.0a1-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentpki-0.2.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.2.0a1.tar.gz
Algorithm Hash digest
SHA256 819316e3121d0488c20021868de0960637efd19c47ac4213d73acc0abdf26c5c
MD5 6edd94785a677de01de71afc96a7c383
BLAKE2b-256 75e570d8da1a8a59377114ba55aa40e2dd816ecfef1319b9ea5fea5480a9b2bf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agentpki-0.2.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.2.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 18ef6393c24333cdd6f424c93f7b0ad45812f093ed56246b4478ae923be0dde8
MD5 a2a9526e8d874e60ac6de41e6dd3372b
BLAKE2b-256 c14b88aab22d169b9eb7acce8cd6472f44d1900ce0ac3b272fc22a67fc6ccdd2

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