Secure LangChain agents with Amorce (Ed25519 + HITL + A2A)
Project description
langchain-amorce
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
- Amorce: amorce.io
- GitHub: github.com/amorce/langchain-amorce
- PyPI: pypi.org/project/langchain-amorce
- Issues: github.com/amorce/langchain-amorce/issues
Built with ❤️ by the Amorce team
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_amorce-0.1.0.tar.gz.
File metadata
- Download URL: langchain_amorce-0.1.0.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7a789624f11fd6d3ae0b758930e1ddc2f2a3d3c7eebcfdcf9714b9c77d3f37f
|
|
| MD5 |
40560bbbb96c921fdd5c799439e8727b
|
|
| BLAKE2b-256 |
ead063a263e3df0e4d2ecd2887285da27091107256cc64e4a5441a4bbb0ee198
|
File details
Details for the file langchain_amorce-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_amorce-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff96c0bbcd928dfee18d79db698154739ab31e0350f3a5f36d19743d1eada118
|
|
| MD5 |
b71dc3d3a836c27246ab2d45879df49a
|
|
| BLAKE2b-256 |
45f071c8c0c8c38462c1fe37b6a4a7a59607a7b584d5c22193f32936839a9016
|