Skip to main content

Framework integrations

Put the verified entity record inside pipelines you already run. Each integration is a small, dependency-light pattern over the signed Entity Knowledge Statement — verified facts, corrections to common AI claims, and provenance on every observation. The Knowledge Statement read is keyless; nothing here requires a paid plan.

Every sample on this page was executed against production before it shipped.

Three patterns

  • Guardrail (output side) — before a draft answer reaches the user, check it against the verified record and block known-wrong entity facts with a citation. Wire it as an OpenAI Agents SDK output guardrail or any post-generation hook.
  • Retriever (input side, LangChain) — verified facts and corrections as retriever Documents with provenance metadata, composable into any chain or LangGraph node.
  • Reader (input side, LlamaIndex) — the same record as index documents, so downstream citations point at the signed statement instead of an unattributed string.

The recipes

# Output guardrail: block drafts that contradict the verified record.
# Prefers POST /api/v1/entities/{id}/grounding-check when ENTIDEX_API_KEY is set;
# falls back to a keyless offline check. Full sample: docs/integrations.
import json, os, re, urllib.request

def check_entity_grounding(slug: str, draft: str):
    key = os.environ.get("ENTIDEX_API_KEY")
    if key:
        # Keyed path — deterministic assertion extraction over the full canonical field set.
        req = urllib.request.Request(
            f"https://entidex.com/api/v1/entities/entx_{slug}/grounding-check",
            data=json.dumps({"statement": draft}).encode(),
            headers={"Authorization": f"Bearer {key}", "Content-Type": "application/json"},
            method="POST")
        try:
            with urllib.request.urlopen(req, timeout=30) as r:
                data = json.load(r).get("data", {})
            violations = [{"field": a["field"], "verified": a["verifiedValue"]}
                          for a in data.get("assertions", []) if a["verdict"] == "contradicted"]
            return {"grounded": not violations, "violations": violations,
                    "citation": data["provenance"]["verifiedRecordUrl"], "source": "grounding-check"}
        except Exception:
            pass  # fall through to the offline check

    # Keyless offline fallback: corrections-delta + year contradictions over the knowledge statement.
    with urllib.request.urlopen(f"https://entidex.com/entity/{slug}/knowledge?format=json", timeout=30) as r:
        statement = json.load(r)
    violations, draft_l = [], draft.lower()
    for c in statement.get("corrections", []):
        wrong, right = c.get("commonAiClaim", ""), c.get("verifiedValue", "")
        if wrong and wrong.lower() in draft_l and right.lower() not in draft_l:
            violations.append({"field": c["field"], "verified": right})
    years = set(re.findall(r"\b(?:19|20)\d{2}\b", draft))
    for f in statement.get("verifiedFacts", []):
        v = str(f.get("value", ""))
        if re.fullmatch(r"(?:19|20)\d{2}", v) and f["field"].lower() in draft_l \
                and years and v not in years:
            violations.append({"field": f["field"], "verified": v})
    return {"grounded": not violations, "violations": violations,
            "citation": statement["provenance"]["statementUrl"], "source": "offline"}

# check_entity_grounding("tesla", "Tesla, founded in 2010, ...")
#  -> grounded: False, violations: [{"field": "Founded", "verified": "2003"}]

Full runnable samples with execution transcripts live in the repo under docs/integrations/. With a free API key, free-form names resolve to canonical entities first via GET /api/v1/entities/resolve?q=….

The surfaces these call

  • /entity/{slug}/knowledge?format=json — the signed Knowledge Statement, keyless (the no-signup path). Also md and jsonld (schema.org ClaimReview).
  • GET /api/v1/entities/{id}/grounding-packet — the named, deterministic developer packaging of the same record. Free tier. Also ?format=grounding-metadata (Vertex-shaped groundingChunks / groundingSupports).
  • POST /api/v1/entities/{id}/grounding-check — coded verdict per assertion: supported / contradicted / unverifiable. Free tier, deterministic, zero LLM.
  • /api/v1/entities/resolve?q=… — free-form name to canonical entity with a confidence band. Free tier.
  • /api/v1/entities/{id}/ground-truth — the authenticated structured form of the underlying Knowledge Statement. Starter+.
  • MCP entity_verify_fact — in-flight verification for MCP-native agents; see the MCP server page.

Each recipe above prefers the keyed /grounding-packet or /grounding-check path when ENTIDEX_API_KEY is set and falls back to the keyless /entity/{slug}/knowledge route otherwise — one document / verdict shape, two paths.

The grounding loopConnect the MCP serverREST API reference

Start building — ask us for an API key

New sign-ups are paused while Entidex Intelligence moves to Arvor. Email hello@entidex.com and we will issue a key by hand; existing keys keep working. Or try the keyless scan first.