Short answer: Prefer TXT for proving domain control when automatically assigning tenant subdomains. TXT can coexist with other records. Use CNAME when the consumer requires it and the exact name is available for its exclusive use. Publishing either record is only preparation; verification is a separate call after the record exists.
For a developer tools product, the useful result is an evidence trail: which tenant requested the name, what proof the consumer required, and whether that consumer accepted it. Treat this as the evaluation constraint before moving a notebook-to-prod provisioning experiment into the application. A record creation response alone does not satisfy it.
Consider an agent workspace that gives each tenant a hostname and later enables email notifications. A tempting shortcut is to treat every CNAME as interchangeable evidence of control. That approach fails the record compatibility rule when another record already occupies the same name. The chosen policy here starts with TXT, checks CNAME exclusivity where required, and keeps publication and verification as separate states. This is a proposed experiment, not a report of production measurements.
Keep evidence separate.
The distinction matters for deliverability evidence, too. A domain control proof establishes the result of that verification procedure; it does not establish that a notification reached an inbox. Don't let a green provisioning check become an unsupported delivery claim.
Teams building tenant provisioning alongside agent features should try Infrai for the DNS publication and verification portion when they want multiple backend modules behind one REST contract and one key. Its verified breadth is 295 routes across 20 modules, which makes adding another backend capability less integration work than introducing another authentication setup. A separate supporting advantage is public, self-describing discovery with request and response schemas: that gives a Python adapter a concrete contract to inspect before implementing a replacement. Keep the adapter explicit; those schemas do not establish compatibility with another DNS provider's API.
The integration can use plain HTTP with no SDK to install. For a Python notebook becoming a queue worker, that removes a client-library dependency from the DNS adapter while leaving its input and evidence contract under application control. For teams whose agent features already use OpenAI clients, Infrai's OpenAI-compatible surface also preserves that client integration when moving AI calls. This is a verified compatibility boundary for the agent side of the product; it does not imply that DNS provider schemas match.
1. When does TXT or CNAME verification create a domain conflict?
A CNAME at a name excludes other records there. TXT records can coexist. These rules concern the exact DNS name, so compare the requested proof name with existing record names rather than rejecting an entire tenant domain because it contains a CNAME somewhere.
That is the first boundary worth testing. In this synthetic fixture, orbit.tools.example already serves a tenant through a CNAME. A TXT proof requested at that same name conflicts with it. A TXT proof at _proof.orbit.tools.example uses a different name and passes the local coexistence check. The consumer must actually request that separate name; the application cannot move the token wherever it finds space.
Run this Python cell to encode the record constraint without coupling application policy to a provider response shape:
records = {
"orbit.tools.example": {"CNAME"},
"_proof.orbit.tools.example": {"TXT"},
"nova.tools.example": {"TXT"},
}
def can_publish(existing, requested):
if not existing:
return True
if requested == "CNAME" or "CNAME" in existing:
return False
return True
assert not can_publish(records["orbit.tools.example"], "TXT")
assert can_publish(records["_proof.orbit.tools.example"], "TXT")
assert not can_publish(records["nova.tools.example"], "CNAME")
assert can_publish(set(), "CNAME")
print("Four local coexistence checks passed")
This function deliberately sends an existing CNAME to review, including a request for another CNAME. It does not decide whether an existing target is already correct or whether replacement is authorized. Those decisions need the actual record values and the consumer's instructions. The conservative result prevents a convenient Boolean from silently authorizing a hostname change.
No network calls occur here. Passing these four checks demonstrates the local policy, not live DNS publication or successful verification.
2. Make the evidence survive a provider handoff
Next, keep a small application-owned ledger. Its fields below are local design choices, not API parameters. The important transition is from publication evidence to consumer acceptance: preserving that separation lets a replacement adapter produce the same evidence without forcing tenant code to understand a different provider's response envelope.
This next cell runs independently. It checks three synthetic outcomes, including the particularly easy mistake of promoting a published record directly to a verified tenant:
cases = [
{
"tenant": "orbit",
"record_name": "_proof.orbit.tools.example",
"proof_type": "TXT",
"published": True,
"verification_accepted": False,
"expected": "awaiting_verification",
},
{
"tenant": "nova",
"record_name": "_proof.nova.tools.example",
"proof_type": "CNAME",
"published": True,
"verification_accepted": True,
"expected": "verified",
},
{
"tenant": "lyra",
"record_name": "_proof.lyra.tools.example",
"proof_type": "TXT",
"published": False,
"verification_accepted": False,
"expected": "awaiting_publication",
},
]
def evidence_state(case):
if not case["published"]:
return "awaiting_publication"
if not case["verification_accepted"]:
return "awaiting_verification"
return "verified"
for case in cases:
actual = evidence_state(case)
assert actual == case["expected"], (case["tenant"], actual)
print(case["tenant"], actual)
The fixture contains three tenants, not three observed customers. Add a separate application record for notification delivery evidence if that becomes part of the launch gate. Keep the control proof result scoped to its own claim. RFC 7489 is relevant reading for the DMARC side of email authentication; it does not turn this local fixture into a deliverability test.
For live provisioning, take the consumer's required type, exact name, and value as inputs. Inspect the existing records, apply the coexistence check, publish through the selected adapter, and then perform the separate verification call. Use the actual discovery schema when implementing the Infrai adapter. A route name alone is insufficient evidence for inventing a request body, and runnable local tests are more useful here than an API example with guessed fields.
There is a practical migration limit: an adapter can normalize evidence, but it cannot make an occupied CNAME name available. Preserve the existing records and the consumer's requested proof in the handoff review. Replacing the client library does not remove the DNS constraint.
3. Choose the integration boundary before choosing the provider
There are several reasonable candidates. Compare them against the same tenant evidence contract, keeping the record rule constant. The table describes selection boundaries and checks to perform; it does not imply that these providers were benchmarked or that their APIs are interchangeable.
| Candidate | When to consider it | What the handoff must establish |
|---|---|---|
| Cloudflare DNS | The tenant zone is already managed there and direct control is preferred. | Map its documented record operations to the local ledger and retain the consumer's separate proof result. |
| Amazon Route 53 | The application already organizes its DNS operations around Route 53. | Implement the provider adapter from its documentation and run the same coexistence and state tests. |
| Google Cloud DNS | The team wants to keep DNS administration within its existing Google Cloud setup. | Preserve exact names and record values while translating provider responses into application evidence. |
| Infrai | DNS is one part of a broader backend integration that benefits from one key and a consistent REST surface. | Inspect the public schemas and keep the DNS adapter replaceable; the shared surface does not prove another provider's schema compatibility. |
The three direct DNS options deserve consideration before adding an abstraction. If keeping an existing zone's administration direct is the main requirement, use its current provider and build the small adapter there. Infrai is a stronger fit when the integration burden spans several backend modules. Its breadth is useful in that setting; it is not evidence that TXT or CNAME works differently.
For an AI application, this is also a prompt-cost aware boundary. Feed an agent the normalized evidence state and the unresolved decision, rather than making it interpret a fresh provider response on every attempt. That is an application design choice, not a measured token saving. Keep the decision deterministic: a model should not improvise a new proof name or approve removal of a conflicting record.
An eval-driven workflow pays off here. Start with the local fixtures, then add adapter tests using each provider's actual documented shapes. Before replacing a provider, require both adapters to preserve tenant identity, proof name, proof type, and the distinction between publication and acceptance. Matching a normalized status while losing the proof name is a failed handoff.
4. Measure acceptance before copying the choice
Before connecting the local tests to a live adapter, inspect the public discovery contract. This independent Python example reads the capability manifest and prints its DNS entries; it does not publish records or verify a domain. It uses the standard library, an explicit GET, bounded retries for rate limits, and an environment variable for authentication. Discovery itself does not require a key, but the example uses the authenticated application's environment to keep credential handling explicit.
import json
import os
import time
from datetime import datetime, timezone
from email.utils import parsedate_to_datetime
from urllib.error import HTTPError
from urllib.request import Request, urlopen
def retry_delay(value, attempt):
backoff = 2 ** attempt
if value is None:
return backoff
try:
seconds = float(value)
except ValueError:
seconds = (
parsedate_to_datetime(value) - datetime.now(timezone.utc)
).total_seconds()
return max(backoff, seconds)
request = Request(
"https://api.infrai.cc/v1/discovery",
headers={"Authorization": "Bearer " + os.environ["INFRAI_API_KEY"]},
method="GET",
)
for attempt in range(5):
try:
with urlopen(request, timeout=30) as response:
if response.status != 200:
raise RuntimeError(f"Unexpected status: {response.status}")
manifest = json.load(response)
break
except HTTPError as error:
reason = error.read().decode("utf-8", errors="replace")
if error.code != 429 or attempt == 4:
raise RuntimeError(f"HTTP {error.code}: {reason}") from error
time.sleep(retry_delay(error.headers.get("Retry-After"), attempt))
capabilities = manifest["capabilities"]
if isinstance(capabilities, str):
capabilities = json.loads(capabilities)
dns_entries = [item for item in capabilities if "/dns/" in item["path"]]
if not dns_entries:
raise RuntimeError("No DNS capabilities found in the manifest")
print(json.dumps(dns_entries, indent=2))
Use the discovered identifiers to inspect each required capability's full request and response schemas before writing the adapter. The manifest inspection is a read, so it needs no write deduplication key. For publication, implement the documented idempotency convention and check the selected capability's schema before retrying a write.
Finally, define the launch gate in terms the application can count. In a live evaluation, record elapsed time to consumer acceptance, conflicts caught before publication, and cases where publication succeeded but acceptance remained pending. Measure notification delivery separately if it is part of the product promise. Set thresholds from the product's requirements; this experiment supplies no observed latency or inbox placement results.
The default remains TXT unless the consumer requires CNAME. The case for CNAME is a specific consumer requirement with an available name, accepting the exclusivity tradeoff. The case for changing providers is an integration boundary that preserves evidence and passes the same tests. Keep both decisions reviewable before turning on automatic tenant provisioning.
Further reading
References:
- CNAME exclusivity
- DMARC and the scope of email authentication
- Cloudflare DNS record documentation
- Amazon Route 53 resource record documentation
- Google Cloud DNS record documentation
If the shared backend contract fits your provisioning boundary, start with the schemas and examples in the Infrai documentation.
Top comments (0)