A type-checker and contract layer for AI agent tool calls: in-process, Pydantic-only. Strict argument validation, ghost-argument stripping, and self-healing retries for MCP servers and agent frameworks.
pip install agent-airlock==0.10.35 Copy PIP instructions
Strict argument validation, ghost-argument stripping, and self-healing retries — one decorator, any agent or MCP server. Pydantic-only core.
Test suite: 10,969 tests · Coverage: 91.67% · v0.10.35 Coverage runs 10,950 of 10,969; the 19 excluded are 8 benchmark tests (not correctness tests), 5 docker-marked (need a daemon — they run in CI's docker-sandbox job, against the image built from the Dockerfile at the repo root) and 6 live API contract tests (need an Anthropic API key and spend API credit; make test-live).
Quickstart · Benchmarks · Frameworks · Docs · How numbers are reported
An LLM decides which tool to call and what to pass it. Nothing checks the arguments before they reach your code.
# Your tool expects an int. The model sends a string, and invents a parameter. transfer_funds(amount="500", to="alice", force=True) # ^^^^^ ^^^^^^^^^^ # wrong type never in your signature Type coercion turns "500" into 500 and moves on. The invented force=True lands in **kwargs and silently changes behaviour. Neither is a model failure you can prompt away — it is a missing contract at the call boundary.
pip install "agent-airlock>=0.10.3" from agent_airlock import Airlock @Airlock() def transfer_funds(amount: int, to: str) -> str: return f"Sent ${amount} to {to}" That is the whole integration. Now:
A blocked call returns a dict (AirlockResponse.to_dict()) rather than raising, so the model gets a refusal it can act on instead of a traceback it cannot.
The decorator runs a fixed sequence of gates before your function and sanitises after it. Validation, output sanitising and the audit log are on by default; the rest is opt-in.
These stop a call that passes validation but should not run yet, or should not run twice.
None of this undoes an action that already ran, and airlock ships no approval channel: you connect the approver to Slack, a ticket queue or a prompt.
Two checks that run before any argument is read:
Nine MCP server CVEs published on 27 and 28 October 2026 share one shape: a string argument of an ordinary tool reaches a shell or a package installer on the server. CVE-2026-117558 (ai-sdlc, repo), CVE-2026-117559 (DroidMind), CVE-2026-117560 (ATXP), CVE-2026-117561 (sf-mcp), CVE-2026-117567 (esp-mcp, target, port, project_path), CVE-2026-117568 (mcp-ffmpeg), CVE-2026-117569 (Kali-GPT), CVE-2026-117573 (hagent, args) and CVE-2026-59176 (functype-mcp-server, version into pnpm add). ToolArgSinkGuard, off by default, reads those arguments on the call path, before the call reaches a server that builds a command line:
from agent_airlock import Airlock, SecurityPolicy, ToolArgSinkGuard guard = ToolArgSinkGuard(shell_args={"repo"}, installer_args={"version"}) @Airlock(policy=SecurityPolicy(tool_arg_sink_guard=guard)) def check_issue(repo: str, version: str = "1.4.4") -> str: return f"checked {repo}" repo="x; id" is refused (block_reason "tool_arg_sink"), and so is a version that is not a bare PEP 440 or npm semver version: a URL, a path, file: or npm:, pkg[extra]. screen_all_str_args=True screens every argument except free_text_args; policy_presets.tool_arg_sink_defaults() does that in warn mode first. Details: Shell and installer arguments.
dispatch_args covers an argument that names a function the tool then calls. Agno's PandasTools passed read_pickle to getattr(pandas, ...) that way (CVE-2026-119050): no shell syntax for the check above to see. ToolArgSinkGuard(dispatch_args={"operation": ("head", "describe")}) admits those names only; an empty allowlist refuses private names, *pickle*, read_*, to_*, eval, exec and their like. Preset: policy_presets.reflection_sink_defaults(dispatch_args=...), warn mode first. Details: Dispatch arguments.
Every row is one command you can run. Dates are when the number was last actually produced, not when the row was last edited — check_benchmark_freshness.py fails the release if any row drifts past 30 days.
Every airlock arm in rows 1 to 6 runs a least-privilege SecurityPolicy(default_deny=True) with only the tools the task needs on its allowlist (row 1's argument items go to the guard chain, row 5's G0 tier is contract-only), not the library defaults, under which an empty allowlist allows every tool.
Summary and method: BENCHMARK.md. Every row, with the full results for each: Benchmarks.
The decorator is in-process: not a proxy, a gateway or a sidecar. It runs inside the process that executes the tool, the only place the real Python arguments exist. A gateway authenticates identity and transport and sandboxes the server, but it does not check a tool call's argument contract: live, a Docker MCP Gateway forwarded all 12 malformed payloads that airlock blocks (row 6 above).
Both paths use the same @Airlock() decorator. Adapter-shipped means a module in the package handles the framework's glue (signature preservation, tool-registry rewrites, request shapes, approvals); example-only means the plain decorator works.
Adapter-shipped (16) modules for 12 frameworks: LangChain (integrations/langchain.py), LangGraph (integrations/langgraph.py at the ToolNode, integrations/langgraph_toolnode_compat.py), OpenAI Agents SDK (integrations/openai_guardrails.py, integrations/openai_agents.py), Anthropic Messages API (integrations/anthropic.py), Anthropic Claude Agent SDK (integrations/anthropic_claude_agent_sdk.py, v0.6.1+), smolagents (integrations/smolagents_wrapper.py), Gemini 3 Agent Mode (integrations/gemini3_tool_shape_adapter.py), GPT-5.5 (integrations/gpt5_5_tool_shape_adapter.py), PydanticAI (integrations/pydantic_ai.py, integrations/pydantic_ai_approvals.py, v0.7.1+), CrewAI (integrations/crewai.py, v0.7.2+), Google ADK (integrations/google_adk.py, integrations/google_adk_plugin.py, v0.9.0+), FastMCP (agent_airlock/mcp/).
Example-only (2): AutoGen, LlamaIndex — decorator-compatible without an adapter.
Decorator-ordering rules per framework: docs/COMPATIBILITY.md.
Mapped against the OWASP Agentic Top-10 (2026). Partial means airlock covers the runtime leg and something upstream is out of scope. Each row's evidence (guard module, preset, test, measured rate) is in docs/owasp-agentic-2026-coverage.md, which is generated from a YAML source and byte-diffed in CI.
Against the MCP Top-10. Each row's evidence (modules, presets, tests, where each control runs) is in docs/owasp-mcp-top-10-coverage.md, generated from YAML and byte-diffed in CI.
airlock scan-tools ./tools.json # static contract check on tool declarations airlock doctor # scan code for unprotected tools, unsafe patterns airlock explain --unused-scopes ... # diff granted privilege against used airlock attest receipt emit ... # signed evidence that a run was gated airlock policy compile "..." # English to typed policy (needs an LLM backend) airlock kill-switch trigger ... # HMAC-signed fleet freeze Per-command pages: docs/cli/.
This project holds itself to a rule worth stating plainly: a claim in this README is gated by a test, or it is not made.
Read AGENTS.md first — it is the load-bearing contributor contract — then CONTRIBUTING.md.
pip install -e ".[dev]" make test lint Every feat: needs a regression test. Every CVE fixture needs a primary-source URL in the commit message. Claims need gates.
Report vulnerabilities via SECURITY.md. Please do not open a public issue for an unpatched vulnerability.
Apache-2.0. Relicensed from MIT on 2026-09-06 to add an explicit patent grant. Citation metadata: CITATION.cff.
If this is useful, a ⭐ helps other people find it.
Report a bug · Request a feature · Discussions
Both files in this release have provenance metadata.
all attested bench claude-agent console crewai crypto dev docs google-adk logging mcp modal model-armor pydantic-ai redis sandbox
agent-safety agent-security ai-security e2b guardrails least-privilege llm llm-security mcp model-context-protocol pydantic sandbox tool-poisoning validation
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
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.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.
Both files in this release have been uploaded with provenance metadata.
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.




