Skip to main content

DNS-AID agent discovery middleware for LangChain

Project description

langchain-dns-aid

DNS-AID agent discovery middleware for LangChain. Enables agents to discover, publish, and unpublish themselves via DNS using the DNS-AID protocol.

Why middleware instead of tools?

Unlike tool-only integrations (CrewAI, LlamaIndex, etc.), the middleware approach uses LangChain's lifecycle hooks to auto-publish the agent on startup and auto-unpublish on shutdown. This prevents stale DNS records when agents crash or forget to clean up.

Install

pip install langchain-dns-aid

Quick start

from langchain import create_agent, init_chat_model
from langchain_dns_aid import DnsAidMiddleware

agent = create_agent(
    model=init_chat_model("gpt-4o"),
    middleware=[DnsAidMiddleware(
        agent_name="my-assistant",
        domain="agents.example.com",
        endpoint="assistant.example.com",
        capabilities=["code-review", "documentation"],
        backend_name="route53",
    )],
)

# Agent is auto-published to DNS on startup.
# It can discover other agents during conversation.
# On shutdown, it is auto-unpublished.

What it does

Hook Action
before_agent Auto-publishes the agent to DNS via SVCB records
after_agent Auto-unpublishes the agent, removing DNS records
Tools dns_aid_discover, dns_aid_publish, dns_aid_unpublish

Configuration

Parameter Default Description
agent_name None Agent DNS label (required for auto-publish)
domain None Domain to publish under (required for auto-publish)
protocol "mcp" Protocol: mcp, a2a, or https
endpoint "" Hostname where agent is reachable
port 443 Port number
capabilities None List of agent capabilities
backend_name None DNS backend: route53, cloudflare, mock, etc.
auto_publish True Auto-publish on agent start
auto_unpublish True Auto-unpublish on agent stop

Discovery only (no auto-publish)

agent = create_agent(
    model=init_chat_model("gpt-4o"),
    middleware=[DnsAidMiddleware(
        auto_publish=False,
        auto_unpublish=False,
    )],
)
# Agent gets dns_aid_discover tool but doesn't publish itself.

License

Apache-2.0

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

langchain_dns_aid-0.1.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

langchain_dns_aid-0.1.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for langchain_dns_aid-0.1.0.tar.gz
Algorithm Hash digest
SHA256 eea39ed1a65f0835235d4920eebcc56e2aad39e8a0229acd87e5ffae0dc607a4
MD5 1e8bfa8acd7870d3d26e2824c5b6df12
BLAKE2b-256 3a6225de0b2cfbc0479ee66d374c553f63267e765eb2234cd468b4f4d1e682d5

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on IngmarVG-IB/langchain-dns-aid

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

File details

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

File metadata

File hashes

Hashes for langchain_dns_aid-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 667b0187894201368d6b0c16d933e6e224233baf38674621341d4d6129ef6e3d
MD5 01de67f436bbfad20b9ccb3c1d6a3895
BLAKE2b-256 70c5fd1ea74520f5228e6bffdfa95f6b1971ce4f20c9f0715b0d5b390bc1ff6c

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on IngmarVG-IB/langchain-dns-aid

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