Engineering

How AI Agents Learn to Investigate Security Alerts

Building AI that can autonomously investigate security incidents requires more than just machine learning. Here's how we teach AI agents to think like security analysts.

January 20, 2025
12 min read
FortMind Engineering Team·AI & Security Research

When we tell people that FortMind uses AI agents to autonomously investigate security alerts, the most common question we get is: "How do you teach AI to think like a security analyst?"


It's a great question—and the answer is more nuanced than "we trained a model on incident data."


Building truly autonomous security investigation requires solving challenges at the intersection of AI research, security operations, and distributed systems engineering. This post pulls back the curtain on how we do it.


The Challenge: Security Investigation Isn't a Classification Problem


Most AI applications in security follow a familiar pattern:


1. Collect labeled training data (malicious vs. benign)

2. Train a classifier model

3. Apply the model to new data

4. Output a prediction and confidence score


This works well for specific tasks: malware detection, phishing identification, anomaly detection.


But security investigation is fundamentally different. An analyst investigating an alert doesn't just classify it as "malicious" or "benign." They:


  • Gather context: What user account is involved? What's their normal behavior? What system generated this alert?
  • Form hypotheses: Could this be a compromised account? A misconfiguration? A false positive?
  • Collect evidence: Query additional logs, check threat intelligence, examine related events
  • Reason through scenarios: If this is account compromise, we'd expect to see X, Y, and Z
  • Reach conclusions: Based on the totality of evidence, this is/isn't a genuine threat
  • Determine next steps: Escalate, remediate, or close

  • This isn't classification—it's multi-step reasoning under uncertainty. And it requires a fundamentally different AI approach.


    Our Approach: Agent-Based Reasoning


    At the core of FortMind is what we call an Investigative AI Agent: an autonomous system that can plan, execute, and adapt security investigations.


    Key Components


    1. Perception Layer: Understanding Alerts in Context

    When an alert arrives, the first challenge is understanding what it means. Not just "failed login attempt" but:


  • Who is this user, and what's their role?
  • Where are they normally located?
  • What systems do they typically access?
  • Have they had failed logins before, and if so, when and why?
  • Are there other alerts involving this user or system?

  • We don't pre-compute this context for every possible alert (that would be prohibitively expensive). Instead, our agent dynamically gathers relevant context based on the specific alert it's investigating.


    Technical Implementation:

    perception_module = {

    entity_resolver: Extract entities (users, IPs, hosts, files) from alert

    context_collector: Gather relevant historical and current data about each entity

    relationship_mapper: Identify connections between entities across data sources

    baseline_analyzer: Compare current behavior to established baselines

    }


    2. Reasoning Engine: Hypothesis-Driven Investigation

    Once the agent understands the alert context, it needs to reason about what might be happening.


    Human analysts do this instinctively: "If this is a compromised account, I'd expect to see lateral movement or privilege escalation. Let me check..."


    We formalize this as hypothesis generation and testing:


    
    

    # Simplified example of hypothesis-driven reasoning

    def investigate_failed_login_alert(alert):

    # Generate potential hypotheses

    hypotheses = generate_hypotheses(alert)

    # Example hypotheses:

    # - H1: Credential stuffing attack

    # - H2: User forgot password

    # - H3: Account takeover attempt


    # For each hypothesis, determine what evidence would support/refute it

    for hypothesis in hypotheses:

    evidence_requirements = define_evidence(hypothesis)


    # Collect that evidence

    evidence = collect_evidence(evidence_requirements)


    # Update hypothesis probability

    hypothesis.update_probability(evidence)


    # Select most likely explanation

    conclusion = select_best_hypothesis(hypotheses)

    return conclusion


    Key Innovation: The agent doesn't execute a fixed investigation playbook. It dynamically generates hypotheses based on the specific alert, determines what evidence would confirm or refute each hypothesis, and adaptively collects that evidence.
    3. Knowledge Base: Security Domain Expertise

    To reason effectively about security incidents, the agent needs to "know" about:


  • Attack patterns: MITRE ATT&CK techniques, common adversary TTPs
  • Your environment: What's normal vs. anomalous for your specific infrastructure
  • Threat intelligence: Known IOCs, emerging campaigns, vulnerability exploits
  • Security controls: What defenses are in place and how attackers bypass them

  • We represent this knowledge using a combination of:


  • Structured knowledge graphs: Relationships between TTPs, tools, and threat actors
  • Behavioral baselines: Statistical models of normal behavior for entities in your environment
  • Reasoning rules: Formal logic for inferring higher-level conclusions from low-level signals

  • 4. Action Engine: Dynamic Investigation Execution

    The agent doesn't just think about what to do—it actually does it:


  • Query log sources (SIEM, EDR, cloud logs)
  • Check threat intelligence feeds
  • Examine file hashes and network connections
  • Correlate across time windows and data sources
  • Invoke enrichment APIs
  • Execute containment actions (when authorized)

  • Critically, the agent's action sequence isn't hardcoded. It's planned dynamically based on:


  • The current investigation state
  • What evidence has been collected so far
  • What hypotheses remain plausible
  • What data sources are available

  • 5. Learning Loop: Continuous Improvement

    Every investigation is a learning opportunity. After each alert:


    learning_module = {

    outcome_validation: Was this a true positive? False positive? How confident are we?

    pattern_extraction: What signals were most predictive of the outcome?

    baseline_updates: Update entity behavior baselines with new observations

    model_refinement: Adjust hypothesis generation and evidence weighting

    }


    The agent gets better at investigating your specific environment over time:

  • Which alert types in *your* environment tend to be false positives
  • What investigation paths are most efficient for *your* infrastructure
  • How attackers have historically targeted *your* industry

  • Training Autonomous Investigators: The Technical Details


    How do you actually build an AI agent that can do all of this? Here's our technical approach:


    1. Foundation: Large Language Models for Reasoning


    We use state-of-the-art language models as the reasoning engine. Why?


  • Flexible reasoning: LLMs can perform multi-step logical reasoning without explicit programming
  • Domain knowledge: Pre-trained on vast security literature, documentation, and code
  • Natural language understanding: Can interpret unstructured security data (logs, reports, documentation)

  • But raw LLMs aren't enough. They need to be:


  • Grounded in facts: Connected to real-time data from your environment
  • Constrained to valid actions: Can't hallucinate evidence or make up conclusions
  • Guided by security expertise: Augmented with domain-specific knowledge and reasoning

  • 2. Reinforcement Learning from Security Analyst Feedback


    We don't just train on labeled datasets. We use reinforcement learning where the agent learns from security analyst feedback:


    The RL Loop:

    1. Agent investigates alert and reaches conclusion

    2. Human analyst reviews investigation and provides feedback:

    - Was the conclusion correct?

    - Was the investigation thorough?

    - Were any steps unnecessary?

    - What evidence was most valuable?

    3. Agent updates its policy based on feedback

    4. Over time, learns to prioritize high-value investigation steps


    This approach has several advantages:


  • Learns from expertise: Captures how skilled analysts actually investigate
  • Adapts to your environment: Different organizations have different investigation priorities
  • Handles edge cases: Learns from rare but critical scenarios

  • 3. Multi-Agent Architecture


    Complex investigations often require multiple types of reasoning:


  • Triage Agent: Quick initial assessment—is this worth investigating?
  • Investigation Agent: Deep dive into confirmed suspicious activity
  • Threat Hunting Agent: Proactive search for related indicators
  • Remediation Agent: Determine and execute appropriate response actions

  • These agents cooperate and hand off to each other based on investigation needs.


    4. Safety Mechanisms


    Autonomous investigation is powerful, but it needs safeguards:


    Confidence thresholds: The agent knows when it doesn't know
  • High confidence conclusions are acted on automatically
  • Medium confidence conclusions are flagged for analyst review
  • Low confidence cases are escalated immediately

  • Human-in-the-loop for critical actions:
  • Evidence collection and analysis is fully automated
  • Containment actions (isolating systems, blocking IPs) require human approval
  • The agent explains its reasoning so analysts can make informed decisions

  • Audit trails:
  • Every investigation step is logged
  • Every decision is explainable
  • Every conclusion includes supporting evidence

  • Real-World Example: Investigating a Suspicious Login


    Let's walk through how FortMind's AI agent investigates a real alert:


    Alert: Failed login attempts from unusual location
    Human Investigation (Traditional SOC):

    1. Check user account details (5 min)

    2. Look up IP geolocation (2 min)

    3. Review recent user activity (10 min)

    4. Check if IP is known bad (3 min)

    5. Manually correlate with other users (15 min)

    6. Escalate or close (5 min)

    Total: 40 minutes (if the analyst gets to it immediately)
    AI Agent Investigation (FortMind):

    Timestamp: 2025-01-20 14:32:15 UTC


    [Perception] Parsed alert: Failed auth for user@company.com from 185.220.101.50

    [Context] User: Senior Account Manager, Finance team, normally accesses from US East Coast

    [Context] IP: Located in Romania, first seen in this environment

    [Context] Recent activity: User logged in successfully from home IP 2 hours ago

    [Hypothesis 1] Credential stuffing (probability: 0.45)

    Evidence for: Unusual geography, multiple failed attempts

    Evidence against: Targeted at single user, not mass campaign

    [Hypothesis 2] Account takeover (probability: 0.35)

    Evidence for: Unusual location, user's credentials may be compromised

    Evidence against: User has active session from legitimate location

    [Hypothesis 3] VPN misconfiguration (probability: 0.15)

    Evidence for: User may be traveling or using VPN

    Evidence against: Company VPN egress IPs are whitelisted, this IP is not in that range

    [Hypothesis 4] False positive (probability: 0.05)


    [Investigation] Checking for password spray patterns across environment...

    [Investigation] Found 12 other accounts with failed logins from same IP block

    [Investigation] Correlating timestamps... all attempts within 15-minute window

    [Investigation] Checking threat intelligence... IP in Tor exit node list


    [Conclusion] High confidence (0.87): Credential stuffing attack using Tor

    [Evidence]

    - 12 accounts targeted from same Tor exit node

    - Attack pattern consistent with credential stuffing campaigns

    - User's legitimate session still active from home IP

    - No successful logins from attacker IP


    [Recommendation] CLOSE as expected threat, successfully blocked

    [Action] Added IP block to watchlist for 30 days

    [Action] No user notification needed (credentials not compromised)


    Investigation time: 8 seconds


    The agent reached the same conclusion an expert analyst would—but in seconds instead of minutes, and with complete documentation of its reasoning.


    The Future: Toward Fully Autonomous SOC Operations


    We're still in the early stages of autonomous security. Current FortMind agents handle:


  • ✅ Alert triage and investigation
  • ✅ Evidence collection and correlation
  • ✅ Attack path mapping
  • ✅ Threat classification

  • Coming soon:


  • 🔄 Proactive threat hunting
  • 🔄 Automated containment and remediation
  • 🔄 Post-incident analysis and reporting
  • 🔄 Security control optimization

  • The goal isn't to replace security analysts—it's to make them more effective by handling the repetitive, time-consuming work of alert investigation, freeing them to focus on strategic security initiatives.


    Try It Yourself


    Want to see autonomous security investigation in action?


    Try our AdversaryAI™ Tool: Input your asset details and watch as AI maps realistic attack paths using MITRE ATT&CK techniques.
    Book a Demo: See how FortMind handles real-world alerts from your environment.
    Read our docs: Dive deeper into the technical architecture.

    ---


    *Have questions about autonomous security or AI agents? We'd love to discuss. Get in touch with our engineering team.*


    Tags:
    AIMachine LearningEngineeringAutonomous SecurityTechnical Deep Dive
    F

    FortMind Engineering Team

    AI & Security Research

    The FortMind team is building the industry's first truly autonomous security operations platform. We share insights on AI, security, and the future of SOC operations.

    Interested in Autonomous Security?

    See how FortMind's AI agents autonomously investigate security alerts, map attack paths, and eliminate alert fatigue.