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.1.tar.gz (16.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.1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: open_agent_id-0.1.1.tar.gz
  • Upload date:
  • Size: 16.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.1.tar.gz
Algorithm Hash digest
SHA256 b6179e3791834a76bb8ba3d0488cb84c47a90f3d5e580565bffadea0a7d8fa78
MD5 b5e85481e017e07f4fa625d8de6e1ac1
BLAKE2b-256 a651fbaa7445edef871a3784b4720dbabf2b07119323825fc1978f1aadec18d4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: open_agent_id-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4639f798428cc4d9d0be182ee90158f045c841354f30d676679ee0fee967ed03
MD5 f570265cdd82f071eee6130d59fc88bb
BLAKE2b-256 e547aac12929218ae628161bdc1ac2b944c333c1af26a140f420626d0a622eff

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