agentfortress 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c3e112c42be216565ab9bb6e0bc91eb18d64a9f4e40a7869bff7a681c50db890
4
+ data.tar.gz: 9120e30bd4b78614975e394c2618e43f3a1c5f9e9443b360fcbccc8210e15057
5
+ SHA512:
6
+ metadata.gz: 5bd5de3a243eee21edde5356821c185c5068de14a3dc8b8c40015fbbe39ebbfc8f637fd4219d1d057b4f8e5c3f2e272efb790d077ec8a3ed1e18726a2470ebda
7
+ data.tar.gz: 0df1d6db71d5d23d2091670963825b1052e0a680d3fa0b32a96cfd487ecffc0c128640dc7a98f6e29e4f39d0d47a0557505c15507e62ecdbf2eabe3e0c454411
data/README.md ADDED
@@ -0,0 +1,165 @@
1
+ # AgentShield πŸ›‘οΈ
2
+
3
+ > The CrowdStrike for AI Agents β€” Real-time security monitoring, threat detection, and runtime protection for LLM-powered agents.
4
+
5
+ ![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)
6
+ ![Free & Open Source](https://img.shields.io/badge/Free-Open%20Source-brightgreen.svg)
7
+ [![PyPI - SDK](https://img.shields.io/pypi/v/agentshield-python?label=agentshield-python)](https://pypi.org/project/agentshield-python/)
8
+ [![PyPI - CLI](https://img.shields.io/pypi/v/agentshield-monitor?label=agentshield-monitor)](https://pypi.org/project/agentshield-monitor/)
9
+
10
+ > πŸ†“ **100% Free & Open Source** β€” All features available to everyone. No paid plans, no paywalls, no credit card required. Ever.
11
+
12
+ ```
13
+ ╔══════════════════════════════════════════════════════════════════════════════╗
14
+ β•‘ AGENTSHIELD ARCHITECTURE β•‘
15
+ ╠══════════════════════════════════════════════════════════════════════════════╣
16
+ β•‘ β•‘
17
+ β•‘ Your AI Agents AgentShield Platform β•‘
18
+ β•‘ ────────────── ─────────────────── β•‘
19
+ β•‘ β•‘
20
+ β•‘ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β•‘
21
+ β•‘ β”‚ LangChain │──┐ β”‚ FastAPI Server β”‚ β•‘
22
+ β•‘ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β•‘
23
+ β•‘ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ SDK β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β•‘
24
+ β•‘ β”‚ CrewAI │──┼──────────► β”‚ β”‚ Threat β”‚ β”‚ Alert Manager β”‚ β”‚ β•‘
25
+ β•‘ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ (events) β”‚ β”‚Detection β”‚ β”‚ β”‚ β”‚ β•‘
26
+ β•‘ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β•‘
27
+ β•‘ β”‚ AutoGen │─── β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β•‘
28
+ β•‘ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ Policy β”‚ β”‚ Anomaly Engine β”‚ β”‚ β•‘
29
+ β•‘ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚Enforcer β”‚ β”‚ β”‚ β”‚ β•‘
30
+ β•‘ β”‚ OpenAI SDK β”‚β”€β”€β”˜ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β•‘
31
+ β•‘ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β•‘
32
+ β•‘ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β•‘
33
+ β•‘ β”‚ β”‚ PostgreSQL / SQLite β”‚ β”‚ β•‘
34
+ β•‘ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β•‘
35
+ β•‘ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β•‘
36
+ β•‘ β”‚ WebSocket β•‘
37
+ β•‘ β–Ό β•‘
38
+ β•‘ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β•‘
39
+ β•‘ β”‚ React SOC Dashboard β”‚ β•‘
40
+ β•‘ β”‚ β€’ Real-time event feed β”‚ β•‘
41
+ β•‘ β”‚ β€’ Alert management β”‚ β•‘
42
+ β•‘ β”‚ β€’ Session replay β”‚ β•‘
43
+ β•‘ β”‚ β€’ Policy editor β”‚ β•‘
44
+ β•‘ β”‚ β€’ Analytics & trends β”‚ β•‘
45
+ β•‘ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β•‘
46
+ β•‘ β•‘
47
+ β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
48
+ ```
49
+
50
+ ## What is AgentShield?
51
+
52
+ AgentShield provides comprehensive security observability and runtime protection for AI agents. As autonomous AI systems gain access to sensitive tools and data, the attack surface grows dramatically. AgentShield acts as a security layer between your agents and the world.
53
+
54
+ ## Key Features
55
+
56
+ - **πŸ” Universal Agent Monitoring** β€” Instrument LangChain, CrewAI, AutoGen, OpenAI Agents SDK, or any custom agent with one line of code
57
+ - **🚨 Real-time Threat Detection** β€” Detect prompt injection, PII leakage, data exfiltration, and scope creep as they happen
58
+ - **πŸ“‹ Policy Enforcement** β€” Define security policies that BLOCK, ALERT, LOG, or RATE_LIMIT suspicious behavior
59
+ - **🎬 Session Replay** β€” Full timeline replay of every agent action for incident investigation
60
+ - **πŸ“Š SOC Dashboard** β€” Real-time security operations center with alerts, analytics, and session management
61
+ - **πŸ”‘ Kill Switch** β€” Instantly terminate any running agent session
62
+ - **🧠 Threat Intelligence** β€” Built-in library of 200+ known prompt injection, jailbreak, and exfiltration patterns
63
+ - **🏒 Multi-tenant** β€” Organization-based access control with API key management
64
+
65
+ ## Quick Start
66
+
67
+ ### 1. Install the SDK
68
+
69
+ ```bash
70
+ pip install agentshield-sdk
71
+ ```
72
+
73
+ ### 2. Protect your agent
74
+
75
+ ```python
76
+ import agentshield
77
+
78
+ # Zero-config protection
79
+ agentshield.init(api_key="your-api-key", server_url="http://localhost:8000")
80
+
81
+ # Wrap your agent
82
+ protected_agent = agentshield.protect(your_agent)
83
+
84
+ # Run it β€” AgentShield monitors everything
85
+ result = protected_agent.run("Your task here")
86
+ ```
87
+
88
+ ### 3. Start the platform
89
+
90
+ ```bash
91
+ # Using Docker Compose
92
+ cd infra && docker-compose up -d
93
+
94
+ # Dashboard available at http://localhost:3000
95
+ # API available at http://localhost:8000
96
+ # API docs at http://localhost:8000/docs
97
+ ```
98
+
99
+ ## Installation
100
+
101
+ ### SDK
102
+
103
+ ```bash
104
+ pip install agentshield-sdk
105
+ ```
106
+
107
+ ### Server (Development)
108
+
109
+ ```bash
110
+ cd server
111
+ pip install -r requirements.txt
112
+ uvicorn main:app --reload
113
+ ```
114
+
115
+ ### Dashboard
116
+
117
+ ```bash
118
+ cd dashboard
119
+ npm install
120
+ npm run dev
121
+ ```
122
+
123
+ ### CLI
124
+
125
+ ```bash
126
+ pip install agentshield-cli
127
+ agentshield init
128
+ ```
129
+
130
+ ## Architecture
131
+
132
+ | Component | Technology | Purpose |
133
+ |-----------|-----------|---------|
134
+ | SDK | Python | Agent instrumentation & local detection |
135
+ | Server | FastAPI + SQLAlchemy | Event ingestion, threat analysis, API |
136
+ | Dashboard | React + Vite + TailwindCSS | SOC UI, real-time monitoring |
137
+ | CLI | Click | Developer tooling |
138
+ | Threat Intel | JSON patterns + Python engine | Known attack pattern matching |
139
+ | Infra | Docker + Kubernetes | Deployment |
140
+
141
+ ## Detection Capabilities
142
+
143
+ | Threat | Detection Method | Default Action |
144
+ |--------|-----------------|----------------|
145
+ | Prompt Injection | Pattern matching + ML scoring | ALERT |
146
+ | PII Leakage | Regex + NER patterns | BLOCK |
147
+ | Data Exfiltration | Size analysis + base64 detection | BLOCK |
148
+ | Jailbreak Attempts | Pattern library matching | ALERT |
149
+ | Scope Creep | Resource access monitoring | ALERT |
150
+ | Anomalous Behavior | Statistical baseline deviation | ALERT |
151
+ | Rapid API Calls | Rate pattern analysis | RATE_LIMIT |
152
+
153
+ ## Documentation
154
+
155
+ - [Quick Start Guide](docs/quickstart.md)
156
+ - [SDK Reference](docs/sdk-reference.md)
157
+ - [Server API Reference](docs/server-api.md)
158
+ - [Policy Configuration](docs/policies.md)
159
+ - [Threat Model](docs/threat-model.md)
160
+ - [Deployment Guide](docs/deployment.md)
161
+ - [Architecture Deep Dive](docs/architecture.md)
162
+
163
+ ## License
164
+
165
+ MIT β€” see [LICENSE](LICENSE)
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+ module AgentFortress
3
+ class Scanner
4
+ INJECTION_PATTERNS = [
5
+ /ignore (previous|all|above) instructions/i,
6
+ /you are now/i,
7
+ /disregard your (system|previous)/i,
8
+ /forget (everything|all)/i,
9
+ /jailbreak/i,
10
+ ].freeze
11
+
12
+ def scan(text)
13
+ INJECTION_PATTERNS.each do |pattern|
14
+ if text.match?(pattern)
15
+ return { action: :block, reason: "Prompt injection pattern detected", threat: :prompt_injection }
16
+ end
17
+ end
18
+ { action: :allow }
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+ module AgentFortress
3
+ class Shield
4
+ attr_reader :session_id
5
+
6
+ def initialize(api_key: nil, server_url: nil, mode: :local)
7
+ @api_key = api_key
8
+ @server_url = server_url
9
+ @mode = mode
10
+ @session_id = "session-#{Time.now.to_i}-#{rand(36**8).to_s(36)}"
11
+ @handlers = []
12
+ end
13
+
14
+ def protect(agent_id: nil, &block)
15
+ -> (*args) {
16
+ result = block.call(*args)
17
+ result
18
+ }
19
+ end
20
+
21
+ def on_threat(&block)
22
+ @handlers << block
23
+ self
24
+ end
25
+
26
+ def scan(text)
27
+ Scanner.new.scan(text)
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+ module AgentFortress
3
+ VERSION = "1.0.0"
4
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "agentfortress/version"
4
+ require_relative "agentfortress/scanner"
5
+ require_relative "agentfortress/shield"
6
+
7
+ # AgentFortress β€” Runtime protection for AI agents
8
+ # The CrowdStrike for AI Agents
9
+ module AgentFortress
10
+ class Error < StandardError; end
11
+
12
+ INJECTION_PATTERNS = [
13
+ /ignore (previous|all|above) instructions/i,
14
+ /you are now/i,
15
+ /disregard your (system|previous)/i,
16
+ /forget (everything|all)/i,
17
+ /jailbreak/i,
18
+ ].freeze
19
+
20
+ # Quick scan for prompt injection
21
+ def self.scan(text)
22
+ Scanner.new.scan(text)
23
+ end
24
+
25
+ # Initialize with config
26
+ def self.init(api_key: nil, server_url: nil, mode: :local)
27
+ Shield.new(api_key: api_key, server_url: server_url, mode: mode)
28
+ end
29
+ end
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: agentfortress
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Aayush
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-04-13 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: The CrowdStrike for AI Agents β€” Real-time security monitoring, threat
14
+ detection, and runtime protection for LLM-powered agents.
15
+ email:
16
+ - aayush022008@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - README.md
22
+ - lib/agentfortress.rb
23
+ - lib/agentfortress/scanner.rb
24
+ - lib/agentfortress/shield.rb
25
+ - lib/agentfortress/version.rb
26
+ homepage: https://github.com/aayush022008/agentfortress
27
+ licenses:
28
+ - MIT
29
+ metadata: {}
30
+ post_install_message:
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: 2.7.0
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements: []
45
+ rubygems_version: 3.0.3.1
46
+ signing_key:
47
+ specification_version: 4
48
+ summary: Runtime protection and security monitoring for AI agents
49
+ test_files: []