MCP security wrapper with policy tiers, approvals, backup, and audit.
Project description
ai-runtime-guard
Your agent can say anything. It can only do what policy allows.
AI agents with filesystem and shell access can delete files, leak credentials, or execute destructive commands, often without the user realizing it until it is too late.
ai-runtime-guard is an MCP server that sits between your AI agent and your system, enforcing a policy layer before any file or shell action takes effect. No retraining, no prompt engineering, no changes to your agent workflow.
What It Does
- Blocks dangerous operations:
rm -rf, sensitive file access, privilege escalation, and other risky actions are denied before execution. - Gates risky commands behind human approval: configurable commands require explicit operator sign-off via the local GUI/API before execution.
- Controls network behavior: supports command-level network policy with monitor/enforce behavior, allowlists, and denylists.
- Enforces workspace boundaries: file and command operations are evaluated against
AIRG_WORKSPACEand path policy. - Backs up before it acts: destructive and overwrite operations create recoverable backups automatically.
- Provides robust logging and reporting: all allowed/blocked actions are written to
activity.logand indexed intoreports.db. - Supports per-agent policy overlays: applies policy overrides keyed by
AIRG_AGENT_ID. - Script Sentinel: flags dangerous command patterns at write time in executable context (for example scripts) to preserve policy intent and reduce bypass attempts.
- Universal AI agent Policy Orchestrator: comprehensive GUI-driven security posture enforcement for AI agents (hooks, sandboxing, native tool restrictions, and policy mirroring depending on agent support).
Current State
- Policy management is available in the local GUI (commands, paths, extensions, network, script sentinel, advanced policy).
- Agent management is available in the GUI (
Settings -> Agents), including profile-based MCP configuration and posture checks. - Full runtime visibility is available through
activity.logand reports views backed byreports.db. - Stable release notes are tracked in
CHANGELOG.md, with in-progress work indocs/CHANGELOG_DEV.md.
Who It Is For
Developers and power users running AI agents (Claude Code, Claude Desktop, Cursor, Codex, and other MCP-compatible clients) who want guardrails on what an agent can do to their system.
Known Boundary
- AIRG enforces policy only for actions that pass through AIRG MCP tools.
- Native client tools outside MCP (for example Claude Code
Glob,Read,Write,Edit,Bash) are outside AIRG enforcement and can bypass policy. - Clients differ in what hardening controls they support (hooks, native tool restrictions, sandbox settings).
- Enforcement options and posture controls are available in AIRG GUI under
Settings -> Agents. - For strict enforcement, configure the client to route operations through AIRG MCP tools and disable risky native tools where supported.
Design Scope
- AIRG is designed to reduce accidental damage from AI agent mistakes and policy-evasion patterns.
- AIRG is not positioned as a full malicious-actor containment platform.
- Core controls:
- block high-risk destructive and exfiltration actions
- enforce workspace and path boundaries
- require explicit approval for selected risky actions
- auto-backup destructive and overwrite targets
- preserve policy intent through Script Sentinel for indirect execution attempts
- maintain an auditable trail of agent and operator actions
Requirements
Python:
- Required: Python
>=3.10(project package metadata enforces this). - Recommended on macOS: Python
3.12+(Homebrew or python.org install). - macOS system Python
3.9is often too old and may fail dependency install.
Official Support
Platforms:
- macOS
- Linux
Supported agent integrations on both platforms:
- Claude Code
- Claude Desktop
- Codex
- Cursor
Notes:
- Enforcement depth is agent-dependent (for example hooks/sandbox controls differ by client).
- AIRG MCP policy enforcement remains the primary universal layer across supported clients.
- Cursor MCP config is supported in both
project(<workspace>/.cursor/mcp.json) andglobal(~/.cursor/mcp.json) scope.
How To Run
Environment isolation recommendation:
- Use one of:
- Python virtual environment (
venv) pipxisolated app install
- Python virtual environment (
- Avoid system-wide
pip installwithout isolation to reduce dependency conflicts.
Recommended quick start (pipx, isolated global CLI):
pipx install ai-runtime-guard- If prompted:
pipx ensurepathand then open a new terminal session airg-setup(guided, recommended: select/create workspace during setup)airg-doctor
Alternative quick start (venv):
python3 -m venv .venv-airg && source .venv-airg/bin/activatepython -m pip install --upgrade pippython -m pip install ai-runtime-guardairg-setup(guided, recommended: select/create workspace during setup)airg-doctor- Open GUI
Settings -> Agents, add agents manually, and apply MCP config/hardening from there.
Source-clone path:
git clone --branch main https://github.com/runtimeguard/runtime-guard.gitcd runtime-guardpython3 -m venv .venv-airg && source .venv-airg/bin/activatepython -m pip install --upgrade pippython -m pip install .airg-setupairg-doctor
Unattended automation-only setup (CI/non-interactive):
airg-setup --defaults --yes --workspace /absolute/path/to/workspace
For source-clone setup, TestPyPI flow, and service details, see docs/INSTALL.md.
Web GUI
AIRG includes a local web control plane for:
- policy editing and per-agent overrides
- approval management
- agent profile/config management (
Settings -> Agents) - reports dashboard and event log
Open:
http://127.0.0.1:5001(service started byairg-setup)
Manual lifecycle commands:
airg-service install --workspace /absolute/path/to/airg-workspace
airg-service start
airg-service status
airg-service stop
airg-service restart
airg-service uninstall
AIRG_WORKSPACE (Important)
AIRG_WORKSPACE is the default project root for guarded agent operations.
How it works:
execute_commandruns fromAIRG_WORKSPACE.- File tools (
read_file,write_file,edit_file,delete_file,list_directory) enforce path/workspace policy relative to that root. - Traversal attempts outside this root are blocked by policy checks.
Workspace model:
- You can use an existing folder as workspace.
- Multiple workspaces are supported.
- You can run multiple agents against one workspace or one agent per workspace.
- Each agent profile should set workspace explicitly in generated MCP config.
AIRG_AGENT_ID (Important)
AIRG_AGENT_ID is the runtime identity key used for:
- activity and report attribution (
activity.log,reports.db) - per-agent policy override resolution (
policy.agent_overrides) - posture and hardening state in
Settings -> Agents
Multi-Agent Setup (STDIO Limitation)
AIRG currently runs as a local STDIO MCP server. Under current MCP client behavior, identity is usually tied to profile config, not per-instance runtime auth.
Practical implication:
- The effective identity is typically the configured combination of
AIRG_AGENT_ID+AIRG_WORKSPACE. - Multiple instances of the same client type in the same workspace commonly share the same MCP registration and therefore the same
AIRG_AGENT_ID. - This is a known limitation for local STDIO deployments.
- Per-instance identity and stronger separation require an authenticated HTTP/SSE model (future architecture direction).
Deployment Model FAQ
- Do I need to run
source scripts/setup_runtime_env.sh?- With packaged flow (
airg-setup), no. Setup initializes secure runtime paths and service env. - For direct source/manual runs, it is still useful.
- With packaged flow (
- What folders are involved?
- Install folder: where package/repo code lives.
- Runtime state folder:
policy.json, approvals DB/HMAC key, logs, reports DB, backups. - Workspace folder (
AIRG_WORKSPACE): where guarded agent operations run.
- Does setup auto-create an agent profile?
- No. Agents are added manually in GUI
Settings -> Agents.
- No. Agents are added manually in GUI
- Does AIRG hot-reload policy?
- Yes, policy changes are picked up on subsequent tool calls.
- Is restart still needed sometimes?
- MCP clients can cache process/env state. Restart the client or AIRG service after major config changes if behavior looks stale.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_runtime_guard-2.1.1.tar.gz.
File metadata
- Download URL: ai_runtime_guard-2.1.1.tar.gz
- Upload date:
- Size: 217.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c466fc054d41554e678c2847981886c93dd284cbf61727f33215a28dcb27ede3
|
|
| MD5 |
f1e08217cb32a6fabb592dd558bc076a
|
|
| BLAKE2b-256 |
9bb11563fcff03ae86c0c574f4d64651eaf8062622661e8aaf87cc4d89aa167c
|
Provenance
The following attestation bundles were made for ai_runtime_guard-2.1.1.tar.gz:
Publisher:
publish-pypi.yml on runtimeguard/runtime-guard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_runtime_guard-2.1.1.tar.gz -
Subject digest:
c466fc054d41554e678c2847981886c93dd284cbf61727f33215a28dcb27ede3 - Sigstore transparency entry: 1310787782
- Sigstore integration time:
-
Permalink:
runtimeguard/runtime-guard@53f3e28873f4d799f50d5697f9c08755af8ecc36 -
Branch / Tag:
refs/tags/v2.1.1 - Owner: https://github.com/runtimeguard
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@53f3e28873f4d799f50d5697f9c08755af8ecc36 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ai_runtime_guard-2.1.1-py3-none-any.whl.
File metadata
- Download URL: ai_runtime_guard-2.1.1-py3-none-any.whl
- Upload date:
- Size: 209.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84bcd7baedd67a678a466d5fd4bd9c7d7150646b32fcb1fc8afe35d5367ea748
|
|
| MD5 |
89abb2fec6b4f8b0cd3f4e75e298fcd3
|
|
| BLAKE2b-256 |
3d35198a2247fe6e6288dec9af778f30a4cc1dd6383bb108bc2fc3822c540a2f
|
Provenance
The following attestation bundles were made for ai_runtime_guard-2.1.1-py3-none-any.whl:
Publisher:
publish-pypi.yml on runtimeguard/runtime-guard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_runtime_guard-2.1.1-py3-none-any.whl -
Subject digest:
84bcd7baedd67a678a466d5fd4bd9c7d7150646b32fcb1fc8afe35d5367ea748 - Sigstore transparency entry: 1310787921
- Sigstore integration time:
-
Permalink:
runtimeguard/runtime-guard@53f3e28873f4d799f50d5697f9c08755af8ecc36 -
Branch / Tag:
refs/tags/v2.1.1 - Owner: https://github.com/runtimeguard
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@53f3e28873f4d799f50d5697f9c08755af8ecc36 -
Trigger Event:
push
-
Statement type: