Commit 3bbc7e9
feat(autogen): add native GovernanceInterventionHandler via AutoGen v0.4+ hooks (microsoft#1591)
Replace fragile monkey-patching with AutoGen's native intervention
handler system (DefaultInterventionHandler with on_send, on_publish,
on_response) introduced in AutoGen v0.4+.
Changes:
- Add GovernanceInterventionHandler class with three hooks:
- on_send: tool call governance, content filtering, PII detection
- on_publish: broadcast message governance
- on_response: output content filtering, drift detection
- Add AutoGenKernel.as_handler() factory method as the recommended
integration path
- Deprecate govern() and wrap() with DeprecationWarning pointing to
as_handler()
- Export AutoGenGovernanceHandler from integrations package
- Add 51 new tests covering all three hook types, Cedar/OPA integration,
deprecation warnings, PII detection, and backward compatibility
- All 18 existing AutoGen regression tests pass unchanged
Co-authored-by: Nishar <you@example.com>1 parent 7dab9c1 commit 3bbc7e9
3 files changed
Lines changed: 1118 additions & 18 deletions
File tree
- agent-governance-python/agent-os
- src/agent_os/integrations
- tests
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| |||
173 | 176 | | |
174 | 177 | | |
175 | 178 | | |
| 179 | + | |
176 | 180 | | |
177 | 181 | | |
178 | 182 | | |
| |||
0 commit comments