langchain - 💡(How to fix) Fix Cryptographic agent identity, intent verification, and kill switch for production deployments [47 comments, 12 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langchain-ai/langchain#36232Fetched 2026-04-08 01:31:11
View on GitHub
Comments
47
Participants
12
Timeline
121
Reactions
0

Root Cause

Example: A LangChain agent has access to transfer_funds, send_email, and search_database. Today, if a prompt injection tricks the agent into calling transfer_funds("[email protected]", 50000), there is no protocol-level barrier. With cryptographic identity, the action is automatically blocked because the signed intent fails verification against the agent's $500 per-transaction boundary, the tool never executes.

Code Example

from aip_protocol import AgentPassport, create_envelope, sign_envelope, verify_intent

passport = AgentPassport.create(
    domain="fintech.com", agent_name="assistant",
    allowed_actions=["search", "send_email", "transfer_funds"],
    denied_actions=["delete_records"],
    monetary_limit_per_txn=500,
)
# Every tool call → signed envelope → verified → execute or block
RAW_BUFFERClick to expand / collapse

Checked other resources

  • This is a feature request, not a bug report or usage question.
  • I added a clear and descriptive title that summarizes the feature request.
  • I used the GitHub search to find a similar feature request and didn't find it.
  • I checked the LangChain documentation and API reference to see if this feature already exists.
  • This is not related to the langchain-community package.

Package (Required)

  • langchain
  • langchain-openai
  • langchain-anthropic
  • langchain-classic
  • langchain-core
  • langchain-model-profiles
  • langchain-tests
  • langchain-text-splitters
  • langchain-chroma
  • langchain-deepseek
  • langchain-exa
  • langchain-fireworks
  • langchain-groq
  • langchain-huggingface
  • langchain-mistralai
  • langchain-nomic
  • langchain-ollama
  • langchain-openrouter
  • langchain-perplexity
  • langchain-qdrant
  • langchain-xai
  • Other / not sure / general

Feature Description

When LangChain agents are deployed to production, there is no built-in mechanism to cryptographically verify which agent is executing a tool call, enforce per-tool action boundaries (allowed/denied actions, monetary limits), or instantly revoke a compromised agent's access across all tools.

I'm requesting native support for cryptographic agent identity and intent verification, so every tool call is signed, verified, and auditable before execution. This includes a kill switch that instantly blocks all tool calls from a revoked agent.

Use Case

In production environments handling financial transactions or sensitive data, agent security currently relies on prompt engineering and API key scoping, both are insufficient.

Example: A LangChain agent has access to transfer_funds, send_email, and search_database. Today, if a prompt injection tricks the agent into calling transfer_funds("[email protected]", 50000), there is no protocol-level barrier. With cryptographic identity, the action is automatically blocked because the signed intent fails verification against the agent's $500 per-transaction boundary, the tool never executes.

This is critical for anyone deploying LangChain agents in fintech, healthcare, or enterprise environments.

Proposed Solution

An open-source protocol called AIP (Agent Identity Protocol) that solves this:

  • Agent Passports — Ed25519 keypair per agent with allowed/denied actions and monetary limits
  • Signed Intent Envelopes — Before every tool call, agent signs: "I am X, doing Y, at time T"
  • Kill Switch — Instant revocation, sub-millisecond, zero network calls

GitHub: https://github.com/theaniketgiri/aip

from aip_protocol import AgentPassport, create_envelope, sign_envelope, verify_intent

passport = AgentPassport.create(
    domain="fintech.com", agent_name="assistant",
    allowed_actions=["search", "send_email", "transfer_funds"],
    denied_actions=["delete_records"],
    monetary_limit_per_txn=500,
)
# Every tool call → signed envelope → verified → execute or block

This have a working LangChain integration.

Alternatives Considered

  • API key scoping — Limits which APIs an agent can call, but doesn't verify intent or enforce monetary limits per action
  • Prompt-level guardrails — System prompts saying "don't transfer more than $500" can be bypassed by prompt injection
  • LLM-as-judge — Using another LLM to validate actions adds latency and is probabilistic, not deterministic

AIP is deterministic, sub-millisecond, and operates outside the LLM context — it cannot be bypassed by prompt engineering.

Additional Context

extent analysis

Fix Plan

To implement the Agent Identity Protocol (AIP) in LangChain, follow these steps:

  1. Install the AIP protocol library: Run pip install aip-protocol to install the required library.
  2. Create an Agent Passport: Generate an Ed25519 keypair for each agent and define allowed/denied actions and monetary limits.
from aip_protocol import AgentPassport

passport = AgentPassport.create(
    domain="fintech.com", 
    agent_name="assistant",
    allowed_actions=["search", "send_email", "transfer_funds"],
    denied_actions=["delete_records"],
    monetary_limit_per_txn=500,
)
  1. Sign and Verify Intent Envelopes: Before every tool call, sign an envelope with the agent's identity, action, and timestamp, and verify the intent using the verify_intent function.
from aip_protocol import create_envelope, sign_envelope, verify_intent

envelope = create_envelope(passport, "transfer_funds", 100)
signed_envelope = sign_envelope(envelope, passport.private_key)
if verify_intent(signed_envelope, passport.public_key):
    # Execute the tool call
else:
    # Block the tool call
  1. Integrate with LangChain: Modify the LangChain code to use the AIP protocol for tool calls. Refer to the working LangChain demo: github.com/theaniketgiri/aip/demos/langchain_protected_tools

Verification

To verify that the fix worked:

  1. Test the agent's ability to execute allowed actions within the defined monetary limits.
  2. Attempt to execute denied actions or exceed the monetary limits to ensure the agent is blocked.
  3. Verify that the kill switch instantly revokes the agent's access to all tools.

Extra Tips

  • Ensure proper key management and storage for the agent's private key.
  • Monitor and log all tool calls and verification results for auditing and debugging purposes.
  • Consider implementing additional security measures, such as rate limiting and IP blocking, to further enhance the security of the LangChain agents.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING