Skip to main content

Runtime enforcement layer for autonomous AI agents — intercepts tool calls, classifies risk, enforces policies, and controls execution.

Project description

Interceptor

Runtime enforcement layer for autonomous AI agents.

Interceptor intercepts tool calls before execution and applies policy enforcement, risk classification, role-based approval, and execution control — so your AI agents never run unchecked.

Installation

pip install interceptor

Or install from source:

git clone https://github.com/interceptor/interceptor.git
cd interceptor
pip install -e ".[dev]"

Quick Start

from interceptor import Interceptor

guard = Interceptor(mode="strict")

decision = guard.run(
    tool_name="delete_file",
    args={"path": "/tmp/data.csv"},
    user_role="user",
)

print(decision.allowed)       # False
print(decision.risk_level)    # HIGH
print(decision.decision)      # blocked

Console output:

┌──────────── INTERCEPTOR ────────────┐
│ Risk:     HIGH                      │
│ Mode:     strict                    │
│ Decision: blocked                   │
│ Intent:   Agent intends to call     │
│           delete_file with          │
│           path=/tmp/data.csv        │
│ Reason:   HIGH risk action requires │
│           admin approval.           │
└─────────────────────────────────────┘

Strict Mode

guard = Interceptor(mode="strict")

# HIGH  → blocked (unless admin)
# MEDIUM → confirmation required
# LOW   → allowed

Balanced Mode

guard = Interceptor(mode="balanced")

# HIGH   → confirmation required
# MEDIUM → allowed with warning
# LOW    → allowed

Observe Mode

guard = Interceptor(mode="observe")

# Never blocks — logs risk and intent only

YAML Policy

Create a policy.yaml:

tools:
  delete_file:
    risk: HIGH
  write_file:
    risk: MEDIUM

keywords:
  - drop
  - overwrite

Load it:

guard = Interceptor(mode="strict", policy_path="policy.yaml")

Role-Based Approval

# Blocked for regular users
decision = guard.run("delete_file", {"path": "/data"}, user_role="user")
assert not decision.allowed

# Allowed for admins
decision = guard.run("delete_file", {"path": "/data"}, user_role="admin")
assert decision.allowed

Override Tokens

token = guard.generate_override_token()

decision = guard.run(
    "delete_file",
    {"path": "/data"},
    user_role="user",
    override_token=token,
)
assert decision.allowed  # one-time bypass

Decorator

from interceptor import Interceptor, intercept

guard = Interceptor(mode="strict")

@intercept(guard, user_role="admin")
def delete_file(path: str) -> str:
    return f"Deleted {path}"

result = delete_file(path="/tmp/data.csv")

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

intercept_ai-0.2.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

intercept_ai-0.2.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file intercept_ai-0.2.0.tar.gz.

File metadata

  • Download URL: intercept_ai-0.2.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for intercept_ai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ae247107ee88ab8e0143710df68ec8dce63c3bf93ae53e31dcd6c9bb6d291e2c
MD5 658f8ae0a14f9ac1fcd4ca491b2e4797
BLAKE2b-256 2f6537a97d630bfd5093e5d4fd522cc12e2bfe36f5a89cee2b2813d3a589a7da

See more details on using hashes here.

File details

Details for the file intercept_ai-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: intercept_ai-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for intercept_ai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f0fd18b47eadcbb165b031f110e61b7fc65ea31122c18f1532f0f46b73c0f667
MD5 f562d196b4ae685b78d7bba83a07a3f2
BLAKE2b-256 c245e8c6494abe3a25a5674cd0e08a2ffd25c211ef010a98db006fd95bf2ce3b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page