AI Frameworks Integration
Permitly Consent Middleware & Verification for LangChain Agents
Wrap LangChain tool execution in cryptographically signed user approval gates.
Integration Code Example (PYTHON)
from permitly import Permitly
from langchain.tools import tool
permitly = Permitly(api_key="pm_live_...")
@tool
def execute_database_migration(query: str, user_id: str) -> str:
"""Executes SQL migration after obtaining human consent."""
token = permitly.verify_consent(
user_id=user_id,
scope="db.migration.write"
)
if not token.is_valid():
return "Execution halted: Human consent required."
return "Migration completed successfully."
Execution Sequence Flow
sequenceDiagram
participant Agent as 🦜 LangChain Agent
participant Middleware as 🛡️ Permitly Tool Middleware
participant User as 👤 Human User
Agent->>Middleware: 1. Invoke Tool (db.migration.write)
Middleware->>User: 2. Prompt User Consent Page
User->>Middleware: 3. User Approves Request
Middleware-->>Agent: 4. Pass Signed Token & Execute Tool
High-ROI Security Gate
Protecting your LangChain pipeline against unauthorized actions delivers an immediate compliance audit trail with zero infrastructure overhead.
Frequently Asked Questions
Can Permitly protect LangChain tools automatically?
Yes, wrapping LangChain `@tool` functions with Permitly middleware enforces consent before the tool payload is dispatched.