Skip to main content

Python SDK for the Agent Identity Registry (AIR) — agentidentityregistry.org

Project description

agent-identity-registry

Async Python SDK for the Agent Identity Registry (AIR).

AIR is a W3C-aligned identity layer for AI agents: every agent gets a stable identifier (AIR-XXXX-XXXX-XXXX), a public-key-backed DID document, and a graduated trust score that counterparties can verify before transacting.

Install

pip install agent-identity-registry

Requires Python 3.10+.

Quick start

import asyncio
from agent_identity_registry import AIRClient

async def main():
    async with AIRClient() as client:
        # Public lookup — no auth
        agent = await client.get_agent("AIR-XXXX-XXXX-XXXX")
        print(agent.name, agent.trust_score, agent.trust_grade)

        # Trust-score breakdown (5 components)
        score = await client.get_trust_score("AIR-XXXX-XXXX-XXXX")
        print(score.components.provenance, score.components.behavioral)

        # W3C DID document (publicKeyMultibase + service endpoints)
        did_doc = await client.get_did_document("AIR-XXXX-XXXX-XXXX")
        print(did_doc.id, did_doc.verification_method[0].public_key_multibase)

asyncio.run(main())

Register a new agent

Returns an agent_secret you must store yourself — it's shown only once and is required for later updates.

async with AIRClient() as client:
    result = await client.register_agent(
        name="WeatherBot",
        description="Forecasts weather in 70 cities",
        public_key="...43-char-base64url-Ed25519-key...",  # AIR will mint a did:wba
        creator_type="individual",
        capabilities=["weather", "forecast"],
        open_source=True,
        code_repository="https://github.com/example/weatherbot",
    )

    print(result.air_id)          # AIR-XXXX-XXXX-XXXX
    print(result.agent_secret)    # SAVE THIS — required for PUT
    print(result.air_minted_did)  # True if AIR minted a did:wba

Update an agent

Pass the secret you stored at registration.

async with AIRClient() as client:
    update = await client.update_agent(
        air_id="AIR-XXXX-XXXX-XXXX",
        agent_secret="...32-char-hex-secret-from-registration...",
        description="Updated description",
        capabilities=["weather", "forecast", "alerts"],
    )
    print(update.trust_score)  # Recalculated after update

Errors

All errors derive from AirError:

Status Exception Notes
400 ValidationError Bad input (invalid public_key, missing required field)
401 / 403 AuthenticationError Missing/invalid agent_secret or admin key
404 AgentNotFoundError Unknown AIR ID
409 ConflictError Rare ID collision — retry registration
429 RateLimitedError Exposes retry_after_seconds
5xx ServerError Upstream registry issue
connection failures NetworkError httpx layer (timeout, DNS, TLS)
from agent_identity_registry import AIRClient, AgentNotFoundError, RateLimitedError

async with AIRClient() as client:
    try:
        agent = await client.get_agent("AIR-DOES-NOTX-IST0")
    except AgentNotFoundError as e:
        print(f"No such agent: {e.air_id}")
    except RateLimitedError as e:
        print(f"Slow down. Retry in {e.retry_after_seconds}s")

License

Apache 2.0 — see the registry repo for full text.

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

agent_identity_registry-0.1.0.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

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

agent_identity_registry-0.1.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agent_identity_registry-0.1.0.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agent_identity_registry-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cd7b67f586a06ef5ac00e0c18ca66ff7bbb50499db752ae478267644e99c98d1
MD5 34b08e4faec6c47b6e23974cf1e886b9
BLAKE2b-256 5c77b73ee5b5e1cd39829c2ac4722f07861b14f371df38a6d6fb0a205fbb298d

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_identity_registry-0.1.0.tar.gz:

Publisher: release.yml on AgentIdentityRegistry/agent-identity-registry-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for agent_identity_registry-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f8bbbc1e07d2073d2359e54dc3f3bea63cb564d97abfc75013f5c64d7ef0f2a2
MD5 f5120060accc1fe5224338e57f8a6e75
BLAKE2b-256 8a43dd414a30429e5008fabe96aa4ebffe82b1bf290c60eb446d64c4bb3f0a41

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_identity_registry-0.1.0-py3-none-any.whl:

Publisher: release.yml on AgentIdentityRegistry/agent-identity-registry-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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