feat: add GovernanceEventSink SPI — AGT as event producer for SIEM/XDR integration#1987
Open
Copilot wants to merge 4 commits into
Open
feat: add GovernanceEventSink SPI — AGT as event producer for SIEM/XDR integration#1987Copilot wants to merge 4 commits into
Copilot wants to merge 4 commits into
Conversation
1 task
…d Rust Implements the provider interface (SPI) pattern described by @Ricky-G: - IGovernanceEventSink / GovernanceEventSink protocol (one async method) - SignedGovernanceEvent: CloudEvents 1.0 envelope + HMAC-SHA256 signature - GovernanceEventCategory enum (policy.decision, policy.breach, identity.assertion, tool.invocation, sandbox.event, audit.chain) - OtlpEventSink: routes events to any OTLP-compatible backend - StdoutEventSink: JSON lines to stdout (dev/CI) - GovernanceKernel (.NET) wired to forward audit events via event sink - Tests for all four SDKs (34 Python, 28 .NET, 23 TypeScript, 11 Rust) Agent-Logs-Url: https://github.com/microsoft/agent-governance-toolkit/sessions/d8eaa113-2391-466d-be07-76a474899c47 Co-authored-by: imran-siddique <[email protected]>
…forget observability) - Rust: remove hardcoded HMAC fallback key, use .expect() for clarity - .NET: make fire-and-forget sink errors observable via System.Diagnostics.Trace Agent-Logs-Url: https://github.com/microsoft/agent-governance-toolkit/sessions/d8eaa113-2391-466d-be07-76a474899c47 Co-authored-by: imran-siddique <[email protected]>
Copilot
AI
changed the title
[WIP] Add OS-level enforcement in AI agent governance
feat: add GovernanceEventSink SPI — AGT as event producer for SIEM/XDR integration
May 11, 2026
| assert body["data"]["seq"] == 42 | ||
|
|
||
| def test_multiple_emits(self): | ||
| for cat in GovernanceEventCategory: |
| Args: | ||
| event: The signed governance event to forward. | ||
| """ | ||
| ... |
|
|
||
| import asyncio | ||
| import json | ||
| import sys |
| import asyncio | ||
| import json | ||
| import sys | ||
| from io import StringIO |
Comment on lines
+26
to
+33
| from agent_os.event_sink import ( | ||
| GovernanceEventCategory, | ||
| GovernanceEventSink, | ||
| OtlpEventSink, | ||
| SignedGovernanceEvent, | ||
| StdoutEventSink, | ||
| _hmac_sha256, | ||
| ) |
| SignedGovernanceEvent, | ||
| StdoutEventSink, | ||
| ) | ||
| except ImportError: |
| _HAS_OTEL_LOGS = True | ||
| _LogRecord = _LR | ||
| _SeverityNumber = _SN | ||
| except ImportError: |
PR Review Summary
Verdict: ⏳ Still running |
|
This PR is quite large. Consider breaking it into smaller PRs for easier review. |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
|
Proposal submitted for this, want to get Elton's view on this as well and then we can re-purpose this PR with the full implementation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Addresses the governance enforcement gap raised in the OS-level enforcement issue by implementing the provider-interface approach outlined by @Ricky-G: AGT becomes a structured event producer; enforcement backends (Defender, Falco, Tetragon, Sentinel, Splunk) act as sinks. No kernel code, no competing with EDR tools.
Core primitives (all four SDKs)
GovernanceEventCategory— 6 categories aligned with CloudEvents + OTEL conventions:policy.decision,policy.breach,identity.assertion,tool.invocation,sandbox.event,audit.chainSignedGovernanceEvent— CloudEvents 1.0 envelope with HMAC-SHA256 tamper-evidence signature ("{type}\n{source}\n{time}\n{id}\n{data_json}")GovernanceEventSink— single-method async interface/protocol; mirrors the existingSandboxProvidershapeReference sinks
OtlpEventSink— routes to any OTLP-compatible backend (Defender for Cloud, Sentinel, Splunk, Datadog, Honeycomb, Dynatrace, Grafana). No new deps: Python uses existing optional opentelemetry-sdk; .NET uses built-inActivitySource; TypeScript usesnode:http; Rust writes OTLP JSON to aWritetarget.StdoutEventSink— JSON lines to stdout; suitable for dev/CI and container log aggregators.NET kernel wiring
GovernanceOptionsgainsEventSinkandEventSigningKey. When set, the kernel bridges everyAuditEmitterevent to the sink as a signedSignedGovernanceEvent. Sink errors surface viaTrace.TraceError(observable, non-blocking).Threat model coverage
Type of Change
Package(s) Affected
Checklist
Attribution & Prior Art
Prior art / related projects (if any):
SandboxProviderpattern in this repoAI Assistance
IP, Patents, and Licensing
Related Issues