• Home
  • Blog
  • AI Tools
  • How to Use Agentic AI to Automate Incident Response: A Prompt Tutorial

How to Use Agentic AI to Automate Incident Response: A Prompt Tutorial

Updated at Sep 19, 2025

9 min


How to Use Agentic AI to Automate Incident Response: A Prompt Tutorial

Agentic AI is changing how SOCs work—moving from static playbooks to autonomous, goal-driven agents that can detect, triage, and respond to threats with minimal human friction. In this practical, solution‑oriented tutorial, you’ll learn how to design prompts, guardrails, and workflows that align with industry standards while safely automating incident response.
We’ll map each step to the NIST incident response lifecycle, integrate with SIEM/SOAR, and give you copy‑paste prompt patterns you can adapt today.
By the way: organizations are already experimenting with agentic AI to enrich incidents from asset inventories and accelerate root-cause investigation, and early write‑ups highlight concrete use cases such as automated triage and analyst‑like investigations, plus end‑to‑end incident automation concepts. Your job is to make it real—safely, audibly, repeatably.

What is agentic AI in incident response?

  • Agentic AI uses autonomous, goal‑seeking LLM agents that can perceive (ingest logs, alerts, context), reason (correlate events, hypothesize root cause), and act (trigger containment, request approvals, open tickets).
  • Instead of rigid playbooks, you define objectives, tools, and constraints. The agent plans and executes within guardrails.
  • The goal: reduce MTTD/MTTR while keeping humans in control at key decision points.

Anchor to a standard: NIST incident response lifecycle

The NIST Computer Security Incident Handling Guide defines four phases: Preparation; Detection & Analysis; Containment, Eradication & Recovery; and Post‑Incident Activity. A newer draft revision continues to emphasize programmatic integration of response considerations across the lifecycle. We’ll align our agent prompts and controls to these phases and complement them with playbook thinking consistent with SOAR best practices, along with contemporary guidance on incident automation rollouts and federal playbook structures.

Architecture at a glance

  • Event sources: SIEM alerts, EDR telemetry, IAM logs, email security, cloud audit logs.
  • Orchestration: SOAR or workflow engine (approval gates, audit trail, vault secrets).
  • Agentic layer: LLM agent(s) with tool access (log query, CMDB/asset graph, ticketing, containment actions, knowledge base search).
  • Guardrails: RBAC, scoped API keys, read‑only by default, human‑in‑the‑loop for impact actions, policy‑aware prompts, and safety checks.
Tip: Start with read‑only “advisor mode,” then graduate to “suggested actions,” and only then to “auto‑contain with approval.”

Prompt tutorial: building blocks you can copy and adapt

Below are modular prompt patterns you can compose into an agent. Treat each as a function with strict inputs/outputs. Use JSON schemas to make responses machine‑actionable.

1) System prompt: role, objectives, constraints

You are a Security Incident Response Agent operating under NIST IR phases: Preparation; Detection & Analysis; Containment, Eradication & Recovery; Post-Incident Activity.
Primary objectives: minimize MTTR, reduce false positives, preserve evidence, follow least-privilege and change-control.
Constraints:
- Never execute containment without explicit approval unless policy says P0 auto-contain.
- Use tools only as documented. If data is insufficient, request specific evidence.
- Produce all outputs as strict JSON per the schema provided.
- Cite data sources (log queries, alert IDs). Maintain chain-of-custody notes.
- Escalate when confidence < 0.7 or blast radius uncertain.
Policies:
- Severity mapping, P0–P4.
- Data handling (PII redaction), regulatory notifications triggers.
- Critical assets list; business hours change windows.

2) Evidence request prompt: targeted data acquisition

Task: Build minimal evidence set to confirm or dismiss the alert.
Inputs: {"alert_type":"impossible_travel","principal":"[email protected]","alert_id":"A-17292"}
Output JSON schema:
{
"queries": .
- Pilot plan: begin in advisory mode; run tabletop exercises; instrument audit logs for every agent decision. Contemporary guidance stresses incremental rollout, measurable KPIs, and clear ownership.
### Phase 2: Detection & Analysis
- Trigger: SIEM high‑fidelity alert.
- Agent runs the Evidence Request prompt, enriches with asset/user context, and produces a Triage determination.
- Chain of custody: link every claim to queries and alert IDs; preserve raw logs.
- Note: Agentic enrichment tied to asset inventory accelerates clarity on where a threat lives.
### Phase 3: Containment, Eradication & Recovery
- Agent proposes a policy‑aware plan with pre‑checks, rollback, approvals.
- SOAR enforces gates; the agent cannot act without required approvals unless policy allows P0 auto‑contain.
- All actions sent through orchestration for execution, logging, and notifications, following playbook format seen in public‑sector guidance.
### Phase 4: Post‑Incident Activity
- Agent compiles a structured after‑action report, updates detection rules, and proposes control improvements aligned with NIST’s emphasis on programmatic improvement.
---
## Turn these patterns into working prompts for real incidents
Below are three high‑value playbooks with ready‑to‑use prompts.
### A) Account takeover (cloud identity)
1) Trigger context to agent
Alert: Multiple successful logins from atypical geo; token refresh spike. Principal: [email protected] (VIP) Assets: Office365, Salesforce; MFA: enabled; Risk score: high
2) Agent prompt: Evidence gathering
Produce queries for:
  • IdP sign-in logs last 48h (IP, geo, MFA result, device ID)
  • OAuth token issuance and refresh for the user
  • Email forwarding rule changes
  • Impossible travel velocity (>500 mph threshold) Return JSON as per Evidence schema.
3) Agent prompt: Triage & plan
Using collected evidence, output determination and plan. If confidence ≥ 0.8 and tokens active from two countries, recommend: revoke sessions, reset password, disable forwarding rules, notify user. Include approvals: IR lead + SaaS owner. Provide rollback.
4) Approval summary prompt
Summarize in ≤120 words: what happened, confidence, effect on email/SaaS, action list, rollback, ETA. Tone: calm, specific.
### B) Malware execution on endpoint
1) Trigger context
Alert: EDR detects suspicious PowerShell spawn from Office, beacon-like DNS. Host: ENG-LAP-23, user: bob, asset criticality: medium.
2) Evidence gathering
Queries:
  • Process tree (parent-child), command-line args
  • DNS queries and destinations, blocklist reputation
  • File hash reputation (VT), autoruns, persistence artifacts
  • Lateral movement attempts (WinRM, SMB)
3) Triage & containment plan
If process tree shows Office → PowerShell → encoded command contacting suspicious domain, set determination true_positive, severity P1. Recommend: isolate endpoint, kill process, quarantine file, collect volatile memory. Pre-checks: confirm not a build server; verify user not on-call.
### C) Suspicious data egress (S3/Blob)
1) Trigger context
CloudTrail shows GetObject events > 10,000 in 30 min from unusual IP, role: data-analytics-lambda.
2) Evidence gathering
Queries:
  • IAM role last modified, attached policies
  • Source IP ownership (cloud vs residential)
  • Object prefixes accessed; classification labels
  • Recent code changes to Lambda, env vars
3) Plan
If confidence ≥ 0.75 and data labeled confidential, propose: disable access keys/role, block IP, snapshot bucket policy, notify DPO if thresholds crossed. Approvals: Cloud security lead + Data owner. Rollback defined.
---
## Guardrails that make or break your deployment
- Principle of least privilege: agents start read‑only. Grant action scopes per playbook.
- Approval gates: containment and irreversible changes require named approvers.
- Deterministic outputs: JSON schemas for every agent step; reject free‑form.
- Source‑of‑truth linking: every claim is traceable to a query/alert ID.
- Audit & forensics: complete action logs, evidence hashes, timestamps.
- Fail‑safe modes: time‑boxed attempts, escalate on uncertainty, stop on conflicting signals.
- Red‑team your agent: simulate prompt injection, tool misuse, hallucinated commands.
Industry examples emphasize environment‑aware enrichment and SOC‑like automation patterns.
---
## Integrating with SIEM/SOAR: best practices
- Use SOAR to enforce approvals, secrets management, retries, and idempotency.
- Keep playbooks modular: detection, enrichment, decision, action, rollback.
- Maintain a library of action adapters (IdP revoke, EDR isolate, firewall block).
- Start with low‑risk automations (ticket creation, evidence gathering) and measure MTTR improvements before granting action scopes—an approach aligned with modern automation rollouts.
- Codify playbooks that mirror public‑sector structures to aid auditability and training.
---
## Example tool stack
- LLMs/agents: enterprise‑grade models with function calling and policy controls.
- Data: SIEM, EDR, IdP, DLP, cloud logs; CMDB/asset graph; ticketing; KB.
- Orchestration: SOAR/workflow engine for tool execution and audit trails.
- Observability: dashboards for MTTD/MTTR, false positive rate, automation coverage.
Tip: Choose models that support structured outputs and tool‑use constraints; keep prompts and policies version‑controlled.
---
## Metrics and SLOs for agentic incident response
- MTTD/MTTR by incident type and severity.
- % of alerts auto‑triaged to a determination with ≥0.8 confidence.
- Approval latency for containment steps; rollback success rate.
- Precision/recall for triage decisions against gold‑labeled incidents.
- Human time saved per alert; analyst satisfaction scores.
---
## Training the agent with your context
- Feed it sanitized historical incidents, labeled with outcomes and the minimal evidence needed to decide.
- Provide policy docs, asset tiers, and risk registers.
- Add retrieval‑augmented generation (RAG) over your KB; ground answers in citations to reduce hallucinations.
- Regularly retrain on new incidents and post‑mortems; prune outdated rules.
---
## Common pitfalls (and how to avoid them)
- Over‑automation: start advisory‑only; move gradually to action scopes.
- Missing guardrails: require approvals and pre‑checks; codify rollback.
- Unverifiable outputs: enforce JSON schemas; reject free‑text.
- Context starvation: wire CMDB, IdP, EDR, and ticketing into the agent.
- Prompt drift: version prompts; add regression tests using replayed incidents.
---
## Quick‑start checklist
- Define 3–5 incident types to automate first (phishing, ATO, malware, data egress).
- Write system prompt + schemas; create evidence/triage/plan prompts.
- Connect read‑only tools; run tabletop tests.
- Measure MTTR; then enable “suggested actions.”
- Add approval gates; enable limited auto‑contain for P0s.
- Ship post‑incident reports and detection updates.
---
## Worth noting: using [Sider.AI](https://sider.ai) to speed up your build
If you’re drafting prompts, testing variants, and documenting playbooks, a coding‑friendly AI assistant can help you iterate faster. For example, you can:
- Generate JSON schemas and validate agent outputs.
- Convert SOPs into structured prompts with approval logic.
- Summarize raw logs into analyst‑ready briefs with citations.
It’s a strong fit for drafting, testing, and documenting prompts and reports.
---
## Conclusion: from playbooks to policies‑as‑prompts
Agentic AI can compress response times by automating the grind: evidence gathering, triage, and policy‑aware planning. The key is to anchor agents to NIST phases, enforce SOAR approvals, and make every output structured, cited, and auditable. Start small, measure ruthlessly, and scale to higher‑impact actions only when the data—and your guardrails—say you’re ready.
Key takeaways:
- Treat prompts as code: version them, test them, review them.
- Keep humans in control with approvals and rollbacks.
- Align to standards and documented playbooks with clear audit trails.
- Use structured outputs and citations to build trust.
- Start advisory‑only; earn your way to automation.
### FAQ
Q1:What is agentic AI in incident response?
Agentic AI uses autonomous, goal-driven LLM agents to perceive, reason, and act on security events under strict guardrails. It automates evidence gathering, triage, and policy-aware containment while keeping humans in the loop, aligning to NIST IR phases[^4](https://nvlpubs.nist.gov/nistpubs/specialpublications/nist.sp.800-61r2.pdf).
Q2:How do I align agentic AI with NIST 800-61?
Map prompts and tools to each phase: preparation (policies, playbooks), detection and analysis (triage schemas), containment and recovery (approval-gated plans), and post-incident reporting. The approach mirrors guidance in NIST SP 800-61 and its ongoing updates[^4](https://nvlpubs.nist.gov/nistpubs/specialpublications/nist.sp.800-61r2.pdf)[^5](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-61r3.pdf).
Q3:What SOAR best practices apply to agentic automation?
Use SOAR for approvals, secrets, retries, and audit logs; keep playbooks modular and idempotent; and start with low-risk automations. These practices are consistent with well-known SOAR guidance and public playbook structures[^8](https://www.cynet.com/incident-response/security-orchestration-automation-and-response-soar-a-quick-guide/)[^9](https://www.cisa.gov/sites/default/files/2024-08/Federal_Government_Cybersecurity_Incident_and_Vulnerability_Response_Playbooks_508C.pdf).
Q4:Where should I start automating with agentic AI?
Begin with advisory mode on high-volume alerts like phishing triage or impossible travel. Measure MTTR and precision, then progress to suggested actions and limited auto-containment with clear approval gates[^7](https://multishoring.com/blog/best-practices-for-implementing-incident-response-automation/).
Q5:What are the biggest risks with agentic AI in a SOC?
Uncontrolled actions, hallucinated commands, and lack of auditability. Avoid them with least privilege, approval gates, structured outputs, citations to data sources, and red-team testing of prompts and tools. Real-world discussions emphasize environment-aware enrichment and SOC-grade discipline[^1](https://www.ibm.com/new/product-blog/revolutionizing-incident-management-with-agentic-ai)[^2](https://research.aimultiple.com/agentic-ai-cybersecurity/).