Skip to main content

langchain-amorce

GitHub License Demo

Secure LangChain agents with Amorce in 2 lines of code

Add Ed25519 signatures, human-in-the-loop approvals, and A2A compatibility to any LangChain agent.


🚀 Quick Start

Installation

pip install langchain-amorce

Basic Usage (2 Lines!)

from langchain_amorce import AmorceAgent
from langchain.chat_models import ChatOpenAI
from langchain.tools import DuckDuckGoSearchRun

# Create secure agent
agent = AmorceAgent(
    llm=ChatOpenAI(model="gpt-4"),
    tools=[DuckDuckGoSearchRun()],
    secure=True  # ← Adds Amorce security
)

# Use normally - all actions are now cryptographically signed
result = agent.run("What's the latest AI news?")
print(f"Agent ID: {agent.agent_id}")  # Verified identity

That's it! Your LangChain agent now has:

  • ✅ Ed25519 cryptographic signatures
  • ✅ Trust Directory verification
  • ✅ Automatic identity management
  • ✅ A2A-compatible messages

🛡️ Features

Cryptographic Signatures

Every agent action is signed with Ed25519, providing non-repudiable proof of authorization.

Human-in-the-Loop (HITL)

Require human approval for sensitive operations:

from langchain.tools import ShellTool

agent = AmorceAgent(
    llm=ChatOpenAI(),
    tools=[
        DuckDuckGoSearchRun(),  # No approval needed
        ShellTool()              # Dangerous!
    ],
    hitl_required=['shell'],  # Require approval for shell
    secure=True
)

# Search works normally
agent.run("Search for Python tutorials")

# Shell command triggers approval popup
agent.run("Delete tmp files")  # ← Human approval required!

A2A Protocol Compatible

Messages are formatted for Agent-to-Agent Protocol compatibility:

agent = AmorceAgent(
    llm=ChatOpenAI(),
    tools=[search],
    a2a_compatible=True  # ← Enable A2A format
)

# All messages use A2A envelope with Amorce signatures

📖 Examples

Marketplace Demo (Sarah - Buyer Agent)

See the full Enhanced Marketplace Demo showing Sarah negotiating with Henri.

from langchain_amorce import AmorceAgent
from langchain.chat_models import ChatOpenAI

sarah = AmorceAgent(
    name="Sarah",
    role="Smart Shopper",
    llm=ChatOpenAI(model="gpt-4"),
    tools=[
        brave_search_tool,      # Price research
        budget_calculator,       # Affordability check
        fraud_detector,         # Verify seller
    ],
    hitl_required=['make_payment', 'share_address'],
    max_budget=500,
    secure=True
)

# Sarah autonomously:
# 1. Searches for MacBook Pro
# 2. Finds sellers in Trust Directory
# 3. Verifies reputations
# 4. Negotiates price
# 5. Requests human approval for payment

🔧 Advanced Configuration

Custom Identity

from amorce import IdentityManager

# Load existing identity
identity = IdentityManager.load_from_file("my_agent.pem")

agent = AmorceAgent(
    llm=ChatOpenAI(),
    tools=[...],
    identity=identity  # Use specific identity
)

Custom Amorce Client

from amorce import AmorceClient

client = AmorceClient(
    identity,
    directory_url='https://my-directory.com',
    orchestrator_url='https://my-orchestrator.com'
)

agent = AmorceAgent(
    llm=ChatOpenAI(),
    tools=[...],
    amorce_client=client  # Custom client
)

🧪 Testing

# Run tests
pytest tests/

# With coverage
pytest --cov=langchain_amorce tests/

📚 Documentation


🤝 Contributing

Contributions welcome! See CONTRIBUTING.md


📄 License

MIT License - see LICENSE


🔗 Links


Built with ❤️ by the Amorce team

Release files for langchain-amorce 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-amorce 0.1.0
File Size Uploaded
langchain_amorce-0.1.0.tar.gz 8.2 kB Details

Built distribution (wheel)

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

Total release size: 16.2 kB

Release files / langchain_amorce-0.1.0.tar.gz

Download URL langchain_amorce-0.1.0.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a7a789624f11fd6d3ae0b758930e1ddc2f2a3d3c7eebcfdcf9714b9c77d3f37f
BLAKE2b-256 checksum
How to use checksums
ead063a263e3df0e4d2ecd2887285da27091107256cc64e4a5441a4bbb0ee198
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

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

Download URL langchain_amorce-0.1.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ff96c0bbcd928dfee18d79db698154739ab31e0350f3a5f36d19743d1eada118
BLAKE2b-256 checksum
How to use checksums
45f071c8c0c8c38462c1fe37b6a4a7a59607a7b584d5c22193f32936839a9016
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

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