AI Security

Runtime Security for AI Agents: Monitoring What Agents Actually Do

Preventive controls for AI agents will never be perfect, because prompt injection has no complete fix. Runtime security fills the gap: capturing what agents actually do, detecting misbehaviour in real time and responding quickly. This article covers the telemetry, detections and response playbooks a SOC needs for agents.

By EthicalHat Research · · 3 min read
Infographic: Runtime security for agents, end to end

Everything we have written this year about securing agents (identity, least privilege, policy enforcement, approvals, sandboxing) aims to prevent harm. Those controls are essential. They are also incomplete: prompt injection still has no complete fix, agents make mistakes, and configurations drift.

Security teams have been here before. Endpoint protection was never perfect, so we added endpoint detection and response. Cloud configurations drift, so we monitor the control plane. Agents need the same: runtime security that watches what they actually do.

Why agents need runtime monitoring

  • Manipulation is probabilistic. An attack that fails 95 times may succeed on the 96th.
  • Behaviour changes with context. New documents, new users and new model versions change what an agent does.
  • Actions are fast and numerous. A misbehaving agent can do a lot of damage in minutes.
  • Humans are not always watching. Scheduled and event-driven agents act without anyone present.

Telemetry: what to capture

Runtime security starts with structured, complete telemetry for every agent run. Useful fields include:

EventKey fields
Run startagent ID and version, trigger, delegating principal, task
Model callmodel, prompt hash and size, token counts, latency
Tool calltool, server, arguments (redacted where needed), result size, duration
Policy decisionaction, resource, decision (allow, deny, approval), rule
Approvalapprover, what was shown, decision, time taken
Data flowsource classification, destination, volume
Run endoutcome, errors, cost

Emit these as OpenTelemetry traces or structured logs, correlated by run ID, and ship them to your SIEM alongside identity and application logs.

Detections that work

Baseline deviations per agent. Agents are narrower than humans, so their normal behaviour is predictable. Alert on:

  • first use of a tool the agent has never used,
  • access to resources or data classifications outside its usual range,
  • unusual volumes of reads, writes or outbound messages,
  • new outbound destinations, and
  • runs far longer or more expensive than normal.

Dangerous data flows. Sensitive data read in a run followed by an outbound action (email, HTTP request, message, public repository) to a new or external destination.

Policy denials. A burst of denied actions often means the agent is being steered somewhere it should not go, even if every attempt was blocked.

Injection indicators. Instruction-like patterns in retrieved content or tool results, and sudden changes in the agent's stated goal mid-run.

Approval anomalies. Approvals granted in seconds for high-risk actions, or unusually high approval volumes for one reviewer (fatigue).

An illustrative detection in a SIEM query language:

sql
-- Sensitive read followed by external send within the same agent run
SELECT run_id, agent_id, principal,
       MIN(ts) FILTER (WHERE event = 'tool_call' AND data_class IN ('confidential','restricted')) AS sensitive_read_at,
       MIN(ts) FILTER (WHERE event = 'tool_call' AND tool IN ('send_email','http_post','post_message')
                        AND destination_domain NOT IN (SELECT domain FROM approved_domains)) AS external_send_at
FROM agent_events
WHERE ts > now() - interval '1 hour'
GROUP BY run_id, agent_id, principal
HAVING MIN(ts) FILTER (WHERE event = 'tool_call' AND data_class IN ('confidential','restricted'))
     < MIN(ts) FILTER (WHERE event = 'tool_call' AND tool IN ('send_email','http_post','post_message')
                        AND destination_domain NOT IN (SELECT domain FROM approved_domains));

Inline runtime controls

Some controls run in the execution path rather than after the fact:

  • Runtime policy engines that evaluate each tool call against rules and data-flow policies.
  • Circuit breakers that pause an agent automatically after too many denials, errors or unusual actions.
  • Budget guards that stop runs exceeding time, step or cost limits.
  • Output scanners that check outbound content for secrets and sensitive data before it leaves.
flowchart LR
  A[Agent proposes action] --> P{Runtime policy<br/>& data-flow check}
  P -->|allow| X[Execute]
  P -->|deny| D[Deny + log]
  D --> CB{Denials > threshold?}
  CB -->|yes| Pause[Pause agent<br/>alert SOC]
  X --> T[(Telemetry)]
  D --> T
  T --> SIEM[SIEM detections]
  SIEM --> SOC[SOC triage]

Response playbooks

When an agent alert fires, the SOC needs a clear playbook:

  1. Contain: pause the agent (or the specific deployment), revoke its active delegated tokens, and block affected outbound destinations.
  2. Preserve: snapshot traces, prompts, retrieved content, memory state and tool results for the affected runs.
  3. Scope: identify which runs, users and data were affected, and whether similar manipulation occurred elsewhere.
  4. Find the entry point: which input carried the manipulation (a document, email, web page or tool description)? Remove or quarantine it.
  5. Remediate: fix the underlying control gap, such as a scope, a policy rule or an approval requirement.
  6. Learn: add the scenario to evaluation and red-team suites, and tune detections.

Organisational readiness

  • Put agents in the SOC's asset inventory, with owners and criticality.
  • Give analysts access to agent traces, not just summary logs.
  • Rehearse an agent compromise in a tabletop exercise.
  • Agree who has authority to pause business-critical agents.

The bottom line

Prevention reduces how often agents are manipulated or go wrong. Runtime security determines how long it lasts and how much damage it does. Instrument every agent, baseline its behaviour, detect deviations and dangerous data flows, and give the SOC a playbook to act on. Agents will become a normal part of the attack surface; they should become a normal part of the SOC's view too.

Our managed detection and response service extends 24×7 monitoring to AI agents, and our SOC design team builds the telemetry and playbooks to support them.

EthicalHat Research

The EthicalHat research team: penetration testers, SOC analysts and engineers writing about security, software engineering and AI.

Want an expert opinion on your own systems?

Email info@ethicalhat.com or call +1-844-838-4422. Our security engineers are happy to talk it through.