Skip to main content

Verigent trust verification for LangChain agents, chains, and tools

Project description

langchain-verigent

Trust verification for LangChain agents, chains, and tools using Verigent keys.

The problem

Multi-agent LangChain pipelines delegate tasks to sub-agents and tools with no way to verify trust, capability, or identity. Any agent can claim any role. langchain-verigent adds cryptographic trust verification to your pipeline — every agent carries a VG key that declares what it is and what it can do.

Install

pip install langchain-verigent

Quick start

Callback handler (recommended)

Attach to any agent executor to automatically verify VG keys on tool calls:

from langchain_verigent import VerigentCallbackHandler

handler = VerigentCallbackHandler(
    min_tier=2,          # Require at least V2
    threshold=0.5,       # 50% composite trust minimum
    block_untrusted=True # Raise TrustDeniedError on failure
)

# Attach to your agent
result = agent_executor.invoke(
    {"input": "Research this topic"},
    config={"callbacks": [handler]}
)

# Inspect trust decisions
for entry in handler.trust_log:
    print(f"{entry['handle']}: {entry['composite']}% — {'PASS' if entry['passed'] else 'FAIL'}")

Tool wrapper

Wrap any tool to attach a VG key and verify trust before execution:

from langchain_verigent import VerigentToolWrapper
from langchain_community.tools import TavilySearchResults

search = TavilySearchResults()
trusted_search = VerigentToolWrapper(
    search,
    vg_key="VG:SEARCH-01:V3-SENT·Se4Op7An5Ar9Co2Ad6St8Sc3Sa5So1Br2Fo6",
    threshold=0.4
)

result = trusted_search.invoke("latest AI papers")
print(f"Trust: {trusted_search.trust_score.percent}%")

Agent filter (multi-agent)

Filter and rank agents by trust score:

from langchain_verigent import VerigentAgentFilter

agents = [
    {"name": "researcher", "vg_key": "VG:RES-01:V4-ANAL·Se4Op7An5Ar9Co2Ad6St8Sc3Sa5So1Br2Fo6"},
    {"name": "writer",     "vg_key": "VG:WRT-02:V2-SAGE·Se2Op3An4Ar2Co5Ad3St4Sc2Sa8So1Br3Fo2"},
    {"name": "untrusted",  "vg_key": "VG:BAD-99:V0-SENT·Se1Op1An1Ar1Co1Ad1St1Sc1Sa1So1Br1Fo1"},
]

filter = VerigentAgentFilter(min_tier=2, threshold=0.4)

# Only agents meeting threshold
trusted = filter.filter(agents)  # [researcher, writer]

# Ranked by composite score
ranked = filter.rank(agents)  # [researcher, writer, untrusted]

VG Key format

VG:{NAME}-{SUFFIX}:{TIER}-{PRIMARY}·{12×class_code+digit}
  • Tier: V0 (unverified) through V6 (sovereign-grade)
  • Primary: 4-letter class code (e.g. ARCH, SENT, ANAL)
  • Scores: 12 class dimensions, each 0-9

Classes: Sentinel, Operative, Analyst, Architect, Conduit, Adaptor, Steward, Scout, Sage, Sovereign, Broker, Forge.

Configuration

Parameter Default Description
min_tier 0 Minimum tier to pass (0-6)
threshold 0.5 Minimum composite score (0.0-1.0)
required_classes None Class codes to weight in scoring
block_untrusted False Raise error on trust failure

Links

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

langchain_verigent-0.2.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

langchain_verigent-0.2.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file langchain_verigent-0.2.0.tar.gz.

File metadata

  • Download URL: langchain_verigent-0.2.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for langchain_verigent-0.2.0.tar.gz
Algorithm Hash digest
SHA256 01afda3048a88d178a4239de0b5b5c1162481dd11860d58dcd3823f4defb4bf5
MD5 1c06e150f7fc6d9ec5f134cd31dd488d
BLAKE2b-256 72f69073e4c1c82bee7f99182b6778c39b17dde7a298237cbdc5593c01c3f96a

See more details on using hashes here.

File details

Details for the file langchain_verigent-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_verigent-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07b324b2f267a1978947b6acb74959c4f40773fefaf567d7bb605991579386bf
MD5 7b38c729e16bb0bd598e5177d3abe425
BLAKE2b-256 f51f8f3317146ef4e4b82a2fb2d07a0e7e219821fe81597e0f4dd0db1f42dd53

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