Skip to main content

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

Release files for agentshield-fw 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentshield-fw 0.1.0
File Size Uploaded
agentshield_fw-0.1.0.tar.gz 86.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentshield-fw 0.1.0
File Interpreter ABI Platform
agentshield_fw-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 163.4 kB

Release files / agentshield_fw-0.1.0.tar.gz

Download URL agentshield_fw-0.1.0.tar.gz
Size 86.4 kB
Tags Source
SHA-256 checksum
How to use checksums
368666be218e7ce9e18028c77e69f1db3005a9e28e7c6629abc920ef5db2332b
BLAKE2b-256 checksum
How to use checksums
d07b65887eb87a0fd39f5471d730e1ddf2eccd420b21c3108c1c52cc82443481
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.

Transparency log

Release files / agentshield_fw-0.1.0-py3-none-any.whl

Download URL agentshield_fw-0.1.0-py3-none-any.whl
Size 77.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
86850aec2d5708046c885c85e5b50d617251e810bfc637567f5bcec467dcc5a6
BLAKE2b-256 checksum
How to use checksums
e053eabc1c2e2c937295c5202ec210299fe0e222be0e02bbdb374c9d1e39ace1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page