-
Notifications
You must be signed in to change notification settings - Fork 327
docs: add guide for consuming audit reports with an agent #23958
Copy link
Copy link
Closed
Labels
auditclidocumentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request
Description
Parent Epic
Part of #22735
Summary
The audit commands produce rich structured output (JSON, markdown) that can be consumed programmatically by agents for automated analysis, optimization, and incident response. There is no guide showing users how to do this.
What to Create
File: docs/src/content/docs/guides/audit-with-agents.md
A task-oriented guide showing how to feed audit output into agentic workflows for automated analysis.
Sections
-
Why use an agent to consume audit data?
- Automated triage of findings across many runs
- Pattern recognition across audit reports
- Automated remediation suggestions (firewall rule updates, cost optimization)
-
Getting structured audit data
gh aw audit <run-id> --json— full JSON output to stdout- Key fields for agent consumption:
key_findings,recommendations,firewall_analysis,mcp_tool_usage,metrics - Using
jqto extract specific sections
-
Feeding audit data into a workflow agent
- Example: scheduled workflow that runs
gh aw audit report --json, passes output as context to an agent, and has the agent post a summary discussion - Example: PR-triggered workflow that runs
gh aw audit <run-id> --jsonpost-agent, feeds findings to a second agent for automated review comments - Example: using
audit diff --jsonto detect regressions and auto-file issues
- Example: scheduled workflow that runs
-
Building an audit monitoring agent
- Full workflow example: cron-triggered agent that:
- Runs
gh aw audit report --workflow <name> --last 10 --json - Analyzes trends (cost spikes, new blocked domains, MCP error rate increases)
- Posts a discussion or issue with findings
- Alerts on critical anomalies
- Runs
- Full workflow example: cron-triggered agent that:
-
Tips
- JSON schema stability expectations
- Combining with
--parsefor raw log analysis - Using
audit difffor before/after comparison in optimization workflows
Source Files to Reference
pkg/cli/audit_report.go—AuditDatastruct (the JSON schema)pkg/cli/audit_cross_run.go—CrossRunAuditReportstructpkg/cli/audit_diff.go—AuditDiffstruct.github/workflows/audit-workflows.md— existing audit agent workflow example
Reactions are currently unavailable
Metadata
Metadata
Labels
auditclidocumentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request
Type
Fields
Give feedbackNo fields configured for issues without a type.