Been seeing a lot of questions about production safety for LangChain agents so wanted to share what we use.
The problem: once a LangChain agent has tool access in production, there’s no built-in way to intercept and block dangerous actions before they execute.
Here’s a lightweight approach using Vaultak:
pip install vaultak
from vaultak import Vaultak
vt = Vaultak(api_key="vtk_...")
with vt.monitor("my-agent"):
result = agent.invoke({"input": user_input})
Every tool call now gets risk-scored before execution. You can add policies to block specific actions:
vt.policy.create({
"name": "no-prod-deletes",
"action": "delete",
"resource": "production_*",
"effect": "deny",
"priority": 1
})
There’s also a free scanner at AI Agent Risk Scanner, Vaultak if you want to check your agent’s risk profile without writing any code first.
Full guide with more examples:
Happy to answer questions about the implementation.
@samueloladji-beep , why not wrap this in a middleware, rather than using it in a context manager.
middleware is actually cleaner for production use. Here’s how you’d do it:
from langchain.callbacks.base import BaseCallbackHandler
from vaultak import Vaultak
class VaultakHandler(BaseCallbackHandler):
def init(self, api_key: str, agent_name: str):
self.vt = Vaultak(api_key=api_key)
self.agent_name = agent_name
def on_tool_start(self, tool, input_str, **kwargs):
self.vt.log_action(
agent_id=self.agent_name,
action_type="tool_call",
resource=tool["name"],
payload=input_str
)
agent.invoke(
{“input”: user_input},
config={“callbacks”: [VaultakHandler(api_key=“vtk_…”, agent_name=“my-agent”)]}
)
The context manager approach is simpler for quick setup. The callback handler is better for production; it hooks directly into LangChain’s execution lifecycle so you get per-tool visibility rather than wrapping the whole invocation.
We’re actually adding a native LangChain integration to the SDK. Will post here when it’s ready.