项目介绍
Agent 开发框架 · 2026-11-09 更新 · 本站尚未实测
AIActGuard 是一个 Python 合规中间件,定位为「EU AI Act compliance middleware for agentic AI」。按 README 的说法,它不替代 LangChain、CrewAI、AutoGen 等编排层框架,而是以适配器或 @watch 装饰器的形式挂在已有智能体旁边,用于记录决策、拦截高风险动作并起草 Articles 12–14 相关的文书材料。
README 明确了一个重要边界:它本身不构成合规认证(“None of them certify compliance on their own — that's a legal determination”)。该判断属于法律认定,工具只提供证据准备与记录能力。
核心能力
点击能力名称查看输入、输出和原文依据。
README 列出 19 个模块,分四阶段:
- 核心层:风险分级引擎(对应 Art. 6 / Annex III,覆盖八个 Annex III 高风险类别)、项目方称防篡改的审计轨迹(本站未进行安全审计)(Art. 12,默认 SQLite,生产可用 Postgres)、人在环审批闸门(Art. 14,支持审批人升级链与带理由的覆盖记录)、可解释性信息采集(Art. 13)、策略即代码(YAML 规则)、6 个框架适配器(LangChain、CrewAI、Claude Agent SDK、LangGraph、AutoGen、OpenAI Agents SDK)。
- 文档与评估工具:Annex IV 技术文档草稿、符合性准备清单(差距分析)、FRIA 模板、上市后监测计划模板、Art. 71 登记数据准备。README 强调提交动作仍需人工完成。
- 鲁棒性与事件工具:红队测试脚本(启发式检测,“not semantic judgment”)、偏见与公平性统计扫描、严重事件报告草稿、GPAI 透明度卡生成。
- 扩展模块:复合系统风险聚合、NIST AI RMF 映射、ISO/IEC 42001 映射、社区插件接口。
另有 audit_priority 与 drift_diagnostic 两个附加模块,需要真实人工审计结论(AuditFindingStore)才能产出结论,否则只会输出「证据不足」。README 说明该统计方法移植自 MIT 许可的 confseq 包的部分代码路径。
需要注意:README 明示 classifier_confidence 只是关键词/类别分类器的规则匹配强度,不是校准后的真实风险概率,项目背后没有训练模型。
实际应用场景
适用场景
适合已经在使用上述六种框架之一、需要对工具调用做人工审批与留痕的团队,尤其是涉及 Annex III 高风险类别的业务。也适合需要从审计记录回溯生成技术文档、事件报告草稿的合规准备工作。它不适合作为合规判定的唯一依据,也不处理禁止性实践认定、CE 认证、质量管理体系等事项(README 明确列为 out of scope)。
安装与接入
README 给出的安装命令:
pip install aiactguard[langchain]
可选 extras 包括 crewai、claude-agent-sdk、langgraph、autogen、openai-agents、postgres、audit-priority,可组合安装(原文示例:pip install aiactguard[langgraph,postgres])。安装后可执行:
python -c "from aiactguard import watch; print('aiactguard OK')"
接入方式为把 AIActGuardCallbackHandler 注册到 agent 的 callbacks,或使用 @watch 装饰器;approvers 支持传入多个函数构成升级链。仓库 examples/ 下提供各框架的可运行示例。README 提到 Python 3.10+(来自 pyproject 徽章)。
从源码运行测试的流程见 README「Running the tests」一节,其中 Postgres 测试需要可达数据库(AIACTGUARD_TEST_POSTGRES_DSN),不可达时会跳过。
使用条件与限制
- 是否需要部署
- 需自行准备运行环境,具体要求见正文
- 是否需要注册
- 账号和认证要求见正文;未明确说明的项目仍待核验
- 是否需要 API Key
- 待核验
- 费用与额度
- 费用边界见正文,项目许可不代表模型或托管服务免费
- 所需权限
- 待核验
- 许可证与服务条款
- 待核验
权限费用与限制
- 审批闸门会中断智能体执行,被拒绝的动作「never runs」,属运行时拦截,接入前应评估对现有流程的影响。
- 审计轨迹默认写入本地 SQLite,生产建议 Postgres;数据留存与隐私处理需使用方自行评估,README 未给出具体的数据治理说明。
- 项目本身未声明收费或商业模块,但接入的第三方模型与云服务费用需另行核验;未在资料中找到价格信息。
- 测试徽章与 README 显示 117 项测试通过,此为仓库自述,非本站实测。
- 插件可通过
aiactguard.pluginsentry-point 自动发现,第三方插件质量需自行审查。
国内使用情况
网友核验 用户经验分享
与站长实测独立,不代表官方认证或本站已实测。
最近核验:暂无有效核验。参与人数按当前项目有效身份去重;不同核验项分别统计,不合并成用户总结果。仅统计审核通过且未过期的记录。
分项统计、有效期与样本量
| 核验项目 | 有效人数 | 成功 / 部分 / 失败 / 无法判断 | 成功率 | 最近核验 / 有效期 |
|---|---|---|---|---|
| 官方网站访问 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 7 天 |
| GitHub 仓库访问 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 7 天 |
| 安装与运行 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 官方服务国内连接 / MCP 连接 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 国内网络情况 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 7 天 |
| 国内模型兼容性 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 自定义 API | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 海外服务依赖 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 海外账号要求 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 中文界面 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 客户端兼容性 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 账号及费用信息 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
成功率 = 成功 ÷(成功 + 部分成功 + 失败);无法判断不计入分母。至少 5 份可判断结果才显示成功率。账号、费用、海外依赖与语言等事实项,成功表示核查结论与资料吻合,具体观察另行统计;不表示免费或没有海外依赖。不同网络、客户端和版本的结果不能直接等同。
最近有效核验
暂无审核通过且未过期的网友核验。欢迎提交真实使用记录。
查看全部有效核验 →国内实测状态:国内可用性待核验。协议兼容和官方资料说明不等于国内网络可用。
- 官方网站访问
- 尚未实测 待核验
- GitHub 仓库访问
- 尚未实测 待核验
- 官方服务国内连接
- 尚未实测 待核验
- 国内网络情况
- 尚未实测 待核验
- 国内模型兼容性
- 尚未实测 待核验
- 自定义 API
- 尚未实测 待核验
- 海外服务依赖
- 尚未实测 待核验
- 海外账号要求
- 尚未实测 待核验
- 中文界面
- 尚未实测 待核验
- 国内最后核验时间
- 尚未实测
许可与国内使用
仓库代码为 MIT 许可(LICENSE 文件明确)。该许可仅覆盖本仓库代码,涉及的第三方模型、托管服务与社区插件适用各自条款。README 未说明服务部署地域、国内网络可达性或国内模型适配情况,均待核验;也未提供 MCP 端点或客户端配置资料。GitHub 元数据显示仓库未归档。
项目资料与来源
字段依据与待核验事项
access:来源确认 · pip install aiactguard[langchain]
project_type:来源确认 · Drop-in, not a rewrite. Every open-source agent framework is well-served at the orchestration layer.
原始 README(折叠技术参考)
<div align="center">
# AIActGuard
### EU AI Act compliance middleware for agentic AI
**Drop-in, not a rewrite.**
Every open-source agent framework is well-served at the orchestration layer. None of them log a decision, gate a high-risk action, or draft the paperwork Articles 12–14 ask for — that gap is what this fills, as a decorator/callback around the agent you already have.
[](https://github.com/NavikkumarModi/AIActGuard/blob/main/LICENSE)
[](https://github.com/NavikkumarModi/AIActGuard/blob/main/pyproject.toml)
[](https://github.com/NavikkumarModi/AIActGuard/blob/main/.github/workflows/ci.yml)
[Install](#install) · [Quickstart](#quickstart) · [Why this exists](#why-this-exists) · [Module roadmap](#module-roadmap) · [Audit prioritization & drift diagnostics](#audit-prioritization--drift-diagnostics) · [Scope](#scope) · [Running the tests](#running-the-tests) · [Contributing](#contributing)
</div>
---

*Recorded from [examples/demo.py](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/demo.py) — real code, real gate decisions (one approval, one denial), real audit records, real report generated from both. The denial scenario shows LangChain's own internal warning when the callback raises — that's the block genuinely propagating through LangChain's real machinery, not this script claiming it worked. Two things are staged for the recording, not faked: the pacing between lines, and the approvers — canned functions playing the reviewer's role so the recording doesn't sit waiting on a keypress, not a live human typing an answer. See [examples/langchain_quickstart.py](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/langchain_quickstart.py) for the `input()`-driven version an actual reviewer would use.*
---
## Install
```bash
pip install aiactguard[langchain]
```
Other extras: `crewai`, `claude-agent-sdk`, `langgraph`, `autogen`, `openai-agents`, `postgres` (for `PostgresAuditStore`), `audit-priority` (for the [audit prioritization & drift diagnostics](#audit-prioritization--drift-diagnostics) module) — mix and match, e.g. `pip install aiactguard[langgraph,postgres]`.
Verify it installed correctly:
```bash
python -c "from aiactguard import watch; print('aiactguard OK')"
```
## Quickstart
```python
from aiactguard.adapters.langchain_adapter import AIActGuardCallbackHandler
from aiactguard.core.approval import ApprovalContext, ApprovalDecision
def compliance_officer(ctx: ApprovalContext) -> ApprovalDecision:
approved = input(f"Approve {ctx.action} ({ctx.risk_tier.value})? [y/N] ").lower() == "y"
return ApprovalDecision(approved=approved, approver_id="compliance_officer")
guard = AIActGuardCallbackHandler(
category="essential_services",
approvers=[compliance_officer], # an escalation chain — add more to route to a fallback
)
agent_executor.invoke({"input": "..."}, config={"callbacks": [guard]})
```
See [examples/](https://github.com/NavikkumarModi/AIActGuard/tree/main/examples) for full runnable examples: [LangChain](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/langchain_quickstart.py), [CrewAI](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/crewai_quickstart.py), [Claude Agent SDK](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/claude_agent_sdk_quickstart.py), [LangGraph](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/langgraph_quickstart.py) (using LangGraph's own `interrupt()` for human-in-the-loop), [AutoGen](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/autogen_quickstart.py), [OpenAI Agents SDK](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/openai_agents_quickstart.py), the framework-agnostic [`@watch` decorator with an escalation chain + override](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/watch_with_escalation.py), [generating all five Phase 2 compliance reports](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/generate_reports.py) from an audit trail, [running the red-team scenario harness](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/red_team_scan.py), [a fairness scan](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/fairness_scan.py), [drafting an incident report + GPAI transparency card](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/incident_and_transparency_reports.py), [composite-system risk aggregation](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/composite_risk_pipeline.py), [NIST/ISO mappings](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/generate_mappings.py), [using the Postgres storage backend](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/postgres_backend.py), [a worked community plugin](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/plugins/example_gxp_plugin.py), [the script that recorded the demo above](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/demo.py), and [audit prioritization + the drift diagnostic report](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/audit_priority_demo.py).
## Why this exists
The agentic AI ecosystem is saturated at the orchestration layer — LangChain, CrewAI, AutoGen, and the rest all do that job well. None of them were built to satisfy Article 12 (audit trails), Article 13 (explainability), or Article 14 (human oversight), because that isn't what they're for. AIActGuard sits *alongside* whichever of those you already run, not in place of it.
```mermaid
flowchart LR
A["Your agent<br/>(LangChain / CrewAI / ...)"] --> B["AIActGuard adapter<br/>or @watch"]
B --> C{"Risk classifier<br/>+ policy-as-code"}
C -->|"below gate threshold"| D["Action runs"]
C -->|"gated"| E["Approver chain"]
E -->|"approved"| D
E -->|"denied"| F["Blocked — never runs"]
D --> G[("Audit trail<br/>SQLite / Postgres")]
F --> G
G --> H["Report generators<br/>(checklist, FRIA, incident report, ...)"]
```
Every module drafts, flags, tests, or logs something concrete. None of them certify compliance on their own — that's a legal determination. See [Scope](#scope) below for the explicit boundary.
## Module roadmap
All 19 modules from the original project plan are built.
### Core (Phase 1)
| # | Module | Article(s) | What it does |
|---|---|---|---|
| 1 | Risk classification engine | Art. 6, Annex III | Tags each agent action/tool call against EU AI Act risk tiers using a configurable taxonomy across all eight Annex III high-risk categories |
| 2 | Immutable audit trail | Art. 12 | Every decision, tool call, input/output, model version, and timestamp logged to an append-only store — SQLite by default, [Postgres](https://github.com/NavikkumarModi/AIActGuard/blob/main/aiactguard/storage/postgres_store.py) for production |
| 3 | Human-in-the-loop approval gates | Art. 14 | Configurable interrupt points that pause execution before a high-risk action fires, with an escalation chain of approvers and reasoned-override logging |
| 4 | Explainability capture | Art. 13 | Structures the agent's chain-of-thought/tool-selection rationale into an auditor-readable format |
| 5 | Framework adapters | — | LangChain, CrewAI, Claude Agent SDK, LangGraph, AutoGen, OpenAI Agents SDK — all 6 |
| 6 | Policy-as-code | — | YAML rules defining what counts as high-risk for a given org and what triggers a human gate |
### Documentation & assessment tooling (Phase 2)
| # | Module | Article(s) | What it does |
|---|---|---|---|
| 7 | Technical documentation generator | Art. 11, Annex IV | Auto-drafts the Annex IV technical file from audit logs + a guided questionnaire |
| 8 | Conformity readiness checklist | Art. 43 | Gap-analysis against Annex IV/VI requirements — a pre-assessment aid, not the assessment itself |
| 9 | FRIA template generator | Art. 27 | Pre-fills a Fundamental Rights Impact Assessment draft from risk classification and deployment context |
| 10 | Post-market monitoring plan generator | Art. 72 | Monitoring plan template scaffolded from risk tier and logged incident categories |
| 11 | EU database registration data prep | Art. 71 | Auto-compiles the metadata the Art. 71 registration form requires — filing stays manual |
### Robustness & incident tooling (Phase 3)
| # | Module | Article(s) | What it does |
|---|---|---|---|
| 12 | Adversarial/red-team test harness | Art. 15 | Runs prompt-injection, jailbreak, and edge-case scenarios against your agent — heuristic detection, not semantic judgment |
| 13 | Bias & fairness scan | Art. 10 | Statistical checks on agent decisions across a caller-supplied protected-characteristic proxy, at runtime |
| 14 | Serious incident report drafter | Art. 73 | Turns a flagged incident into a structured draft for human review before filing |
| 15 | GPAI transparency card generator | Art. 53 | Auto-generates a model transparency summary from config + usage patterns |
### Multi-agent & multi-standard extensions (Phase 4 — differentiators)
| # | Module | What it does |
|---|---|---|
| 16 | Composite-system risk aggregation | Flags when multiple individually low-risk agents, composed into a pipeline, cross into high-risk territory as a system |
| 17 | NIST AI RMF mapping layer | Maps audit/risk data to NIST AI RMF's Govern/Map/Measure/Manage functions |
| 18 | ISO/IEC 42001 mapping layer | Maps the same data to ISO 42001 AI management system clauses |
| 19 | Plugin architecture for community modules | Defined interface for jurisdiction- or industry-specific community modules |
## Audit prioritization & drift diagnostics
Additional scope beyond the 19 modules above, contributed from the user's own research on adaptively-routed agent systems (paper forthcoming — no citation added yet since it isn't posted).
The research's core statistical method is an anytime-valid confidence sequence over a bin's true violation rate, built from accumulating human audit findings. The research itself also describes using that method to *automatically stop requiring approval* for certain actions once the statistics say a context is safe enough. AIActGuard deliberately does not implement that part — every gate here always defers to a human, with no exception. What's built instead is the same statistical method repurposed for two things that never remove a human from a decision:
- **`aiactguard.audit_priority`** — ranks pending/completed audit records by how statistically uncertain the evidence still is for their confidence bin, so a compliance reviewer works down a prioritized list instead of reviewing randomly or chronologically. A bin nobody's reviewed yet ranks at the top by default; a bin with enough accumulated evidence of being safe ranks lower automatically as that evidence comes in.
- **`aiactguard.reports.drift_diagnostic`** — a monitoring report (not a gate) decomposing where "silent risk mass" concentrates across confidence bins, and checking whether the agent shows an elevated preference for high-exposure actions specifically in bins the classifier tends to miss.
Both require ground-truth findings from actual human review (`aiactguard.audit_priority.findings.AuditFindingStore`) to produce anything beyond "not enough evidence yet" — see [examples/audit_priority_demo.py](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/audit_priority_demo.py) for a full worked example. Requires `pip install aiactguard[audit-priority]`.
> [!NOTE]
> The confidence-sequence computation is ported from the [`confseq`](https://github.com/gostevehoward/confseq) package (MIT license, Steve Howard with Ian Waudby-Smith and Aaditya Ramdas) — only the one code path this module needs, not the full library. The published PyPI package requires a compiled CMake build that failed on the machine this was built on and can't be relied on to install cleanly for everyone; this path is pure NumPy.
## Scope
> [!IMPORTANT]
> Explicitly out of scope, and why — this boundary is what makes the rest of this list credible instead of overreaching:
>
> - **Prohibited-practice determination (Title II)** — legal judgment call, not a runtime check
> - **Conformity assessment / CE marking itself** — requires formal procedures, sometimes a notified body; the toolkit preps evidence, it doesn't perform the assessment
> - **Quality management system (Art. 17)** — an organizational process, not code
> - **GPAI systemic-risk evaluation (Art. 55)** — applies to frontier model providers, not agent builders
> - **Actual legal filing/registration submission** — data prep is automated, submission is not
> [!NOTE]
> `classifier_confidence` (logged on every audit record) is rule-match strength from a keyword/category classifier, not a calibrated probability of true risk. This project doesn't have a trained model behind it, and doesn't claim to.
## Running the tests
```bash
git clone https://github.com/NavikkumarModi/AIActGuard.git
cd AIActGuard
python3 -m venv .venv
.venv/bin/pip install -e ".[langchain,crewai,claude-agent-sdk,langgraph,autogen,openai-agents,postgres,dev]"
.venv/bin/pytest -q
# 117 passed
```
`tests/test_postgres_store.py` needs a reachable Postgres database (`AIACTGUARD_TEST_POSTGRES_DSN`, defaults to `postgresql:///aiactguard_test`) — it skips cleanly if none is available rather than failing the suite; CI runs a real Postgres service so it's exercised there either way. See [CONTRIBUTING.md](https://github.com/NavikkumarModi/AIActGuard/blob/main/CONTRIBUTING.md) for the full setup and design principles.
## Contributing
Contributions are welcome, especially jurisdiction- or industry-specific modules. Open an issue to discuss before submitting a large PR.
**Writing a plugin:** implement `aiactguard.plugins.Plugin` — a `name`, a `description`, and a `generate(logger, *, questionnaire=None, **kwargs) -> str` method (the same shape every built-in report/mapping already has). See [examples/plugins/example_gxp_plugin.py](https://github.com/NavikkumarModi/AIActGuard/blob/main/examples/plugins/example_gxp_plugin.py) for a worked example. To publish one for others to auto-discover, register it under the `aiactguard.plugins` entry-point group in your own package's `pyproject.toml`:
```toml
[project.entry-points."aiactguard.plugins"]
gxp = "aiactguard_gxp_plugin:plugin"
```
Callers pick it up with `aiactguard.plugins.discover_entry_points()`.
## License
MIT — see [LICENSE](https://github.com/NavikkumarModi/AIActGuard/blob/main/LICENSE).
历史前置条件说明(补充参考)
Python 3.10+;通过 pip 安装,按所用框架选择 extras(langchain、crewai、claude-agent-sdk、langgraph、autogen、openai-agents 等);生产使用审计存储可选 Postgres 并需数据库连接;是否需要模型 API Key 取决于所接入的智能体框架,README 未说明;运行测试需可用 Postgres(可选);费用、境外依赖及国内网络可达性待核验。
项目来源与清单版权许可
https://github.com/NavikkumarModi/AIActGuard
整理来源:https://github.com/slavakurilyak/awesome-ai-agents
清单版权与许可:
MIT License
Copyright (c) 2024 Slava Kurilyak
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.