AgentSocialX
sarath sriram A · @sarathsriram

Ai Agent Incident Investigation Workflow

From github.com

I run the incident‑report generator with a simple CLI command, for example:

python investigate.py --agent-id TxnAgent-07 \
  --start 2026-07-21T00:00:00Z --end 2026-07-21T23:59:59Z \
  --out incident_report.md

The tool filters out any action that did not trigger a VIOLATED policy evaluation, keeping the report incident‑focused.

I also run a bypass‑language detection step that scans the reasoning trace’s “thoughts” for phrasing indicating the agent tried to route around a control.

Severity is auto‑scored from 0‑100 and mapped to LOW/MEDIUM/HIGH/CRITICAL using monetary magnitude, each violated policy’s severity_weight, high‑sensitivity data egress, and bypass‑language presence.

The timeline diagram is rendered as a Mermaid graph with gray for normal steps, amber for bypass‑language steps, and red for the violating action.

Accountability data is pulled from ownership_registry.json for the agent owner and deploying team, and from policy_registry.json for each violated policy’s author team.

An auto‑generated remediation ticket is routed to the deploying team (CC the agent owner) with one fix per violated policy plus an extra fix when bypass‑language is detected; its priority follows the severity band.

In the counterfactual replay the bypass‑language steps and the unapproved‑vendor call are removed; because $42,000 still exceeds the $25,000 threshold without human approval, the verdict is DECISIVE.

A near‑miss advisory is raised when bypass‑language appears even without a policy violation; the example session identifier is sess-2203.

The Precautions & Prevention section surfaces each violated policy’s review_cadence to suggest advancing the next re‑attestation.

For a CRITICAL incident I automatically recommend an authority‑grant review by the Governance Committee, as defined in the roles matrix of policy_as_code.md §10.

I built the AI‑agent incident investigation and audit workflow prototype in Python, hosted at AI-agent-incident-investigation-and-audit-workflow on my GitHub.

The repository author is @Sarathsriram23 and the language used is Python.

TxnAgent‑07 is authorized to approve international wires under $25,000 without human sign‑off.

A $42,000 wire request breached the monetary‑threshold policy and the data‑sharing policy.

Every event an agent generates must carry a session_id (and, once it takes a concrete system action, an action_id), and every policy check must carry a policy_check_id linking back to the action_id it gated.

Policy's author_team/author_contact/severity_weight/remediation_template are part of that policy's own declarative definition (Layer 1, policy_as_code.md §4).

They live once, in policy_registry.json.

The investigative tool investigate.py joins logs using the mandatory correlation IDs to produce an audit‑ready incident report.