Skip to main content

The runtime firewall for AI agents. Protect any agent in 3 lines of code.

Project description

AgentShield

The runtime firewall for AI agents. Protect any agent in 3 lines of code.

PyPI Python CI Coverage License: MIT


Quickstart

pip install agentshield-fw
import agentshield

shield = agentshield.Shield()

@shield.protect
def execute_sql(query: str) -> str:
    return db.execute(query)

# Agent calls execute_sql("DROP TABLE users")
# -> Blocked by AgentShield: Destructive SQL detected (ASI02)

That's it. Your agent is now protected with 39 built-in safety rules.


Why AgentShield?

AI agents are production infrastructure. They execute code, manage databases, and call APIs autonomously. But:

  • 88% of organizations have had agent security incidents (Gravitee 2026 Report)
  • 68% cannot distinguish human from AI agent activity (CSA Survey)
  • EU AI Act high-risk obligations take effect August 2026
  • Every major framework is permissive by default — if a tool is registered, the agent can call it

AgentShield fixes this in 3 lines of code. Zero dependencies in the core. Sub-millisecond latency. Full OWASP coverage.


Features

Feature AgentShield MS Agent Gov Toolkit NemoClaw AgentLock
pip install + 3 lines :white_check_mark: :x: (7 packages) :x: (alpha) :x: (auth only)
Framework agnostic :white_check_mark: :x: (Azure-focused) :x: (NVIDIA) :warning:
39 pre-built rules :white_check_mark: :white_check_mark: :x: :x:
OWASP ASI01-10 mapped :white_check_mark: :white_check_mark: :x: :x:
Human-in-the-loop :white_check_mark: :white_check_mark: :x: :x:
Real-time dashboard :white_check_mark: :warning: :x: :x:
Zero dependencies (core) :white_check_mark: :x: :x: :x:
Sub-millisecond latency :white_check_mark: (0.3ms p50) :white_check_mark: (0.1ms p99) ? ?

Supported Frameworks

Framework Integration Example
Any Python function @shield.protect quickstart.py
MCP Servers shield_mcp_server(server) mcp_example.py
LangChain ShieldedToolkit(tools) langchain_example.py
CrewAI shield_crew(crew) crewai_example.py
OpenAI Agents SDK shield_agent(agent) openai_example.py

OWASP Top 10 for Agentic Applications

AgentShield maps every rule to the OWASP Top 10 for Agentic Applications.

OWASP ID Risk AgentShield Coverage
ASI01 Goal Hijacking prompt_injection, encoded_injection, role_override, delimiter_injection
ASI02 Tool Misuse destructive_sql, path_traversal, destructive_shell, reverse_shell, dangerous_eval
ASI03 Identity Abuse tool_allowlist, cross_agent_scope, argument_schema
ASI04 Data Leakage api_key_leak, token_leak, pii_leak, domain_denylist, internal_network_access
ASI05 Memory Poisoning require_approval_pattern, input sanitization
ASI06 Rogue Agent tool_allowlist, rate_limiter, cost_guard
ASI07 Cascading Failures per_tool_rate_limit, session_rate_limit, burst_detection, session_cost_ceiling
ASI08 Insufficient Logging Hash-chained JSONL audit logger with SHA-256 tamper detection (agentshield verify)
ASI09 Human Override Failure HITL gateway with Slack, Discord, and terminal channels
ASI10 Multi-Agent Exploitation cross_agent_scope, agent_id_validation

Configuration

Create an agentshield.yaml in your project root:

mode: enforce        # enforce | monitor | dry-run

log_file: shield.jsonl

rules:
  destructive_sql:
    enabled: true
    action: deny
  credential_leak:
    enabled: true
    action: deny
  rate_limiter:
    enabled: true
    max_calls: 100
    window_seconds: 60
  cost_guard:
    enabled: true
    max_cost_usd: 10.0
  scope:
    enabled: true
    allowed_tools:
      - execute_sql
      - read_file
      - search_web

hitl:
  timeout: 300
  timeout_action: deny
  channels:
    - type: slack
      webhook_url: ${SLACK_WEBHOOK_URL}

custom_rules:
  - name: block_twitter_posts
    tool_patterns: ["post_tweet", "send_tweet"]
    action: deny
    reason: "Twitter posting requires manual review"

Performance

Metric Value
Policy evaluation (p50) 0.3ms
Policy evaluation (p99) <1.0ms
Memory footprint ~15MB
Core dependencies 0

Installation

# Core (zero dependencies)
pip install agentshield-fw

# With specific integrations
pip install "agentshield-fw[config]"       # YAML config support (PyYAML)
pip install "agentshield-fw[mcp]"          # MCP server support
pip install "agentshield-fw[langchain]"    # LangChain adapter
pip install "agentshield-fw[crewai]"       # CrewAI adapter
pip install "agentshield-fw[openai]"       # OpenAI Agents SDK
pip install "agentshield-fw[dashboard]"    # Real-time dashboard
pip install "agentshield-fw[hitl]"         # Human-in-the-loop gateway
pip install "agentshield-fw[otel]"         # OpenTelemetry export

# Everything
pip install "agentshield-fw[all]"

# Development
pip install -e ".[dev]"

Documentation

Full documentation is available at avinash-amudala.github.io/AgentShield.


Contributing

We welcome contributions! See CONTRIBUTING.md for details.

git clone https://github.com/Avinash-Amudala/AgentShield.git
cd AgentShield
pip install -e ".[dev]"
pytest

License

MIT — Copyright (c) 2026 Avinash Amudala

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

agentshield_fw-0.1.0.tar.gz (86.4 kB view details)

Uploaded Source

Built Distribution

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

agentshield_fw-0.1.0-py3-none-any.whl (77.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentshield_fw-0.1.0.tar.gz
  • Upload date:
  • Size: 86.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agentshield_fw-0.1.0.tar.gz
Algorithm Hash digest
SHA256 368666be218e7ce9e18028c77e69f1db3005a9e28e7c6629abc920ef5db2332b
MD5 25a305553be24b250c663cf0d65a2c15
BLAKE2b-256 d07b65887eb87a0fd39f5471d730e1ddf2eccd420b21c3108c1c52cc82443481

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentshield_fw-0.1.0.tar.gz:

Publisher: ci.yml on Avinash-Amudala/AgentShield

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: agentshield_fw-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 77.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agentshield_fw-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 86850aec2d5708046c885c85e5b50d617251e810bfc637567f5bcec467dcc5a6
MD5 b97195cf337aed72ab195c253e8c96c2
BLAKE2b-256 e053eabc1c2e2c937295c5202ec210299fe0e222be0e02bbdb374c9d1e39ace1

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentshield_fw-0.1.0-py3-none-any.whl:

Publisher: ci.yml on Avinash-Amudala/AgentShield

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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