Skip to main content

Trust-gated checkpoint nodes for LangGraph — cryptographic identity, policy enforcement, and trust-aware routing for multi-agent graphs

Project description

langgraph-trust

Trust-gated checkpoint nodes for LangGraph — cryptographic identity, governance policy enforcement, and trust-aware routing for multi-agent graphs.

Built on AgentMesh trust primitives. Designed as an external package per LangGraph maintainer guidance.

Install

pip install langgraph-trust

Quick Start

from langgraph.graph import StateGraph, END
from langgraph_trust import TrustGate, PolicyCheckpoint, trust_edge
from langgraph_trust.gate import TrustScoreTracker

# Shared trust tracker
tracker = TrustScoreTracker()
tracker.set_score("research-agent", 0.85)

# Build a trust-gated graph
graph = StateGraph(dict)

graph.add_node("research", research_agent)
graph.add_node("trust_check", TrustGate(min_score=0.7, tracker=tracker))
graph.add_node("execute", execution_agent)
graph.add_node("human_review", human_review_agent)

graph.add_edge("research", "trust_check")
graph.add_conditional_edges("trust_check", trust_edge(
    pass_node="execute",
    fail_node="human_review",
))
graph.add_edge("execute", END)
graph.add_edge("human_review", END)

graph.set_entry_point("research")
app = graph.compile()

Components

TrustGate

Conditional checkpoint node that evaluates an agent's trust score before allowing graph transitions.

gate = TrustGate(
    min_score=0.7,           # Minimum score to pass
    review_threshold=0.8,    # Optional: scores between min and review → REVIEW verdict
    tracker=tracker,         # TrustScoreTracker instance
    identity_manager=idm,   # Optional: AgentIdentityManager for capability checks
    agent_name="my-agent",   # Default agent (overridden by state["trust_agent"])
    required_capabilities=["summarize"],  # Optional capability requirements
)

PolicyCheckpoint

Governance policy enforcement at graph transitions.

from langgraph_trust.policy import GovernancePolicy

policy = GovernancePolicy(
    name="production-safety",
    max_tokens=4000,
    max_tool_calls=5,
    blocked_tools=["shell_exec", "file_delete"],
    blocked_patterns=["password", "api_key", "secret"],
    require_human_approval=False,
)

checkpoint = PolicyCheckpoint(policy=policy)
graph.add_node("policy_gate", checkpoint)

Trust-Aware Edges

from langgraph_trust import trust_edge, trust_router

# Simple pass/fail routing
graph.add_conditional_edges("gate", trust_edge(
    pass_node="execute",
    fail_node="quarantine",
    review_node="human_review",  # Optional
))

# General-purpose routing
graph.add_conditional_edges("gate", trust_router({
    "pass": "execute",
    "fail": "quarantine",
    "review": "escalate",
}))

Dynamic Trust Scoring

from langgraph_trust.gate import TrustScoreTracker

tracker = TrustScoreTracker(default_score=0.5)

# After successful task
tracker.record_success("agent-a")  # +0.01

# After failure (severity configurable)
tracker.record_failure("agent-a", severity=0.2)  # -0.2

# Agent auto-blocked when score < min_score

Cryptographic Identity

from langgraph_trust import AgentIdentityManager

idm = AgentIdentityManager()

# Create Ed25519 identity with capabilities
alice = idm.create_identity("alice", capabilities=["summarize", "translate"])
print(alice.did)  # did:langgraph:a3f7c2...

# Sign and verify data
sig = alice.sign(b"important data")
assert alice.verify(sig, b"important data")

How It Works

All components write their verdict to state["trust_result"]:

{
    "verdict": "pass" | "fail" | "review",
    "score": 0.85,
    "threshold": 0.7,
    "agent_did": "did:langgraph:abc...",
    "reason": "Trust gate passed",
    "capabilities_checked": ["summarize"],
    "policy_violations": [],
    "timestamp": "2026-02-17T..."
}

The trust_edge and trust_router functions read this verdict to route the graph.

Integration with Full AgentMesh

This package provides a lightweight, self-contained trust layer. For the full 5-dimension trust scoring engine with temporal decay, trust contagion, and hash-chain audit chains, install:

pip install langgraph-trust[agentmesh]

Related

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langgraph_agentmesh-3.4.0.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langgraph_agentmesh-3.4.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file langgraph_agentmesh-3.4.0.tar.gz.

File metadata

  • Download URL: langgraph_agentmesh-3.4.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: RestSharp/106.13.0.0

File hashes

Hashes for langgraph_agentmesh-3.4.0.tar.gz
Algorithm Hash digest
SHA256 27b3e8a8d215fd212a6c79a21ed9c6430d76efb381a92c82587b0ae0362aa977
MD5 fc09af9f12a4674c8e688c7fded50b3c
BLAKE2b-256 decceccf35386d4464f3a956d5787afaf1d7518df9948a32d18f18b4f071fe10

See more details on using hashes here.

File details

Details for the file langgraph_agentmesh-3.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langgraph_agentmesh-3.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0602aede4aa53c68417bd61f682a0e8a2cab0333779db9b7928c08e9b99c528a
MD5 805adf84245ab503cbc34cc8ca162dc3
BLAKE2b-256 cdbbf899cc59c1ce059ad6b031a77872fd278cc19c7ae1702aa8a097ef696531

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page