Skip to main content

Python SDK for Open Agent ID — register, sign, and verify AI agent identities

Project description

open-agent-id

Python SDK for Open Agent ID -- register, sign, and verify AI agent identities.

Installation

pip install open-agent-id

Or for development:

pip install -e ".[dev]"

Quick start

Register a new agent

import asyncio
from agent_id import AgentIdentity

async def main():
    identity = await AgentIdentity.register(
        name="my-search-agent",
        capabilities=["search", "summarize"],
        api_key="your-platform-key",
    )
    print(identity.did)            # did:agent:tokli:agt_...
    print(identity.public_key_base64url)
    # IMPORTANT: persist the private key securely -- it is only returned once.

asyncio.run(main())

Load an existing identity

from agent_id import AgentIdentity

identity = AgentIdentity.load(
    did="did:agent:tokli:agt_a1B2c3D4e5",
    private_key="<base64url-encoded-private-key>",
)

Sign an HTTP request

headers = identity.sign_request("POST", "https://api.example.com/v1/tasks", '{"task":"search"}')
# headers contains X-Agent-DID, X-Agent-Timestamp, X-Agent-Nonce, X-Agent-Signature

Verify another agent's signature

valid = await AgentIdentity.verify(
    did="did:agent:other:agt_X9yZ8wV7u6",
    payload=canonical_payload,
    signature=signature_b64,
)

Look up an agent

info = await AgentIdentity.lookup("did:agent:tokli:agt_a1B2c3D4e5")
print(info["name"], info["status"])

Running tests

pip install -e ".[dev]"
pytest

License

Apache 2.0 -- see LICENSE.

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

open_agent_id-0.1.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

open_agent_id-0.1.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file open_agent_id-0.1.0.tar.gz.

File metadata

  • Download URL: open_agent_id-0.1.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for open_agent_id-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e6b6c7bf2f5eed5bd1298ff03461a119ce955631c384a846e7281d6742424692
MD5 9b5521ecf722bfd5c04a15e5bfc43987
BLAKE2b-256 6ff81490f3334d253fde48b383e487f18b167dc2e719b086e25677468ae52f58

See more details on using hashes here.

File details

Details for the file open_agent_id-0.1.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for open_agent_id-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f26b4fe676b2deb6c9b906a88349c749006ec2acb1f2c332f844d9864d53b6f
MD5 d30c8364a01e415b3f0b8ddfc6300754
BLAKE2b-256 ea2468fd3ecdb42f36bc920be457a25c279ea90d3929b6137f06e6919108f433

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