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/kis present. Legacyaid1records still usepka/kid. - For
aid2PKA, the SDK sends the queried host in theAID-Domainheader by default and surfacesrecord.get("domain_bound")(Trueonly for a verified domain-bound proof — one whoseaid-pka-v2covered set includes"aid-domain";req). Requesting binding is not itself a mitigation — onlydomain-binding=requireenforces it. See Specification Appendix B.7. - Package is published on PyPI as
aid-discovery.
Next: Go | Protocols & Auth | Troubleshooting