Skip to main content

langchain-vaultak

PyPI version License: MIT Python 3.8+

Runtime security for LangChain agents, powered by Vaultak.

Intercept every agent action, score risk in real time, enforce policies, and automatically block dangerous behavior before it reaches your production systems — with two lines of code.


The Problem

LangChain agents can write to databases, send emails, execute code, and call external APIs. Without a security layer, a single misconfigured tool call can cause real damage — deleted records, leaked PII, unauthorized transactions.

langchain-vaultak wraps your existing LangChain agents with Vaultak's runtime security engine. Every tool call and agent action is scored and checked against your policy rules before it executes.


Install

pip install langchain-vaultak

Requires Python 3.8+, langchain-core>=0.1.0, and a Vaultak account at vaultak.com.


Quick Start

from langchain_vaultak import VaultakCallbackHandler

# Initialize with your Vaultak API key
handler = VaultakCallbackHandler(api_key="vtk_...")

# Pass as a callback to any LangChain agent
result = agent.run("Summarize our Q3 sales data", callbacks=[handler])

That is all. Every action the agent takes is now monitored, scored, and checked against your Vaultak policy rules.


What It Does

Event Vaultak Action
Agent picks a tool Risk-scores the action (0–10)
Tool call starts Checks against policy rules
Tool call returns output Scans output for PII and masks it
Tool or LLM error Sends alert to your Vaultak dashboard
Chain error Triggers automatic rollback
Risk score ≥ threshold Blocks the action, raises exception

Configuration

handler = VaultakCallbackHandler(
    api_key="vtk_...",           # Required — your Vaultak API key
    agent_name="sales-agent",    # Label for this agent in the dashboard
    block_on_high_risk=True,     # Block actions that exceed the threshold
    risk_threshold=7.0,          # 0–10 scale — default 7.0
    verbose=True,                # Log all scored actions
)

Setting a lower threshold for sensitive workloads

# For agents with access to production databases or financial systems
handler = VaultakCallbackHandler(
    api_key="vtk_...",
    agent_name="prod-db-agent",
    risk_threshold=5.0,  # More conservative
)

Using with Different Agent Types

ReAct / AgentExecutor

from langchain.agents import AgentExecutor
from langchain_vaultak import VaultakCallbackHandler

handler = VaultakCallbackHandler(api_key="vtk_...")

agent_executor = AgentExecutor(agent=agent, tools=tools)
result = agent_executor.invoke(
    {"input": "your task"},
    config={"callbacks": [handler]}
)

LCEL (LangChain Expression Language)

from langchain_vaultak import VaultakCallbackHandler

handler = VaultakCallbackHandler(api_key="vtk_...")

chain = prompt | llm | output_parser
result = chain.invoke(
    {"input": "your task"},
    config={"callbacks": [handler]}
)

Global callback (applies to all chains)

from langchain.callbacks import set_handler
from langchain_vaultak import VaultakCallbackHandler

set_handler(VaultakCallbackHandler(api_key="vtk_..."))

Viewing Results

Every action scored by this handler appears in your Vaultak dashboard at app.vaultak.com. You can:

  • See real-time risk scores for every tool call
  • Review the full action history for any agent run
  • Configure or tighten policy rules without code changes
  • Set up alerts for high-risk events

Requirements

  • Python 3.8+
  • langchain-core >= 0.1.0
  • vaultak >= 0.1.0
  • A Vaultak account — sign up at vaultak.com

Links


License

MIT — see LICENSE

Metadata

Release files for langchain-vaultak 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-vaultak 0.1.0
File Size Uploaded Provenance
langchain_vaultak-0.1.0.tar.gz 7.2 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 13.5 kB

Release files / langchain_vaultak-0.1.0.tar.gz

Download URL langchain_vaultak-0.1.0.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
038edd79ec26cf87b1705940cd779aaa843dba9df22315c7f425ba40b11b683c
BLAKE2b-256 checksum
How to use checksums
b13ba0174bc773650e27e1b1799598664b02e0bd90bbf0a1f0b6360276f564d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

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

Download URL langchain_vaultak-0.1.0-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f43ec4be9b7e24edfa0e903b88ac4bab1f75cba1d44f86a9c230f5c388c6f59d
BLAKE2b-256 checksum
How to use checksums
c19ddfeaaefb253a72b22b133a7a5e1a09db56d58084b44461dbe1017f967838
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for langchain-vaultak 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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