Splunk SPL for detecting Agentic AI

Detecting Agentic AI with Splunk: Practical SPL Prompts for Modern Security Teams

Introduction

Agentic AI is rapidly transforming the cybersecurity landscape. Unlike traditional artificial intelligence systems that operate within narrowly defined boundaries, agentic AI systems can plan, reason, make decisions, invoke tools, access external resources, and execute multi-step tasks with minimal human oversight. While these capabilities create tremendous business value, they also introduce new security risks.

Security Operations Centers (SOCs) are now challenged with detecting unauthorized AI usage, identifying potentially malicious autonomous behavior, preventing data leakage through AI systems, and monitoring interactions between AI agents and enterprise resources.

Splunk remains one of the most powerful platforms for detecting emerging threats, including those involving large language models (LLMs), AI copilots, autonomous agents, and AI-powered automation tools. This article provides practical Splunk Search Processing Language (SPL) prompts and detection strategies that security teams can implement today to identify agentic AI activity.


Understanding Agentic AI Behaviors

Before developing detections, it is important to understand the characteristics of agentic systems:

  • Autonomous decision-making
  • Sequential tool execution
  • API chaining
  • External data gathering
  • Code generation and execution
  • Automated account actions
  • Multi-step workflows
  • Persistent goal completion

From a detection perspective, these characteristics often manifest as:

  • Unusual API call patterns
  • Rapid execution of administrative actions
  • Automated browser activity
  • Excessive prompt submissions
  • High-volume outbound requests
  • Interaction with AI hosting services
  • Automated script creation and execution

Detection 1: Identify Access to Popular AI Services

Many organizations want visibility into employees accessing public AI platforms.

SPL Query

index=proxy OR index=web

(url_domain="chat.openai.com"

OR url_domain="claude.ai"

OR url_domain="gemini.google.com"

OR url_domain="copilot.microsoft.com"

OR url_domain="poe.com"

OR url_domain="perplexity.ai")

| stats count by user, src_ip, url_domain

| sort -count

Purpose

This search helps identify:

  • AI service adoption
  • Shadow AI usage
  • Departments frequently accessing AI platforms
  • Potential compliance concerns

Detection 2: Monitor Large Data Uploads to AI Services

One of the greatest concerns surrounding AI tools is sensitive data exposure.

SPL Query

index=proxy

(

url_domain="chat.openai.com"

OR url_domain="claude.ai"

OR url_domain="gemini.google.com"

)

bytes_out > 5000000

| stats sum(bytes_out) as uploaded by user, src_ip

| sort -uploaded

Purpose

Potential indicators include:

  • Intellectual property leakage
  • Source code uploads
  • Customer data exposure
  • Financial document sharing

Detection 3: Detect Automated API Consumption

Agentic AI commonly consumes APIs at a consistent, automated rate.

SPL Query

index=firewall

action=allowed

| bucket span=1m _time

| stats count by src_ip, dest_ip, _time

| eventstats avg(count) as avg_calls by src_ip

| where count > avg_calls*5

Purpose

This detection identifies:

  • AI agents continuously calling APIs
  • Automation abuse
  • Bot-like behavior
  • Potential autonomous workflows

Detection 4: Excessive OpenAI API Usage

Organizations leveraging enterprise AI should monitor API utilization.

SPL Query

index=proxy

url="api.openai.com"

| stats count by src_ip,user

| where count > 1000

| sort -count

Purpose

Helps uncover:

  • Agent deployment activity
  • Scripted AI interactions
  • Unauthorized AI applications
  • Cost-generating API abuse

Detection 5: AI-Generated PowerShell Execution

Many agentic workflows generate and execute code automatically.

SPL Query

index=sysmon EventCode=1

Image="*powershell.exe"

| regex CommandLine="(?i)(invoke-webrequest|invoke-expression|downloadstring|iwr)"

| stats count by user, host, CommandLine

Purpose

Identifies:

  • AI-generated scripts
  • Download-and-execute behavior
  • Autonomous remediation scripts
  • Potential AI-assisted attacks

Detection 6: Browser Automation Associated with AI Agents

Many agents rely on browser automation frameworks.

SPL Query

index=sysmon EventCode=1

(

CommandLine="selenium"

OR CommandLine="playwright"

OR CommandLine="puppeteer"

)

| stats count by user, host, CommandLine

Purpose

Detects:

  • Browser-based autonomous agents
  • Automated account access
  • Web scraping agents
  • AI workflow automation

Detection 7: Correlating Multiple Administrative Actions

One hallmark of agentic AI is rapidly executing multiple tasks across systems.

SPL Query

index=wineventlog

(

EventCode=4720

OR EventCode=4728

OR EventCode=4729

OR EventCode=4732

)

| transaction user maxspan=10m

| where eventcount > 5

Purpose

Highlights:

  • Bulk account creation
  • Mass privilege modification
  • Automation misuse
  • Agent-driven account management

Detection 8: AI-Assisted Reconnaissance Activity

Agentic attackers frequently automate reconnaissance.

SPL Query

index=sysmon

EventCode=1

(

CommandLine="whoami"

OR CommandLine="net user"

OR CommandLine="ipconfig"

OR CommandLine="systeminfo"

OR CommandLine="net group"

)

| stats count by host,user

Purpose

Can reveal:

  • Automated discovery actions
  • AI-assisted penetration testing
  • Lateral movement preparation
  • Internal system enumeration

Detection 9: Long-Duration Automated AI Sessions

Agentic systems often maintain persistent communications.

SPL Query

index=proxy

url_domain IN ("chat.openai.com","claude.ai","copilot.microsoft.com")

| bucket span=1h _time

| stats count by user,_time

| eventstats avg(count) as avg_session by user

| where count > avg_session*3

Purpose

Detects:

  • Extended AI agent operation
  • Workflow automation
  • Non-human interaction patterns
  • Potential autonomous assistants

Detection 10: Multi-Stage Agent Behavior Correlation

A more advanced detection correlates common stages of autonomous operation.

SPL Query

(index=sysmon EventCode=1) OR (index=proxy url="api.openai.com") OR (index=firewall action=allowed)

| stats values(process_name) as processes values(url) as urls count by host,user

| where count > 50

Purpose

Provides visibility into:

  • Prompt submission
  • API usage
  • Tool execution
  • Network communication

This closely aligns with how agentic systems operate in production environments.


Behavioral Detections Are More Effective Than IOC-Based Detections

Traditional security monitoring relies on indicators of compromise (IOCs) such as:

  • IP addresses
  • File hashes
  • Domain names

However, agentic AI introduces dynamic and rapidly evolving behaviors. Instead of hunting for known AI tools, SOC teams should focus on detecting:

  • Automated decision loops
  • Tool invocation patterns
  • High-frequency API activity
  • Autonomous privilege changes
  • AI-driven code execution
  • Task chaining across systems

Behavioral analytics provide more durable detections than simply monitoring known AI domains.


Mapping Agentic AI Detections to MITRE ATT&CK

Several ATT&CK techniques frequently overlap with agentic AI operations:

ATT&CK TechniqueDescription
T1059Command and Scripting Interpreter
T1087Account Discovery
T1018Remote System Discovery
T1105Ingress Tool Transfer
T1078Valid Accounts
T1190Exploit Public-Facing Application
T1021Remote Services
T1047Windows Management Instrumentation

Organizations should enrich detections with ATT&CK mappings to improve threat hunting and reporting.


Conclusion

Agentic AI is fundamentally changing how users, administrators, and attackers interact with enterprise systems. Security teams can no longer rely solely on traditional detections because autonomous systems generate activity that often resembles legitimate user behavior. Splunk provides an ideal platform to identify these emerging threats through behavioral analytics, correlation searches, risk-based alerting, and anomaly detection. By combining network telemetry, endpoint logs, cloud activity, and authentication data, defenders can build effective detections that uncover both authorized and malicious agentic AI activity.

Note: Apologies for the format as I had some trouble pasting from LibreOffice Writer.