Skip to main content

langchain-trust-gate

LangChain tools for Trust Gate: signed receipts for agent actions, a read-only-allowlist decision gate, an egress marker check and an exit drill.

Receipts are signed by the hosted MCP server (no local signing key) with Ed25519, plus ML-DSA-65 when the server has a post-quantum backend. A receipt's integrity can be checked offline. To know which key signed it, verify with expected_kid (the kid of the server you trust): without that, anyone can generate keys and sign a receipt that verifies. The server defaults to PQ-required verify (a receipt with no verified post-quantum signature is rejected); set TRUST_GATE_REQUIRE_PQ=false on your own deployment to allow Ed25519-only receipts.

Install

pip install cwn-langchain-trust-gate

Usage

from langchain_trust_gate import MintActionReceiptTool, VerifyReceiptTool

# wire into any LangChain agent
tools = [MintActionReceiptTool(), VerifyReceiptTool()]

# typical flow inside an agent:
#   1. the agent decides to do something consequential
#   2. it calls trust_gate_mint_action_receipt(agent_id, operation, target)
#   3. the receipt is stored, attached to the audit log, returned to the user
#   4. later anyone can call trust_gate_verify_receipt(receipt) to confirm tamper-free

Configuration

# point at a different deployment (Render / Smithery / self-hosted)
export TRUST_GATE_URL="https://trust-gate-mcp.onrender.com"

Tools

Tool Purpose
trust_gate_mint_action_receipt Mint a signed receipt (Ed25519, plus ML-DSA-65 when the server has a post-quantum backend) for a consequential agent action.
trust_gate_verify_receipt Verify a receipt offline. Pass expected_kid to pin the signer; the result reports signer_pinned.
trust_gate_gate_decision Two-phase gate (server 0.3.0 or later). PREVIEW returns a verdict (ALLOW, DENY, ESCALATE); COMMIT signs a receipt and returns a permit, GRANTED only for ALLOW. It judges names against a read-only allowlist and does not observe or block anything.
trust_gate_check_egress Check data for sensitivity markers (NO_MARKERS_FOUND / INTERNAL / CONFIDENTIAL / RESTRICTED) before it leaves. It flags and cannot block.
trust_gate_run_exit_drill Vendor exit-readiness drill: checks the local signing key and whether a local model endpoint is configured. It signs a receipt, which creates the signing key on first use.

Compatibility

This release is written for Trust Gate MCP server 0.3.0 or later. Versions before 0.3.0 of the server's gate_decision returned GRANTED for every input: treat any GRANTED permit from a server older than 0.3.0 as not evidence. See the security advisory.

Passing expected_kid to a server older than 0.3.0 raises an error: those servers ignore the argument and would otherwise return ok without checking the signer.

Telemetry

Each tool invocation makes one fire-and-forget GET /x?via=langchain&kind=api against the Trust Gate server. No PII, no cookies, no fingerprinting -- just a channel tag so we can measure adoption per framework. Telemetry never blocks or fails the tool.

Background

License

Apache-2.0.

Metadata

Release files for cwn-langchain-trust-gate 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cwn-langchain-trust-gate 0.3.0
File Size Uploaded Provenance Actions
cwn_langchain_trust_gate-0.3.0.tar.gz 10.2 kB With provenance Details for cwn_langchain_trust_gate-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cwn-langchain-trust-gate 0.3.0
File Interpreter ABI Platform Actions
cwn_langchain_trust_gate-0.3.0-py3-none-any.whl Python 3 none any Details for cwn_langchain_trust_gate-0.3.0-py3-none-any.whl

Total release size: 19.3 kB

Release files / cwn_langchain_trust_gate-0.3.0.tar.gz

Download URL cwn_langchain_trust_gate-0.3.0.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cb6ab2e3995fdda35c4a58fb39983840448a969c5687c29534088cd93d571902
BLAKE2b-256 checksum
How to use checksums
9cb0a38099d06ad2ffa59ff5e3c067bd20e82571f19e6ba1084d0c68f2ea0b15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Release files / cwn_langchain_trust_gate-0.3.0-py3-none-any.whl

Download URL cwn_langchain_trust_gate-0.3.0-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2f27f9b234eac239300038961817a8b51aa430820fe076f0ea12f2b0531bd50
BLAKE2b-256 checksum
How to use checksums
72c48d9931dd75fb539be72d0969ea293c601e1a07919e4a424392f81d57e663
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

Security for cwn-langchain-trust-gate 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cwn_langchain_trust_gate-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page