Skip to main content
Glama
CJH91577
by CJH91577

🛡️ Aegis — Enterprise-Grade AI Agent Platform

Multi-format document RAG · Multi-agent collaboration · MCP tool invocation · Fact-checking with self-correction · HITL human approval

Aegis (/ˈiːdʒɪs/, Shield) is an out-of-the-box enterprise-grade AI agent application, designed around two main pillars: "Trustworthy Answers" and "Safe Execution":

  • Answer side: Multi-agent (Planner → Retriever → Auditor → Answerer) division of labor, every answer goes through Auditor fact-checking; when evidence is insufficient, it states so honestly and never fabricates;

  • Execution side: Tool invocation is based on the standardized MCP (Model Context Protocol), combined with least-privilege whitelist + human approval for sensitive operations (HITL) to achieve secure isolation.

                    ┌──────────────────────────────────────────────┐
                    │                用户 / FastAPI / CLI            │
                    └──────────────────────┬───────────────────────┘
                                           │ 提问
                    ┌──────────────────────▼───────────────────────┐
                    │           Orchestrator(多智能体编排器)        │
                    │                                              │
                    │  ① Planner    规划:拆解子问题 + 工具计划        │
                    │  ② Retriever  检索:混合检索 + MCP 工具执行      │
                    │  ③ Answerer   起草:基于证据、带引用 [C1][C2]   │
                    │  ④ Auditor    核查:逐条声明 vs 证据            │
                    │       └─ revise ─► 带反馈重检/重答(≤3 轮)     │
                    └──────┬──────────────────────────────┬────────┘
                           │ 语义检索                       │ MCP 协议
              ┌────────────▼───────────┐       ┌───────────▼────────────┐
              │  知识库(RAG)           │       │   MCP 工具服务器        │
              │  PDF/DOCX/XLSX/PPTX/TXT│       │  calculator / kb_search │
              │  → 解析 → 切块 → 向量化  │       │  doc_stats / …          │
              │  → Chroma + BM25 混合   │       │  🔒 敏感工具 → HITL 审批 │
              └────────────────────────┘       └────────────────────────┘

✨ Core Capabilities

Requirement

Implementation

Multi-format document knowledge ingestion and semantic retrieval

PDF / Word / Excel / PPT / TXT parsing (including tables, slides, page-number positioning); recursive chunking; vector + BM25 hybrid retrieval (RRF fusion); local embeddings with no API Key required

Multi-agent division of labor

Planner (planning) → Retriever (retrieval + tools) → Answerer (drafting with citations) → Auditor (verification); on audit failure, automatically re-retrieves/answers with feedback, up to N rounds

MCP-based standardized tool invocation with secure isolation

MCP server implemented on the official mcp SDK (supports both in-process and standard stdio access); JSON Schema parameter validation; per-agent least-privilege whitelist; AST whitelist calculator to eliminate injection

Auditor fact-checking and self-correction

Verifies each claim against evidence (supported/unsupported/contradicted) line by line, outputs confidence scores and revision suggestions; when evidence is insufficient, explicitly states so and refuses to fabricate, and may autonomously supplement retrieval

HITL human intervention

Sensitive tools (send email/export/delete) trigger approval-request suspension, with execution resuming after approve/reject; three modes: interactive / auto_approve / auto_deny (deny by default, fail-safe)

Related MCP server: Labradoc MCP Server

🚀 Quick Start

# 1. 安装(Python 3.10+)
cd enterprise-rag-agent
pip install -e .

# 2.(可选)配置 LLM —— 默认离线模式无需配置;接入真实模型见下文
cp .env.example .env   # 填入 OPENAI 兼容的 API Key(OpenAI/DeepSeek/Ollama 等)

# 3. 一键端到端演示(自动生成 5 种格式样例文档 → 入库 → 问答 → 审批,全部自校验)
aegis demo

# 4. 导入你自己的文档
aegis ingest ./your_docs

# 5. 提问(多智能体流水线)
aegis ask "一线城市出差住宿报销上限是多少?"

# 6. 启动 HTTP 服务(Swagger: http://127.0.0.1:8000/docs)
aegis serve

Run the full pipeline with no API Key required: the default embedding model uses a local ONNX (BAAI/bge-small-zh-v1.5, ~95MB auto-downloaded on first run), and the LLM uses a built-in deterministic backend for end-to-end verification; to connect a real model, simply configure it in .env.

Connecting a Real LLM

Supports any OpenAI-compatible protocol endpoint:

# OpenAI / DeepSeek / 通义 / 本地 vLLM
AEGIS_LLM_PROVIDER=openai
AEGIS_LLM_BASE_URL=https://api.deepseek.com/v1
AEGIS_LLM_API_KEY=sk-xxxx
AEGIS_LLM_MODEL=deepseek-chat

# 或本地 Ollama(含嵌入,完全离线)
AEGIS_LLM_PROVIDER=ollama
AEGIS_LLM_MODEL=qwen2.5:3b
AEGIS_EMBED_PROVIDER=ollama
AEGIS_EMBED_MODEL=nomic-embed-text

📖 Documentation

Document

Content

docs/architecture.md

Architecture design, multi-agent collaboration protocol, security model

docs/deploy.md

Deployment, configuration, LLM integration, MCP stdio mode

docs/verification.md

End-to-end self-verification report and verification methods

🔌 HTTP API

Method

Path

Description

POST

/api/documents/ingest

Upload document for ingestion (multipart)

POST

/api/documents/ingest-path

Batch ingestion by path

GET

/api/documents

Document list

DELETE

/api/documents/{id}

Delete document (sensitive → HITL)

POST

/api/chat

Ask a question (multi-agent pipeline)

GET

/api/sessions/{id}

Session status

POST

/api/sessions/{id}/resume

Resume session after approval

GET

/api/approvals

Approval-request list

POST

/api/approvals/{id}/decide

Approve/reject ({"approve": true})

GET

/api/tools · POST /api/tools/call

MCP tool catalog / manual tool invocation

GET

/health

Health check

🧩 MCP Tools

Exposed via the standard Model Context Protocol, accessible by any MCP client:

python -m aegis.mcp.server   # 标准 stdio 服务

Tool

Description

Security Level

calculator

AST whitelist safe calculation

✅ Regular

get_current_time

Current time

✅ Regular

kb_search

Knowledge base semantic retrieval

✅ Regular

doc_stats

Knowledge base statistics

✅ Regular

send_email

Simulated email sending

🔒 Sensitive → HITL

export_file

Export file (sandbox directory)

🔒 Sensitive → HITL

delete_document

Delete document

🔒 Sensitive → HITL

🧪 Testing and Verification

pip install -e ".[dev]"
pytest -q              # 单元 + 集成测试(全部离线可跑)
aegis demo             # 端到端演示(含 20+ 条自校验断言)

📁 Directory Structure

enterprise-rag-agent/
├── aegis/
│   ├── llm/            # LLM 抽象层(OpenAI 兼容 / Ollama / 离线确定性)
│   ├── embeddings/     # 嵌入层(fastembed 本地 / OpenAI / Ollama)
│   ├── ingestion/      # 解析(5 格式)→ 切块 → 入库管道
│   ├── retrieval/      # Chroma 向量库 + BM25 混合检索
│   ├── mcp/            # MCP 服务器 / 客户端 / 安全策略
│   ├── agents/         # Planner / Retriever / Answerer / Auditor
│   ├── hitl/           # 人工审批管理器
│   ├── api/            # FastAPI 服务
│   ├── orchestrator.py # 多智能体编排器(状态机 + 挂起恢复)
│   ├── demo.py         # 端到端演示
│   └── cli.py          # 命令行入口
├── scripts/make_sample_docs.py   # 样例文档生成
├── tests/              # pytest 套件
└── docs/               # 架构 / 部署 / 验证文档

⚠️ Security Notes

  • Sensitive tools are denied by default (auto_deny); for production environments, it is recommended to keep interactive human approval;

  • export_file only allows writing to the exports/ sandbox under the data directory;

  • The calculator uses AST whitelist evaluation, with no eval injection surface;

  • The project's send_email is a simulated implementation; before connecting a real email gateway, implement it yourself and keep HITL approval in place.

📄 License

MIT

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • Runtime permission, approval, and audit layer for AI agent tool execution.

  • A paid remote MCP for AI SDK data query MCP, built to return verdicts, receipts, usage logs, and aud

  • 100+ MCP tools for AI agents: content metadata, trade intelligence, business-expertise analysis.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/CJH91577/enterprise-rag-agent'

If you have feedback or need assistance with the MCP directory API, please join our Discord server