Skip to main content

Comprehensive security framework for agentic AI applications โ€” 8-layer defense-in-depth.

Project description

๐Ÿ›ก๏ธ AgentArmor

Comprehensive open-source security framework for agentic AI applications.

AgentArmor provides 8-layer defense-in-depth security for AI agents, covering every point in the data flow where data is at rest, in transit, or in use. Built to address the OWASP Top 10 for Agentic Applications (2026).


Why AgentArmor?

Every existing security tool is a point solution โ€” output validators, prompt injection scanners, or policy engines in isolation. AgentArmor is the first unified framework that secures the entire agentic architecture end-to-end.

The 8 Security Layers

Layer Name What It Protects
L1 Ingestion Input scanning, prompt injection detection, source verification
L2 Storage Encryption at rest (AES-256-GCM), data classification, integrity (BLAKE3)
L3 Context Instruction-data separation, canary tokens, prompt hardening
L4 Planning Action plan validation, risk scoring, chain depth limits
L5 Execution Rate limiting, network egress control, human approval gates
L6 Output PII redaction (Presidio), DLP, sensitivity filtering
L7 Inter-Agent Mutual auth (HMAC), trust scoring, delegation depth control
L8 Identity Agent identity, JIT permissions, credential rotation

Quick Start

Install

# Using uv (recommended)
uv add agentarmor

# With all optional features
uv add "agentarmor[all]"

# For development
git clone https://github.com/agastyatodi/agentarmor.git
cd agentarmor
uv sync --all-extras --dev

Basic Usage

import asyncio
from agentarmor import AgentArmor, ArmorConfig

async def main():
    armor = AgentArmor()

    # Register your agent
    identity, token = armor.l8_identity.register_agent(
        agent_id="my-agent",
        permissions={"read.*", "search.*"},
    )

    # Intercept tool calls
    result = await armor.intercept(
        action="read.file",
        params={"path": "/data/notes.txt"},
        agent_id="my-agent",
        input_data="Read the user notes file",
    )

    print(f"Safe: {result.is_safe}")
    print(f"Verdict: {result.final_verdict.value}")

asyncio.run(main())

Use as Decorator

@armor.shield(action="database.query")
async def query_database(sql: str) -> dict:
    return db.execute(sql)

Proxy Server Mode

agentarmor serve --config agentarmor.yaml --port 8400
curl -X POST http://localhost:8400/v1/intercept \
  -H "Content-Type: application/json" \
  -d '{"action": "read.file", "agent_id": "my-agent", "input_data": "Hello"}'

Framework Integrations

# LangChain
from agentarmor.integrations.langchain import AgentArmorCallback
callback = AgentArmorCallback(armor=armor)
agent.invoke({"input": "..."}, config={"callbacks": [callback]})

# OpenAI
from agentarmor.integrations.openai import secure_openai_client
client = secure_openai_client(OpenAI(), armor=armor)

# MCP
from agentarmor.integrations.mcp import MCPGuard
guard = MCPGuard(armor=armor)
result = await guard.call_tool("my-server", "read_file", {"path": "/data"})

Red Team Testing

from agentarmor.redteam import RedTeamSuite

suite = RedTeamSuite(armor=armor)
results = await suite.run_all()
suite.print_report(results)

CLI Commands

Command Description
agentarmor init Generate a config file
agentarmor validate <config> Validate configuration
agentarmor scan -t "text" Scan text for threats
agentarmor serve Start proxy server
agentarmor keygen Generate encryption key

Custom Security Policies

# policies/my_agent.yaml
version: "1.0"
name: "database_agent"
agent_type: "database"
risk_level: "high"

global_denied_actions:
  - "database.drop"
  - "database.truncate"

require_human_approval_for:
  - "database.delete"

rules:
  - name: "limit_transfer_amount"
    action_pattern: "transfer.*"
    conditions:
      - field: "params.amount"
        operator: ">"
        value: "1000"
    verdict: "escalate"
    priority: 100

Architecture

Agent Runtime (LangChain / CrewAI / OpenAI SDK / MCP)
         โ”‚
         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚      AgentArmor Pipeline     โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚  L8: Identity & IAM   โ”‚  โ”‚
โ”‚  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค  โ”‚
โ”‚  โ”‚  L1: Data Ingestion   โ”‚  โ”‚
โ”‚  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค  โ”‚
โ”‚  โ”‚  L2: Memory/Storage   โ”‚  โ”‚
โ”‚  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค  โ”‚
โ”‚  โ”‚  L3: Context Assembly โ”‚  โ”‚
โ”‚  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค  โ”‚
โ”‚  โ”‚  L4: Plan Validation  โ”‚  โ”‚
โ”‚  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค  โ”‚
โ”‚  โ”‚  L5: Action Execution โ”‚  โ”‚
โ”‚  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค  โ”‚
โ”‚  โ”‚  L7: Inter-Agent Sec  โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚  L6: Output Filter (post)   โ”‚
โ”‚  Audit Logger (cross-cut)   โ”‚
โ”‚  Policy Engine (cross-cut)  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚
         โ–ผ
    External Tools / APIs / LLMs

OWASP ASI Coverage

OWASP ASI Risk AgentArmor Layer(s)
ASI01: Goal Hijacking L1 (injection), L3 (prompt hardening)
ASI02: Tool Misuse L4 (planning), L5 (execution), Policy Engine
ASI03: Identity Abuse L8 (identity), L5 (JIT perms)
ASI04: Supply Chain L1 (source verify), MCP Guard
ASI05: Code Execution L5 (sandbox), L4 (risk scoring)
ASI06: Memory Poisoning L2 (integrity), L3 (canary tokens)
ASI07: Inter-Agent L7 (mutual auth, trust scoring)
ASI08: Cascading Failures L4 (chain depth), L5 (rate limits)
ASI09: Human Trust L6 (output filter), Audit Logger
ASI10: Rogue Agents L8 (credential rotation), L7 (trust decay)

License

Apache 2.0. Free for commercial and open-source use.

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

agentarmor_core-0.1.0.tar.gz (226.4 kB view details)

Uploaded Source

Built Distribution

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

agentarmor_core-0.1.0-py3-none-any.whl (45.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentarmor_core-0.1.0.tar.gz
  • Upload date:
  • Size: 226.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for agentarmor_core-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0a807f09a6a38d0135b3a040bab7475bccb4151cb24ef7e76103b40cc72f36d6
MD5 64e44e951509cde65a5fe5681e32e764
BLAKE2b-256 d65721d309ff633aa76a0eb419acff111f0e3dba492892cda34f501fb372dc1f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agentarmor_core-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 45.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for agentarmor_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aea4fad99a870ca5116fc9acd3caa1c5b9204eaa7e723dec355288823cad8f4e
MD5 4cfc457bf41cbe8fdb4d0691073946e9
BLAKE2b-256 24d2e43a6b23450ed37584476b4dae324ed893ab15a164cc17b20a08f98b0b38

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