Skip to main content

Official Python SDK for HeadlessDomains - The Autonomous Identity Layer

Project description

Headless Domains Python SDK

The official Python SDK for the Headless Domains API. Build decentralized identities, register agent names, and execute Machine-to-Machine (M2M) payments effortlessly.

Installation

pip install headlessdomains

Quick Start

1. Anonymous Agent Provisioning (Zero-Human Start)

AI Agents can onboard themselves without a human account:

from headlessdomains import Client

client = Client() # No auth needed to provision
agent = client.agents.provision("my-cool-agent")

print(f"My API Key: {agent.api_key}")
print(f"Give this code to my human owner: {agent.claim_code}")

2. Authenticated Usage

Once you have an API key, use it to search and lookup domains:

from headlessdomains import Client

client = Client(api_key="hd_agent_XXXXX")

# Check availability
availability = client.domains.search("janice.agent")
if availability.is_available:
    print(f"Domain is available for {availability.price} Gems")

# Get domain profile
profile = client.domains.lookup("janice.agent")
print(f"Bio: {profile.bio}")
print(f"Skills: {profile.skills}")

3. Machine-to-Machine Payments (MPP)

Note on Registration Auth: To register or renew domains, an agent must either be claimed by a human account (GFAVIP) or you must authenticate directly using a gfavip_token. Using an unclaimed hd_agent_ key alone will return a 401 Authentication Error.

The SDK natively catches and parses 402 Payment Required responses, giving you structured data to execute smart contract transactions.

from headlessdomains import Client, PaymentRequiredError

# Use a GFAVIP token (or a fully claimed agent api_key) for registration
client = Client(gfavip_token="gfavip_XXXXX")

try:
    client.register("mybot", "chatbot", years=1)
    print("Registered successfully with existing Gems!")
except PaymentRequiredError as e:
    print(f"Payment Required!")
    print(f"Send {e.amount} wei to {e.recipient}")
    print(f"Currency Contract: {e.currency} on Chain {e.chain_id}")
    print(f"Session ID to use in Memo: {e.session_id}")
    
    # ... execute your web3 transaction ...

4. Workflows and MCP (Model Context Protocol)

You can register agents with rich workflows (such as MCP tool connections) directly at registration time. This allows agents to seamlessly integrate with GitHub Company OS, Claude, and other agentic workflows:

from headlessdomains import Client

client = Client(gfavip_token="gfavip_XXXXX")

# Register an agent and configure workflows in a single line
me = client.register(
    "mystore", 
    "agent", 
    workflows={
        "mcp": {
            "version": "2024-11",
            "enabled": True,
            "servers": [
                {
                    "name": "catalog-tool",
                    "endpoint": "mcp://tools/catalog",
                    "description": "Agentic product feed & enrichment"
                }
            ],
            "claude_compatible": True,
            "auto_map_skills": True
        }
    }
)

# You can also update workflows on an existing agent
client.update_bio("mystore.agent", workflows={"mcp": {"enabled": False}})

Async Support

An asynchronous client is also available for high-concurrency systems:

import asyncio
from headlessdomains import AsyncClient

async def main():
    async with AsyncClient(api_key="hd_agent_XXXXX") as client:
        profile = await client.domains.lookup("janice.agent")
        print(profile.status)

asyncio.run(main())

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

headlessdomains-0.1.5.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

headlessdomains-0.1.5-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file headlessdomains-0.1.5.tar.gz.

File metadata

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

File hashes

Hashes for headlessdomains-0.1.5.tar.gz
Algorithm Hash digest
SHA256 843eaf66c2c42fa87ed28defea6c48d8860b73d03c4c6a8ec4a2227230efb089
MD5 70958c06a04a84a75baf97246d9d9a29
BLAKE2b-256 cb2a77daca597d41c1587e769d4cb37a9815f26259faf2a2244566f5a87393bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for headlessdomains-0.1.5.tar.gz:

Publisher: publish-pypi.yml on shadstoneofficial/headlessdomains-python-sdk

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

File details

Details for the file headlessdomains-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for headlessdomains-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bf0cf97d3559c9ac5b81f61de69fc31e8a41e38890a525df27e104794f2cca42
MD5 9ee3721a3c0e779ca20f26b8b9f2c9c9
BLAKE2b-256 5d942077320e5cb633c390ccafa0c23e5087e93343b075347e33ca2c80eab43c

See more details on using hashes here.

Provenance

The following attestation bundles were made for headlessdomains-0.1.5-py3-none-any.whl:

Publisher: publish-pypi.yml on shadstoneofficial/headlessdomains-python-sdk

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