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 agentmesh-langchain

Features

  • VerificationIdentity: 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 VerificationIdentity, TrustGatedTool, TrustedToolExecutor

# Generate agent identity
identity = VerificationIdentity.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

agentmesh_langchain-3.4.0.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

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

agentmesh_langchain-3.4.0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for agentmesh_langchain-3.4.0.tar.gz
Algorithm Hash digest
SHA256 f264a76f4c4456e7131018e451c6db07bd4a482072e3de1f61cc928f85988035
MD5 8bc18c6048b69fc68b15cb5747824502
BLAKE2b-256 b753025dd17ba50dc9cefc8ef52ab7511d3173ba9e2e5e60cedc97af0c56a6f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for agentmesh_langchain-3.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cac53b1d9826b551d0139e0441a67e2bfe4a0a36f8a2f268381ca8a9b9f688d6
MD5 7456df0ba3f32899a601cea230234190
BLAKE2b-256 5850c599ec1be4097f977cb8582777edd1f59455e5efa5e08739a869df909c29

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