Skip to main content

LangChain AgentMesh Integration

Cryptographic identity verification and trust-gated tool execution for LangChain agents.

Installation

pip install langchain-agentmesh

Features

  • CMVKIdentity: Ed25519-based cryptographic identity for agents
  • TrustGatedTool: Wrap any tool with trust requirements
  • TrustedToolExecutor: Execute tools with automatic verification
  • TrustCallbackHandler: Monitor trust events during chain execution
  • TrustHandshake: Verify peer agents before collaboration
  • DelegationChain: Hierarchical capability delegation

Quick Start

from langchain_agentmesh import CMVKIdentity, TrustGatedTool, TrustedToolExecutor

# Generate agent identity
identity = CMVKIdentity.generate('research-agent', capabilities=['search', 'summarize'])

# Wrap a tool with trust requirements
gated_tool = TrustGatedTool(
    tool=search_tool,
    required_capabilities=['search'],
    min_trust_score=0.8
)

# Execute with verification
executor = TrustedToolExecutor(identity=identity)
result = executor.invoke(gated_tool, 'query')

Use Cases

Multi-Agent Trust Verification

from langchain_agentmesh import TrustHandshake

# Create handshake for peer verification
handshake = TrustHandshake(my_identity)

# Verify peer before collaboration
result = await handshake.verify_peer(peer_identity)
if result.trusted:
    # Safe to delegate task
    response = await peer_agent.invoke(task)

Trust-Gated Tool Execution

from langchain_agentmesh import TrustGatedTool

# Sensitive tool requiring high trust
code_execution_tool = TrustGatedTool(
    tool=python_repl,
    required_capabilities=['code:execute'],
    min_trust_score=0.9,
    audit_logging=True
)

# Only trusted agents can use this tool
result = executor.invoke(code_execution_tool, code)

Callback Integration

from langchain_agentmesh import TrustCallbackHandler

# Monitor trust events
callback = TrustCallbackHandler(
    on_verification=lambda r: print(f"Verified: {r.peer_did}"),
    on_violation=lambda v: alert(f"Violation: {v}")
)

agent = create_agent(callbacks=[callback])

Configuration

Parameter Default Description
min_trust_score 0.5 Minimum trust score required
required_capabilities [] Required capability list
audit_logging False Enable audit trail
cache_ttl 900 Verification cache TTL (seconds)

Related

License

MIT

Metadata

Release files for langchain-agentmesh 0.1.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 langchain-agentmesh 0.1.0
File Size Uploaded
langchain_agentmesh-0.1.0.tar.gz 13.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-agentmesh 0.1.0
File Interpreter ABI Platform
langchain_agentmesh-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 29.0 kB

Release files / langchain_agentmesh-0.1.0.tar.gz

Download URL langchain_agentmesh-0.1.0.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5819f4fced0c6ec183fa4f7c4a99c7b493256c31167fb0ea9603c1606110dbc6
BLAKE2b-256 checksum
How to use checksums
c874d3871fec2e5435ad0531cf4aaf23196c9851c14e5ac0bec8914cdc29c46a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / langchain_agentmesh-0.1.0-py3-none-any.whl

Download URL langchain_agentmesh-0.1.0-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a157a1a04b1576b20f3c1d28ae8ace82fb3a41583d3909283cd794e061a8a511
BLAKE2b-256 checksum
How to use checksums
1b3eb3fdf2b9f5293841404a0e8502b45fda2dea833425a58d5c44f2d465f9bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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