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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eea39ed1a65f0835235d4920eebcc56e2aad39e8a0229acd87e5ffae0dc607a4
|
|
| MD5 |
1e8bfa8acd7870d3d26e2824c5b6df12
|
|
| BLAKE2b-256 |
3a6225de0b2cfbc0479ee66d374c553f63267e765eb2234cd468b4f4d1e682d5
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_dns_aid-0.1.0.tar.gz -
Subject digest:
eea39ed1a65f0835235d4920eebcc56e2aad39e8a0229acd87e5ffae0dc607a4 - Sigstore transparency entry: 1283181711
- Sigstore integration time:
-
Permalink:
IngmarVG-IB/langchain-dns-aid@a71e9f5918f88c968029473eb15db3016141fb3a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/IngmarVG-IB
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a71e9f5918f88c968029473eb15db3016141fb3a -
Trigger Event:
release
-
Statement type:
File details
Details for the file langchain_dns_aid-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_dns_aid-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
667b0187894201368d6b0c16d933e6e224233baf38674621341d4d6129ef6e3d
|
|
| MD5 |
01de67f436bbfad20b9ccb3c1d6a3895
|
|
| BLAKE2b-256 |
70c5fd1ea74520f5228e6bffdfa95f6b1971ce4f20c9f0715b0d5b390bc1ff6c
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_dns_aid-0.1.0-py3-none-any.whl -
Subject digest:
667b0187894201368d6b0c16d933e6e224233baf38674621341d4d6129ef6e3d - Sigstore transparency entry: 1283181720
- Sigstore integration time:
-
Permalink:
IngmarVG-IB/langchain-dns-aid@a71e9f5918f88c968029473eb15db3016141fb3a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/IngmarVG-IB
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a71e9f5918f88c968029473eb15db3016141fb3a -
Trigger Event:
release
-
Statement type: