
Aegis — AI Agent Governance
io.github.Acacian由 GitHub 账号 Acacian 发布v0.1.7更新于 Oct 28, 2026
Policy-based governance for AI agent tool calls. YAML policy, approval gates, audit logging.
概览
Aegis 是一个本地治理层,可包裹 MCP 服务器与 AI 代理框架,执行 YAML 策略、拦截提示注入、遮蔽 PII 并保留防篡改审计日志。
- 可以做什么
- 以 stdio 或 HTTP 代理任意 MCP 服务器,对其工具调用执行策略、参数清洗与审计
- 拦截或告警提示注入、PII、提示泄露、有害内容及 MCP STDIO 注入
- 按声明式 YAML 规则把匹配的动作判定为自动放行、需审批或阻止
- 将每次调用写入 Merkle 链式审计日志,支持 SQLite、JSONL 与 webhook 输出
- 扫描代码中未受治理的 AI 调用,并在上线前测试或对比策略变更
- 适用场景
- 当代理或助手调用的工具需要审批关卡、内容护栏或审计记录时适用;也适合在不改动现有 MCP 服务器代码的前提下,为其加上一层策略管控。
- 运行要求
- 以本地 Python 进程运行,从 agent-aegis 的 PyPI 包安装,使用代理功能需安装 mcp 附加组件。需通过 AEGIS_POLICY_PATH 环境变量提供 YAML 策略文件。仅限桌面客户端,未声明身份验证。
安装
在 SourceWeft 中
- 打开 控制台中的 Aegis — AI Agent Governance,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Agent-Aegis
The governance layer for AI agents. One API, 12 frameworks, every governance primitive.
Aegis is to agent governance what Redis is to data structures — one runtime that unifies prompt-injection blocking, PII masking, policy enforcement, trust delegation, and tamper-evident audit across every agent framework. No code changes.
pip install agent-aegis → aegis.auto_instrument() → 12 frameworks are now governed.
[OpenSSF Best Practices]
[CI]
[PyPI]
[Python]
[License]
[Tests]
[Coverage]
[Playground]
What is Aegis • Primitives • Frameworks • Use Cases • 30-Second Start • Research • Docs • Playground
English • 한국어
What is Aegis
Every AI agent framework reinvents the same governance primitives — and each one does it slightly differently. Aegis is the abstraction layer that unifies them.
You don't write a LangChain guardrail and a CrewAI guardrail and an OpenAI guardrail — you write one Policy and every framework inherits it.
How this differs from the guardrail libraries
They solve a different problem, and mostly a text-shaped one. Guardrails AI validates model output against a hub of validators; NeMo Guardrails scripts conversational and tool policy in the Colang DSL; Snyk Agent Scan — Invariant Labs' mcp-scan, since the Snyk acquisition — scans MCP servers and agent skills for known risk patterns and can proxy them at runtime; LLM Guard chained input/output scanners until it was archived in July 2026. Each one you wire in yourself, at a call site you choose. Aegis starts from the other end: auto_instrument() finds the frameworks already installed and instruments them in place, so one Policy covers all of them without a line of agent code changing. What it enforces is agent-shaped rather than prompt-shaped — delegation chains under a monotone trust constraint, audits of what an agent excluded rather than what it picked, the distance between an agent's declared intent and its measured impact, and a tamper-evident audit chain. All of it is deterministic, so there is no second model sitting in the request path. These are not exclusive choices: a semantic or model-based detector drops into GuardrailEngine.add() alongside the built-ins.
Primitives
The contract every adapter maps into. Framework-agnostic by design.
Every governance feature in Aegis — anomaly detection, cost budgets, drift, cascade guards, kill switches — is a composition of these primitives. Read the Concepts guide to see how they fit together.
Frameworks
One API. 12 agent frameworks + 3 protocol-level adapters.
auto_instrument() detects what's installed and patches only those — no hard dependencies. Custom adapters use the same BaseAdapter interface. Every adapter above is exercised against the current upstream release daily by the integration workflow, which drives each framework's real entrypoint and asserts a guardrail fires — the unit suite fakes these frameworks, so it cannot see upstream drift on its own.
Integration policy. Native extension points win wherever one exists that can actually block — Google ADK's BasePlugin and CrewAI's BeforeToolCallHook both do, and there auto_instrument() patches only enough to install the native object. Pydantic AI and the OpenAI Agents SDK ship native implementations you opt into (AbstractCapability, tool_input_guardrail) alongside a patch-based path for the zero-code case. Everything else is patched because no blocking hook exists: the raw OpenAI/Anthropic SDKs and DSPy expose none, and LlamaIndex's instrumentation dispatcher emits events but swallows handler exceptions, so it can observe and not enforce.
The Pydantic AI integration is the reason this policy is written down. It was monkey-patched until core maintainer DouweM reviewed it — "It doesn't look like those features are actually exposed as Pydantic AI capabilities?" — and was rebuilt on the native extension API in response (src/aegis/contrib/pydantic_ai.py; the review is pydantic-ai#4888).
Patching is the fallback, not the preference — it is the part most exposed to upstream change, which is why the integration workflow exists.
Default Guardrails
Deterministic regex — no LLM calls, no network. 2.65ms cold / <1µs warm per check.
Use Cases
The same primitives, five different entry points. Pick whichever matches your workflow.
1. Runtime protection (most common)
One line. Any framework.
Or zero code changes — AEGIS_INSTRUMENT=1 python my_agent.py. Injection blocking, PII masking, prompt-leak warnings, audit trail, and policy enforcement become active for every LangChain / CrewAI / OpenAI / Anthropic / LiteLLM / ADK / DSPy / LlamaIndex / Pydantic AI call.
Pydantic AI native capability — no monkey-patching, explicit per-agent control:
Full Pydantic AI integration guide →
2. Pre-production scanning
Find ungoverned AI calls before they ship.
Supports --format json|sarif|suggest, --threshold A-F, .aegisscanignore, and inline # aegis: ignore pragmas. Auto-fix with aegis scan --fix.
3. Policy CI/CD
Security tools protect at runtime. Aegis also manages the policy lifecycle — the same way you test and ship code.
Or block ungoverned calls at PR time:
4. Audit & compliance
Every call is logged to a tamper-evident Merkle chain, with mappings to EU AI Act / NIST AI RMF / SOC2 built in.
SQLite + JSONL + webhook sinks. Ed25519 signing for long-term evidence. See the Compliance guide.
5. Governance server (multi-agent)
Centralized governance for multiple agents. Each agent connects via SDK, server handles policy, guardrails, audit, and compliance.
37 REST endpoints + WebSocket audit streaming + web dashboard. Agents auto-register, send heartbeats, and query policy over HTTP. See Governance Framework Server.
30-Second Start
Or use a YAML policy for full control:
Install Options
MCP Proxy — govern any MCP server with zero code changes
Works with Claude Desktop, Cursor, VS Code, Windsurf. STDIO injection protection, tool poisoning detection, rug-pull detection, argument sanitization, policy evaluation, full audit trail.
Governance Framework Server
Run Aegis as a dedicated governance server with REST API, WebSocket streaming, and web dashboard.
37 REST endpoints covering the full governance lifecycle:
Connect with the Python SDK (sync or async):
Config-driven via aegis-server.yaml — guardrails, webhooks (Slack/PagerDuty), rate limiting, cost budgets, and auth all declarative. See aegis-server.example.yaml.
Why Aegis?
What Only Aegis Does
Other tools check inputs and outputs. Aegis governs the decision itself — with primitives no other governance runtime exposes.
CLI
Research
Original measurements on public agent trace datasets. Stdlib-only, reproducible in 30 seconds.
- The Justification Gap in 14,285 Tau-Bench Tool Calls — Formal definition of the Tripartite ActionClaim with a silent-baseline empirical study. 90.3% approve / 9.7% escalate / 0% block across four model:domain groups. Airline domain exposes ~2× the mean gap of retail. Includes soundness sketches for the three structural invariants and an honest note on the
max-only override limitation discovered during the study. - Tool Distribution Drift in 1,960 Tau-Bench Trajectories — Shannon entropy on tool name sequences across GPT-4o and Sonnet 3.5 New. 39.8% of scored trajectories collapse onto one or two tools by the end. Bimodal distribution, 1.7× cross-model gap. All scripts and raw data included.
Run the same signal on your own trace:
The CLI reads only the tool_name field — never args, CoT, or prompts — so enterprise users can score prod traces without exfiltrating PII.
We also ran aegis scan across 39 public agent repositories and graded their governance posture: 92% scored an F. That is a finding about the ecosystem, not about any one project — most agent code has no tool-call policy at all.
Documentation
Full documentation at acacian.github.io/aegis:
- Integration guides — LangChain, CrewAI, OpenAI, MCP, and more
- Policy reference — conditions, templates, best practices
- Security features — guardrails, anomaly detection, compliance
- API stability — what 1.x guarantees, and what counts as a breaking change
- Architecture — how the codebase is structured
- Interactive playground — try in browser, no install
Contributing
Contributing Guide • Good First Issues • [Open in GitHub Codespaces]
License
MIT -- see LICENSE for details.
Copyright (c) 2026 구동하 (Dongha Koo, @Acacian). Created March 21, 2026.
The governance layer for AI agents. One API, 12 frameworks, every governance primitive.
If Aegis helps you, consider giving it a star -- it helps others find it too.
来源:README.md,提交 757f570
工具
0版本历史
1- v0.1.7最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分