vivekrajsingh04/aegis-ai
GitHub: vivekrajsingh04/aegis-ai
AEGIS 是一个 AI Agent 操作层安全网关,在工具执行前根据用户声明的意图验证每个操作,阻止提示注入和数据外泄等风险。
Stars: 0 | Forks: 0
[](https://www.python.org/)
[](https://fastapi.tiangolo.com/)
[](https://react.dev)
[](https://ai.google.dev)
[](https://github.com/veeainc/lobstertrap)
[](LICENSE)
**AEGIS 在最关键的时刻保护 AI agents:在操作执行之前。**
由 **Vivek Raj Singh** 构建
仓库:[vivekrajsingh04/aegis-ai](https://github.com/vivekrajsingh04/aegis-ai)
## 概述
AEGIS 是一个针对 AI agents 的 action 层安全网关。它不仅仅检查 prompt,还会在允许操作运行之前,验证每个 tool call 是否符合用户声明的意图。
这使得它非常适合连接到敏感系统(如电子邮件、医疗记录、财务工作流、内部数据库以及合规性要求极高的自动化系统)的 agents。
## 为什么开发它
大多数 AI 安全工具都侧重于模型的输入和输出:
```
User -> Prompt Filter -> LLM -> Tool Call -> External System
```
AEGIS 在 tool call 本身周围添加了一个控制点:
```
User Intent -> Intent Manifest -> Proposed Action -> AEGIS Decision -> Execute or Block
```
如果隐藏的指令指示 agent 转发私人记录、转移资金、删除数据或调用未经授权的 endpoint,AEGIS 会将该操作与会话的 intent manifest 进行比对,并阻止或隔离任何超出范围的行为。
## 核心功能
| 功能 | 作用 |
| --- | --- |
| 意图提取 | 将用户的请求转化为结构化的授权边界 |
| 操作评估 | 在执行前检查提议的 tool call |
| 策略执行 | 使用 Lobster Trap 结合项目策略来检测不安全的行为 |
| 人工审查 | 将高风险操作路由到审查队列,而不是盲目执行 |
| 解释引擎 | 为被阻止或隔离的操作生成清晰的原因 |
| 合规导出 | 为安全与治理工作流生成便于审计的报告 |
## 快速开始
```
git clone https://github.com/vivekrajsingh04/aegis-ai.git
cd aegis-ai
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
# 在 https://aistudio.google.com/ 添加你的 GEMINI_API_KEY
uvicorn src.main:app --reload --port 8000
```
在第二个终端中运行控制台:
```
cd argus-dashboard
pnpm install
pnpm dev
```
控制台默认连接到本地后端 `http://localhost:8000`。
## 架构
```
flowchart TB
A[User Request] --> B[Intent Engine]
B --> C[Intent Manifest]
C --> D[Policy Enforcement]
D --> E{Decision}
E -->|Allow| F[Action Executes]
E -->|Quarantine| G[Human Review Queue]
E -->|Deny| H[Blocked Action]
G --> I[Compliance Log]
H --> I
F --> I
style B fill:#2563eb,color:#fff
style D fill:#f97316,color:#fff
style G fill:#eab308,color:#000
style I fill:#0f766e,color:#fff
```
## API 示例
提取 intent manifest:
```
curl -X POST http://localhost:8000/api/intent/extract \
-H "Content-Type: application/json" \
-d '{"user_input": "Handle my customer complaint emails"}'
```
评估提议的操作:
```
curl -X POST http://localhost:8000/api/action/evaluate \
-H "Content-Type: application/json" \
-d '{"session_id": "sess_123", "action_type": "forward_email", "target": "backup@external.com"}'
```
示例结果:
```
{
"decision": "quarantine",
"risk_score": 0.94,
"reason": "Intent mismatch: forward_email not in allowed list",
"review_item_id": "rev_abc123"
}
```
## 项目结构
```
aegis-ai/
├── src/ # FastAPI backend and security pipeline
│ ├── intent_engine/ # Intent extraction
│ ├── lobster_proxy/ # Policy enforcement
│ ├── explanation_engine/ # Explanation generation
│ ├── human_gate/ # Review queue
│ └── main.py # API entry point
├── argus-dashboard/ # React dashboard
├── configs/ # Policy configuration
├── docs/ # Supporting documentation
├── infrastructure/ # Deployment helpers
├── lobstertrap/ # Lobster Trap integration
├── scripts/ # Utility scripts
└── tests/ # Unit tests
```
为了兼容性,部分内部目录名称特意保持不变。
## 部署
为了暂时保持兼容,特意省略了与部署相关的域名和托管 URL。请在选择托管方案时添加您的生产环境前端和后端 URL。
## 许可证
MIT License。详见 [LICENSE](LICENSE)。
标签:AI代理, AV绕过, FastAPI, Python, 安全网关, 提示词注入防御, 无后门, 知识图谱