项目简介
为AI代理提供确定性策略执行、零信任身份和执行沙箱,覆盖所有OWASP Agentic Top 10风险,可与任何框架集成并包含审计日志。
README 预览
🌍 [English](/README.md) | [日本語](./docs/i18n/README.ja.md) | [简体中文](./docs/i18n/README.zh-CN.md) | [한국어](./docs/i18n/README.ko.md)\n\n\n\n# Agent Governance Toolkit\n\n### Ship agents to production without losing sleep\n\n\n \n \n \n\n\n\n \n 🚀 Quick Start ·\n 📋 Specifications ·\n 📦 PyPI ·\n 📝 Changelog\n \n\n\n[](https://github.com/microsoft/agent-governance-toolkit/actions/workflows/ci.yml)\n[](LICENSE)\n[](https://pypi.org/project/agent-governance-toolkit/)\n[](https://www.npmjs.com/package/@microsoft/agent-governance-sdk)\n[](https://www.nuget.org/packages/Microsoft.AgentGovernance)\n[](https://scorecard.dev/viewer/?uri=github.com/microsoft/agent-governance-toolkit)\n[](https://www.bestpractices.dev/projects/12085)\n[](docs/compliance/owasp-agentic-top10-architecture.md)\n\n> [!IMPORTANT]\n> **Public Preview** -- production-quality, Microsoft-signed releases. May have breaking changes before GA.\n\nPolicy enforcement, identity, sandboxing, and SRE for autonomous AI agents. One `pip install`, any framework.\n\n---\n\n## The Problem\n\nYour AI agents call tools, browse the web, query databases, and delegate to other agents. Once deployed, they make decisions autonomously. You need answers to three questions:\n\n**1. Is this action allowed?** An agent with access to `send_email` and `query_database` should not be able to `drop_table`. OAuth scopes and IAM roles control which services an agent can reach, not what it does once connected.\n\n**2. Which agent did this?** In a multi-agent system, five agents might share a single API key. When something goes wrong, "an agent did it" is not an incident response.\n\n**3. Can you prove what happened?** Auditors and regulators need tamper-evident records of every decision: what policy was active, what the agent requested, and why it was allowed or denied.\n\nPrompt-level safety ("please follow the rules") is not a control surface. It is a polite request to a stochastic system. [OWASP LLM01:2025](https:常见问题 (3)
故障排除如何让 agent-os 治理一致性和适配器合约测试在 CI 中硬性失败,而不是被软性失败掩盖?
为 agent-os 矩阵包在 GitHub Actions 工作流(.github/workflows/ci.yml)中添加一个专用的合规性验证步骤。将其放在现有的软失败测试步骤(pytest tests/ ... || true)之前,并使用 if: matrix.package == 'agent-os' 进行保护。仅运行 pytest tests/test_governance_parity.py tests/test_spec_adapter_contract_conformance.py,不带 || true。这样可以强制执行这些特定的检查,同时保持其他广泛的测试套件不变。确保分支保护要求此步骤。
故障排除为什么 agent-hypervisor 的 RingEnforcer check_command 允许以变量赋值或包装器(如 env、nohup 或 exec)作为前缀的被拒绝命令(例如 FOO=x curl)?
根本原因:RingEnforcer.check_command 仅将命令字符串的第一个单词与 DENIED_COMMANDS 进行比对,因此开头的 NAME=value 赋值或包装命令(env、exec、nohup、nice、timeout、stdbuf、time、command、builtin)会被误认为是可执行文件,而真正被拒绝的命令(例如 curl)却被报告为 allowed=True。修复:将 agent-hypervisor 更新至包含 issue #4331 后续补丁的构建版本,该补丁 (1) 以引号感知的方式跳过开头的 NAME=value 赋值,(2) 通过解析包装命令的选项来解包包装命令,(3) 当包装命令的选项无法解析时(未知选项、缺少选项参数或 env -S)采取失败关闭策略(拒绝该命令)。在补丁应用之前,调用方不应仅依赖 check_command:应在调用它之前对包含赋值前缀/包装命令的命令进行规范化处理或直接拒绝。注意:续行符混淆(cu\<newline>rl)仍是一个已知的独立缺陷。
故障排除为什么我的智能体在使用示例策略清单时,首次工具调用就失败并报出 'runtime_error:intervention_point_unknown' 错误?
清单的 intervention_points 块没有绑定 pre_tool_call,而 19 个内置适配器中有 16 个会评估该干预点(除 a2a、guardrails 和 llamaindex 之外的全部)。引擎会以 runtime_error:intervention_point_unknown 有意拒绝未绑定的干预点,因此智能体在第一次工具调用时即被阻止。受影响的清单包括 examples/policies/african-regulatory/*(15 个文件)、examples/policies/india-regulatory/*(5 个)、examples/policies/production/*(5 个)、examples/policies/lotl_prevention_policy.yaml 以及 examples/policy-templates/* 中的大部分,因为它们只绑定了 input/output。解决方法:显式绑定你的适配器会评估的每一个干预点——在清单的 intervention_points 中添加 pre_tool_call(以及 post_tool_call)条目,并使其 deny/allow 语义与策略包的意图保持一致(在工具调用点应用监管模式规则也是更安全的方向)。你可以从 PR #3528 中已修复的清单(crewai、maf、openai-agents 和 smolagents 示例)复制绑定模式。