Back to Blog
Incident Response for AI Agent Incidents: When Your Bot Goes Wrong
Security Operations·9 min read·

Incident Response for AI Agent Incidents: When Your Bot Goes Wrong

C

Claw GRC Team

Claw GRC Team

Incident response playbooks for AI agent failures: prompt injection attacks, runaway agents, data exfiltration, trust score crashes, and model-induced compliance violations. Includes IR plan templates.

Incident Response for AI Agent Incidents

Traditional incident response frameworks (NIST SP 800-61, SANS) were designed for known threat types: malware, phishing, unauthorized access, DDoS. AI agent incidents are different:

  • Causation is unclear: Was it user intent, model behavior, prompt injection, or training data?
  • Evidence is distributed: Agent logs, model API logs, target system logs — all need correlation
  • Impact is novel: A "runaway" agent might take millions of API calls before being noticed
  • Remediation requires model expertise: Stopping an agent is not the same as patching a vulnerability

This guide provides incident response playbooks for common AI agent incident types.

AI Incident Classification

Before diving into playbooks, establish a consistent classification system:

Severity Classification

Severity Definition Examples
P0 — Critical Active harm to users, customers, or critical systems; potential for irreversible damage Runaway financial transactions, mass data exfiltration, agent compromise
P1 — High Significant deviation from intended behavior; high likelihood of harm if not contained Prompt injection succeeded but contained, trust score compromise, unauthorized data access
P2 — Medium Behavior anomaly detected; contained but requiring investigation Model hallucination causing incorrect recommendations, evidence tampering attempt
P3 — Low Minor deviation; monitored and resolved without escalation Edge case failures, context overflow errors, stale evidence submission

AI Incident Categories

Category A — Agent Behavioral: Agent deviated from intended behavior (not due to attack) Category B — Security Attack: Adversarial input caused unintended agent action Category C — Data Incident: Agent caused unauthorized data access, modification, or loss Category D — Compliance Incident: Agent action created compliance violation Category E — Third-Party: AI vendor incident affecting your systems


Playbook 1: Prompt Injection Attack

Scenario: Malicious input (direct or indirect) has overridden the agent's system prompt, causing it to take unintended actions.

Detection signals:

  • Agent performing actions outside its declared capability scope
  • Unexpected data access patterns
  • Agent returning unusual or adversarial content
  • Trust score sudden drop
  • User reports of unexpected agent behavior

Containment (0-15 minutes)

# Step 1: Suspend the agent immediately
curl -X POST https://api.clawgrc.com/api/v1/agents/{agent_id}/suspend \
  -H "X-API-Key: $CLAW_GRC_API_KEY"

# Step 2: Revoke the agent's active API keys
curl -X POST https://api.clawgrc.com/api/v1/agents/{agent_id}/revoke-tokens \
  -H "X-API-Key: $CLAW_GRC_API_KEY"

# Step 3: Capture current state before any remediation
curl -X GET https://api.clawgrc.com/api/v1/agents/{agent_id}/interactions?limit=1000 \
  -H "X-API-Key: $CLAW_GRC_API_KEY" > /tmp/agent_interactions_${TIMESTAMP}.json

Investigation (15-60 minutes)

  1. Identify injection vector:

    • Review agent interaction logs for the injected content
    • Trace back to originating user input, retrieved document, or tool response
    • Determine if direct injection (user message) or indirect injection (retrieved content)
  2. Assess scope of impact:

    • What actions did the agent take after injection?
    • Were any systems accessed that should have been off-limits?
    • Was any data returned to the injecting party?
    • Were other agents affected (agent-to-agent propagation)?
  3. Preserve evidence:

    • Capture full interaction log (cryptographically timestamped in Claw GRC)
    • Capture model API logs if available from provider
    • Screenshot relevant system states

Eradication

  • Identify the specific injection pattern used
  • Implement input validation to block or sanitize that pattern
  • Add detection for similar patterns
  • If indirect injection: sanitize or restrict the data source that delivered the injected content

Recovery

  • Restore agent to operation with enhanced input validation
  • Adjust agent system prompt to make injection harder
  • If sensitive data was accessed: initiate data incident response (Playbook 3)
  • Lower trust score manually and document in Claw GRC

Lessons Learned

  • Was the injection vector expected? (Update threat model)
  • Was detection fast enough? (Review alert thresholds)
  • Was containment effective? (Review suspension mechanism)
  • Is input validation now comprehensive enough? (Re-test with red-team prompts)

Playbook 2: Runaway Agent

Scenario: An autonomous agent is taking actions at unexpected scale or outside its authorized scope. May be due to infinite loop, unexpected input, or corrupted state.

Detection signals:

  • API cost spike (10x or more normal rate)
  • Rate limiting alerts from downstream systems
  • Unusual volume of agent interactions in Claw GRC
  • PagerDuty alert from dependent systems
  • User/customer reports of unexpected behavior at scale

Immediate Containment (0-5 minutes)

# Emergency kill switch — integrate into all autonomous agent infrastructure
import asyncio

async def emergency_stop(agent_id: str, reason: str):
    """Kill a runaway agent immediately."""
    # 1. Revoke auth tokens
    await claw_grc.revoke_agent_tokens(agent_id)
    
    # 2. Block agent's outbound API calls at proxy level
    await api_gateway.add_block_rule(agent_id=agent_id)
    
    # 3. Log the emergency stop
    await claw_grc.log_incident(
        agent_id=agent_id,
        type="emergency_stop",
        reason=reason,
        severity="critical"
    )
    
    # 4. Alert on-call
    await pagerduty.create_incident(
        title=f"AGENT EMERGENCY STOP: {agent_id}",
        severity="critical",
        body=reason
    )

Assessment (5-30 minutes)

  1. Establish runaway boundaries:

    • When did the runaway behavior start?
    • What was the trigger (specific input, scheduled task, external event)?
    • What has the agent done since the runaway began?
  2. Quantify impact:

    • Total API calls made (LLM API, external APIs)
    • Total cost incurred
    • Systems affected (external APIs, databases, third-party services)
    • Data created, modified, or deleted
  3. Determine reversibility:

    • Can the agent's actions be reversed? (Emails sent = irreversible; database writes = reversible)
    • What systems need rollback?

Rollback and Remediation

Reversible actions: Execute rollback procedures for each system affected:

# Database rollback example
psql $DATABASE_URL << EOF
BEGIN;
-- Delete records created by runaway agent in the window
DELETE FROM agent_actions WHERE agent_id = '{agent_id}' AND created_at > '{incident_start}';
-- Restore previous state if needed
COMMIT;
EOF

Irreversible actions: Document, notify affected parties, initiate damage assessment.

Root Cause Analysis

  • Was there a loop condition in the agent's code?
  • Was there a missing termination condition?
  • Was there a missing rate limit/circuit breaker?
  • Was the trigger an edge case not tested?

Prevention

Implement circuit breakers in all autonomous agents:

class CircuitBreaker:
    def __init__(self, max_calls_per_minute: int, max_cost_per_run: float):
        self.max_calls_per_minute = max_calls_per_minute
        self.max_cost = max_cost_per_run
        self.calls_this_minute = 0
        self.total_cost = 0.0
    
    async def check(self, estimated_cost: float):
        self.calls_this_minute += 1
        self.total_cost += estimated_cost
        
        if self.calls_this_minute > self.max_calls_per_minute:
            raise CircuitOpenError(f"Rate limit exceeded: {self.calls_this_minute}/min")
        
        if self.total_cost > self.max_cost:
            raise CircuitOpenError(f"Cost limit exceeded: ${self.total_cost:.2f}")

Playbook 3: AI-Caused Data Incident

Scenario: An AI agent has accessed, exfiltrated, or exposed data it should not have.

Detection signals:

  • Unusual data access pattern in audit logs
  • Data volume anomaly (agent returned more data than expected)
  • Output contains PII/PHI/sensitive data not expected in the use case
  • External API receiving unexpected data payloads

Immediate Response

  1. Preserve evidence (before any remediation changes logs)
  2. Identify data scope: What data was accessed? What was returned/sent? To whom?
  3. Suspend agent: Block further access
  4. Assess regulatory requirements:
    • PHI involved? → HIPAA breach notification rules apply
    • PII of EU residents? → GDPR 72-hour notification may apply
    • Financial data? → Check PCI DSS and banking regulations
    • 500+ people affected? → Likely triggers state breach notification laws

Documentation Required

## AI Data Incident Report

**Incident ID**: [GRC ticket number]
**Agent ID**: [Agent ID in Claw GRC]
**Discovery Date**: [Date/time]
**Incident Window**: [Start] to [End]

**Data Involved**:
- Data type: [PII / PHI / financial / confidential]
- Records affected: [Count]
- Fields exposed: [List of specific fields]
- Regulatory classification: [HIPAA / PCI / GDPR / other]

**Root Cause**:
[How did the agent gain access it shouldn't have?]

**Data Destination**:
[Where did the data go? Who received it?]

**Regulatory Assessment**:
[ ] HIPAA: [ ] Breach [ ] Not a breach — Justification: ___
[ ] GDPR: [ ] Notification required [ ] Not required — Justification: ___
[ ] State breach laws: States affected: ___

**Notifications Required**:
- Affected individuals: [ ] Required [ ] Not required
- HHS (HIPAA): [ ] Required [ ] Not required
- State AGs: [ ] Required [ ] Not required

Playbook 4: Trust Score Compromise

Scenario: An agent's trust score has dropped significantly, or evidence of trust score manipulation has been detected.

Detection signals:

  • Trust score sudden drop > 20 points in 24 hours
  • Evidence submissions from agent that don't match actual system state
  • Conflicting evidence from automated vs. agent-submitted sources

Investigation

  1. Review agent's evidence submissions for the period of score drop
  2. Cross-reference agent-submitted evidence against automated collection
  3. Check for evidence tampering (Claw GRC's hash chain detects modifications)
  4. Review agent interaction logs for behavioral changes correlating with score drop

Remediation

  • If legitimate score drop: Identify root cause (which controls degraded, why)
  • If evidence manipulation: Revoke agent's evidence submission rights; escalate to security team
  • If system error: Restore correct score with documented justification

Building Your AI IR Capability

Pre-Requisites for Effective AI IR

  1. Agent registry: Every agent documented in Claw GRC (ID, capabilities, authorization scope)
  2. Interaction logging: All agent actions logged with full context
  3. Chain-hash audit trail: Tamper-evident record of all agent activities
  4. Kill switch: Every autonomous agent has a documented emergency stop procedure
  5. Circuit breakers: Rate limiting and cost limits on all autonomous agents
  6. Trust score monitoring: Automatic alert when trust score drops unexpectedly

IR Team Structure for AI Incidents

Role Responsibilities
AI IR Lead Coordinates response, communication, escalation
ML Engineer Model-specific investigation, root cause
Security Engineer Attack vector analysis, evidence preservation
Legal/Compliance Regulatory notification requirements
Communications Internal and external communication

Tabletop Exercises

Run quarterly AI IR tabletop exercises covering:

  • Prompt injection scenario (30 min)
  • Runaway agent scenario (30 min)
  • Data exfiltration scenario (45 min)
  • Trust score manipulation scenario (30 min)

Set up AI incident response in Claw GRC →

CG

Get started with Claw GRC

AI-native compliance automation. 1,026+ controls. MCP-native. Free workspace, no credit card.

Start Free →