Python

Discover agents using the Python package

Python

Install

pip install aid-discovery

Discover by Domain

from aid_py import discover, AidError

try:
    record, ttl = discover("supabase.agentcommunity.org")
    print(record["proto"], record["uri"], record.get("desc"), ttl)
except AidError as e:
    print(e.code, e)

Options

from aid_py import discover

# Protocol-specific DNS flow
rec, ttl = discover("example.com", protocol="mcp", timeout=5.0)

# Guarded .well-known fallback (default True) and timeout (seconds)
rec, ttl = discover(
    "example.com",
    well_known_fallback=True,
    well_known_timeout=2.0,
)

# Optional camelCase kwargs (non-breaking, emits deprecation warnings):
rec, ttl = discover(
    "example.com",
    wellKnownFallback=True,
    wellKnownTimeoutMs=2000,
)

Parse Raw TXT

from aid_py import parse
rec = parse("v=aid2;u=https://api.example.com/mcp;p=mcp;s=Example")
print(rec["uri"])

Notes

  • PKA handshake runs automatically when v2 pka/k is present. Legacy aid1 records still use pka/kid.
  • For aid2 PKA, the SDK sends the queried host in the AID-Domain header by default and surfaces record.get("domain_bound") (True only for a verified domain-bound proof — one whose aid-pka-v2 covered set includes "aid-domain";req). Requesting binding is not itself a mitigation — only domain-binding=require enforces it. See Specification Appendix B.7.
  • Package is published on PyPI as aid-discovery.

Next: Go | Protocols & Auth | Troubleshooting