Integration Examples

Working code showing how to integrate AttestSeal into AI agents, payment flows, and applications.

Setup

Python SDK: pip install httpx (SDK is included in examples, will be on PyPI at launch)

Or just use the API directly: GET https://api.attestseal.com/v1/check/{domain}

1. Basic Trust Check with Confidence-Aware Policy

Beginner

The simplest integration. Check a domain before making a payment. Branch on recommended_action, which combines recommendation + confidence + cautionReason into one decision hint so your policy is the same as every other AttestSeal consumer.

from attestseal import check

result = check("stripe.com")

# One property, six policy outcomes:
if result.recommended_action == "refuse_critical":   # malware/phishing detected
    block_and_alert()
elif result.recommended_action == "refuse":          # DENY tier
    refuse_payment(result.reasoning)
elif result.recommended_action == "confirm_low_value":  # CAUTION with low confidence
    if amount < 25: proceed()  # evidence incomplete, not necessarily bad
    else: ask_user()
elif result.recommended_action == "confirm_new_domain":  # CAUTION, under 1 year old
    ask_user("Site is under 1 year old. Proceed?")
elif result.recommended_action == "confirm_caution":    # CAUTION, weak signals
    ask_user(result.reasoning)
else:  # "proceed"
    proceed()

# Or if you want a human-readable companion for logs:
print(result.action_message)    # e.g. "Safe to proceed with this merchant."

# And the raw fields for anything custom:
print(result.trust_score)       # 83
print(result.confidence)        # "high"
print(result.caution_reason)    # None (only set on CAUTION)
print(result.signals.ssl.score)  # 100
Output: stripe.com (PROCEED, high confidence)
--- Attempting to pay $49.99 to stripe.com ---

Domain:          stripe.com
Trust Score:     83/100
Recommendation:  PROCEED
Confidence:     high
Scoring Model:   attestseal-v1.5.1-weights

Signals:
  Reputation:  93/100   Identity:   55/55
  Content:     95/100   Domain Age: 100/100
  SSL/TLS:    100/100   DNS:       60/100

ACTION: Safe to proceed with this merchant.
Payment of $49.99 authorized.
Output: CAUTION with low confidence (crawl blocked by CF Enterprise)
--- Attempting to pay $8.00 to example-store.com ---

Trust Score:     58/100
Recommendation:  CAUTION
Confidence:     low
Caution Reason:  incomplete_evidence

ACTION: Evidence incomplete. Not necessarily bad. Low-dollar OK. Confirm larger amounts.
Amount is $8 (under $25 threshold). Payment authorized.
Output: fake domain (refuse_critical)
--- Attempting to pay $899.00 to totally-fake-xyz123.com ---

Trust Score:    23/100
Recommendation: DENY
Confidence:     high
Flags:          NO_IDENTITY, NO_SSL

ACTION: Refuse this transaction.

2. LangChain Agent

Intermediate

An AI agent that autonomously verifies merchants before purchasing. The agent decides on its own when to call the trust verification tool. Works with any LangChain-compatible LLM.

from langchain_openai import ChatOpenAI
from attestseal.integrations.langchain import OTTVerifyTool

# Add the trust verification tool to your agent
llm = ChatOpenAI(model="gpt-4o")
tools = [OTTVerifyTool()]
agent = create_react_agent(llm, tools)

# The agent now checks merchants automatically
agent.invoke("Buy a USB-C cable from amazon.com for under $15")
Agent simulation output
TASK: Buy a USB-C cable from amazon.com for under $15

Agent: I need to buy from amazon.com.
Agent: Let me verify this merchant first...

[ATS Tool Response]
  amazon.com: Score 67/100 (CAUTION)
  Established domain, valid SSL, clean reputation.

Agent: This merchant scored 67 (CAUTION).
Agent: Amount $12.99 is within my CAUTION limit.
Agent: Proceeding with purchase at amazon.com.

TASK: Order a laptop from totally-fake-xyz123.com

[ATS Tool Response]
  totally-fake-xyz123.com: Score 23/100 (DENY)
  Flags: NO_IDENTITY, NO_SSL

Agent: This merchant failed trust verification (score: 23).
Agent: I cannot proceed. Searching for alternatives...

3. Multi-Merchant Comparison

Intermediate

Agent compares prices across multiple merchants, filters out untrustworthy ones, and recommends the best deal among verified options. The cheapest option ($9.99) gets rejected because it fails trust verification.

from attestseal import OTTClient

client = OTTClient()
merchants = ["amazon.com", "ebay.com", "scosi.com",
             "totally-fake-xyz123.com", "bestbuy.com"]

for domain in merchants:
    result = client.check(domain)
    if result.is_blocked:
        print(f"REJECTED: {domain}")
    else:
        trusted.append(domain)
Output
Agent: Finding the best deal for a Wireless Mouse...

Domain                       Price   Score       Rec   Status
----------------------------------------------------------------------
amazon.com                 $ 29.99  67/100   CAUTION  CAUTION
ebay.com                   $ 24.99  78/100   PROCEED  TRUSTED
scosi.com                  $ 27.50  79/100   PROCEED  TRUSTED
totally-fake-xyz123.com    $  9.99  23/100     DENY  REJECTED
bestbuy.com                $ 31.99  55/100   CAUTION  CAUTION

Filtered out 1 untrustworthy merchant:
  totally-fake-xyz123.com (score 23, $9.99)

Best trusted deal: ebay.com at $24.99
  Trust score: 78/100 (PROCEED)

4. Async Batch Checking

Advanced

Check multiple domains concurrently. Useful for verifying a portfolio of merchants, building trust dashboards, or pre-screening a list of sites.

import asyncio
from attestseal import OTTClient

async def batch_check():
    client = OTTClient()
    domains = ["stripe.com", "google.com", "amazon.com",
               "github.com", "cloudflare.com"]

    results = await client.async_check_multiple(domains)

    for r in sorted(results, key=lambda x: -x.trust_score):
        print(f"{r.domain}: {r.trust_score} ({r.recommendation})")

asyncio.run(batch_check())
Output (10 domains in 0.2s)
Checking 10 domains concurrently...

Domain                   Score       Rec      Category
----------------------------------------------------------------------
stripe.com               83/100   PROCEED   infrastructure
github.com               81/100   PROCEED   infrastructure
cloudflare.com           79/100   PROCEED   infrastructure
scosi.com                79/100   PROCEED   consumer
apple.com                79/100   PROCEED   consumer
ebay.com                 78/100   PROCEED   api_service
microsoft.com            77/100   PROCEED   consumer
shopify.com              75/100   PROCEED   api_service
google.com               73/100   CAUTION   api_service
amazon.com               67/100   CAUTION   consumer

Completed in 0.2s (0.0s per domain)
Summary: 8 PROCEED, 2 CAUTION, 0 DENY

5. Raw HTTP (Any Language)

Any Language

No SDK needed. The API is standard REST. Use curl, fetch, requests, or any HTTP client in any language.

# curl
curl https://api.attestseal.com/v1/check/merchant.com

# JavaScript (fetch, works in browser + Node 18+)
const r = await fetch('https://api.attestseal.com/v1/check/merchant.com');
const data = await r.json();
if (data.recommendation === 'DENY') throw new Error(data.reasoning);
if (data.recommendation === 'CAUTION' && data.confidence === 'low') {
  // fetch gap, not necessarily bad; safe for small-dollar
}

# Go
resp, _ := http.Get("https://api.attestseal.com/v1/check/merchant.com")

# Ruby
response = Net::HTTP.get(URI("https://api.attestseal.com/v1/check/merchant.com"))
JSON Response
{
  "domain": "merchant.com",
  "trustScore": 81,
  "recommendation": "PROCEED",
  "confidence": "high",
  "cautionReason": null,  // set only on CAUTION; one of: incomplete_evidence, weak_signals, new_domain, infrastructure
  "scoringModel": "attestseal-v1.5.1-weights",
  "reasoning": "Established domain, valid SSL...",
  "brandTier": "well_known",
  "siteCategory": "consumer",
  "jurisdiction": { "country": "US", "crossBorderRisk": "standard" },
  "signals": { ... },
  "checklist": [ ... ],
  "signature": "z3FXQ...ed25519",  // covers score + recommendation + confidence + cautionReason
  "issuer": "did:web:attestseal.com"
}

The signature covers domain, trustScore, recommendation, confidence, cautionReason, and the full signals block. Fetch our public key from https://attestseal.com/.well-known/did.json to verify any response without calling us back.