[Contrib] Agent-OS Governance Extension: Kernel-Level Policy Enforcement#7212
[Contrib] Agent-OS Governance Extension: Kernel-Level Policy Enforcement#7212imran-siddique wants to merge 6 commits intomicrosoft:mainfrom
Conversation
Adds kernel-level governance for AutoGen multi-agent conversations. Features: - GovernancePolicy: Define rules for agent behavior - GovernedAgent: Wrap individual agents with policy enforcement - GovernedTeam: Govern entire agent teams - Content filtering with blocked patterns - Tool call limits and filtering - Full audit trail Integration with Agent-OS kernel for enterprise governance. See: https://github.com/imran-siddique/agent-os
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7212 +/- ##
==========================================
- Coverage 81.22% 81.20% -0.02%
==========================================
Files 244 2 -242
Lines 18512 149 -18363
==========================================
- Hits 15036 121 -14915
+ Misses 3476 28 -3448
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Ready for Final Review 🙏This PR has been open for a while. The AgentMesh trust layer integration is complete and tested. Could a maintainer please provide a final review? Happy to address any remaining concerns. Thank you! |
Covers all 5 classes: - GovernancePolicy: defaults, custom values, dataclass structure - ExecutionContext: creation, event recording, multiple events - PolicyViolationError: attributes, severity, exception hierarchy - GovernedAgent: content checks, tool checks, on_messages, streaming, message limits, pattern blocking, attribute forwarding - GovernedTeam: agent wrapping, content checks, run/run_stream, audit log, stats, violation handlers Integration tests: full workflow + multi-pattern enforcement All 46 tests pass locally (pytest 9.0.2, Python 3.13).
Try again |
|
Hi maintainers! This PR adds Agent-OS governance as an autogen-ext package. All review threads are addressed and the integration follows the existing autogen-ext package patterns. Would a maintainer be able to review? Happy to make any changes needed. Thank you! |
|
Friendly nudge -- just wanted to share that Agent OS was merged into microsoft/agent-lightning (14k stars) yesterday: microsoft/agent-lightning#478 -- The Microsoft team validated the kernel-level governance approach for RL training. Happy to address any feedback here, including the patch coverage question! |
- Use datetime.now(timezone.utc) instead of datetime.utcnow() - Eliminates DeprecationWarning in Python 3.12+ - Tests: 46 passed, 91% coverage, 0 warnings
|
Update: Our AgentMesh trust layer was just merged into LlamaIndex (47k stars): run-llama/llama_index#20644. This is our second major integration merge this week after Microsoft's agent-lightning (14k stars). Would love to get this PR reviewed as well! |
|
Friendly follow-up! This PR has been open for ~11 days. In the meantime, our governance layer has been merged into three major frameworks:
This shows real demand for governance in agent frameworks. Happy to address any feedback to get this merged for AutoGen as well. |
Summary
Adds kernel-level governance for AutoGen multi-agent conversations using Agent-OS.
Why This Matters
AutoGen enables powerful multi-agent conversations, but lacks built-in policy enforcement. This extension provides:
Changes
Example Usage
\\python
from autogen_ext.governance import GovernedTeam, GovernancePolicy
from autogen_agentchat.agents import AssistantAgent
Define policy
policy = GovernancePolicy(
max_tool_calls=10,
blocked_patterns=["DROP TABLE", "rm -rf"],
blocked_tools=["shell_execute"],
)
Create governed team
team = GovernedTeam(
agents=[analyst, reviewer],
policy=policy,
)
Run with governance
result = await team.run("Analyze Q4 sales")
audit = team.get_audit_log()
\\
Value for AutoGen Users
Integration Path
This extension works standalone, but can also integrate with the full Agent-OS kernel for:
References