Skip to main content

AgentMesh trust layer integration for LangChain - cryptographic identity and trust-gated tool execution

Project description

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

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_agentmesh-0.1.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

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

langchain_agentmesh-0.1.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file langchain_agentmesh-0.1.0.tar.gz.

File metadata

  • Download URL: langchain_agentmesh-0.1.0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for langchain_agentmesh-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5819f4fced0c6ec183fa4f7c4a99c7b493256c31167fb0ea9603c1606110dbc6
MD5 4bf066c6e749701abe7846adbe9d92be
BLAKE2b-256 c874d3871fec2e5435ad0531cf4aaf23196c9851c14e5ac0bec8914cdc29c46a

See more details on using hashes here.

File details

Details for the file langchain_agentmesh-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_agentmesh-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a157a1a04b1576b20f3c1d28ae8ace82fb3a41583d3909283cd794e061a8a511
MD5 1f2846ee389130635926cee01d287281
BLAKE2b-256 1b3eb3fdf2b9f5293841404a0e8502b45fda2dea833425a58d5c44f2d465f9bd

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