Skip to content

Python SDK for Open Agent ID — register agents, sign requests, verify identities

License

Notifications You must be signed in to change notification settings

open-agent-id/agent-id-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Python SDK for Open Agent ID — register agents, sign requests, verify identities

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages