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.1.0.tar.gz (11.8 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.1.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: intercept_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 11.8 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.1.0.tar.gz
Algorithm Hash digest
SHA256 8afb4d32d09581c431e43c1b0a509dda69425657df47441023ae5258ce8a530e
MD5 21130ae8ffc60311d715523573b11008
BLAKE2b-256 50cd59d206e38f1a8b758e125720682b251c10e05e6610b9ba842759623980c9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: intercept_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.5 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a679af66205a2d30b4939e9c9a30e0ab23605691021deac095615f215bdd0c7e
MD5 8ce0dbc9688d8f411568bc6e97e7feac
BLAKE2b-256 b20f920ee13832e5485c858f0e0cfe9ae69c074828077ea761e4820438144d52

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