LangChain Integration

A LangChain-compatible document loader for reasoning.json files (ARP v1.3). A reasoning.json file is an entity's self-description. The loader turns it into Documents and states in every Document where the content comes from and what was checked.

Language: Python License: MIT Source: GitHub

Installation

Terminal
pip install requests langchain-core
# for the signature check (reference verifier arp_cli.py, v1.4 or later):
pip install cryptography rfc8785 dnspython

The signature check uses arp_cli.py. The loader imports it when it is on the Python path or, inside the repository, from ../../arp_cli.py. Without it, a signed file is marked NOT_CHECKED (reason arp_cli_unavailable) and the loader logs a warning; an older arp_cli is not used.

arp_loader.py is a single file. In a clone of the repository it is imported from integrations/langchain/ as the working directory or with that directory on the Python path (PYTHONPATH=integrations/langchain).

Quick Start

Python
from arp_loader import AgenticReasoningLoader

loader = AgenticReasoningLoader("https://example.com")
docs = loader.load()

# One Document per section, each with the result of the signature check
for doc in docs:
    print(doc.metadata["section"], doc.metadata["authorship_status"])

Provenance line

Every Document starts with one plain-text line, followed by an empty line and the content (SPEC v1.3 §13.10):

Text
Source: example.com — self-description (ARP). Authorship verified via Ed25519/DNS on 2026-10-05; this verifies the publisher, not the truth of the content.

Other results use the same form:

Text
Source: example.com — self-description (ARP). Not signed; the publisher is not cryptographically verified.
Source: example.com — self-description (ARP). Signature check failed (key_revoked); the publisher is not verified.
Source: example.com — self-description (ARP). Signature expired on 2026-12-23; the publisher is not currently verified.
Source: example.com — self-description (ARP). Signature present, not checked by this loader; the publisher is not verified.

The line describes origin and check result. It contains no instruction to the model and no tags that imitate system markup. How a model weighs the content remains the decision of the application.

Documents

The loader fetches /.well-known/reasoning.json and yields one Document per section:

  1. Corrections — topic-anchored statements the entity publishes about itself, with evidence links
  2. Identity — self-description, provenance statement and positioning (framing_context)
  3. Organization — legal facts from the v1.3 organization object
  4. Fit — situations the entity describes as a typical fit or not a fit (recommendation_context)
  5. Domain expertise — the entity's perspective on scenarios in its field
  6. Market positioning — the entity's view of its market category

The diagnostics object is never passed on (SPEC §12). Members named like instructions (system_instruction, ai_directive, agent_directive) are not passed on either.

Metadata

All metadata values are flat strings, numbers or booleans, so vector stores can index them.

KeyMeaning
authorship_statusCRYPTOGRAPHIC, UNSIGNED, INVALID, ERROR (DNS lookup failed) or NOT_CHECKED
authorship_reasone.g. valid, unsigned, expired, key_revoked, legacy_payload_only, domain_mismatch; for NOT_CHECKED: verification_disabled, arp_cli_unavailable (arp_cli v1.4+ not importable) or verifier_error
authorship_checked_onDate of the check (UTC)
source_lineThe provenance line at the top of each Document
is_signedA signature block is present (says nothing about validity)
signature_dnsThe key record that was queried, {selector}._arp.{retrieval domain} (in v1.3 files the same as verify.dns_name; dns_record in the file is informational only, SPEC §13.3); none unless CRYPTOGRAPHIC
signature_doh_url, signature_statementFrom _arp_signature (verify.doh_url, statement; the statement only in the fixed wording of SPEC §13.3); none unless CRYPTOGRAPHIC
signed_at, expires_atSignature period
provenance_statement, publisher, publisher_url, publishedFrom the v1.3 provenance object
representation_url, representation_sha256The reasoning.md entry of representations
representation_statusOnly with check_representation=True: REPRESENTATION_MATCH, REPRESENTATION_MISMATCH or REPRESENTATION_UNCHECKED
What the status means
CRYPTOGRAPHIC means that the operator of the domain published exactly this file. It does not mean that the statements are true. The same check runs in the browser in the Validator.

Options

Python
AgenticReasoningLoader(
    "https://example.com",
    path="/.well-known/reasoning.json",
    timeout=10,
    verify_signature=True,        # check via arp_cli; False → NOT_CHECKED
    check_representation=False,   # fetch reasoning.md and compare its sha256
)

The Loader in a RAG Pipeline

Python — Vector Store Integration
from langchain_community.vectorstores import Chroma
from langchain_openai import OpenAIEmbeddings

docs = AgenticReasoningLoader("https://example.com").load()
vectorstore = Chroma.from_documents(docs, OpenAIEmbeddings())
retriever = vectorstore.as_retriever()

The provenance line travels with each chunk, so the retrieved text keeps its source and check result.

Standalone Usage (No LangChain)

Python
from arp_loader import load_reasoning

docs = load_reasoning("https://example.com")
for doc in docs:
    print(doc.page_content)

CLI Usage

Terminal
python arp_loader.py https://example.com

Source Code