Snippets
KQL snippet: find risky tool actions from an AI agent
A short query to isolate write-capable tool calls, their execution identity and correlation before disabling an AI agent.
When an AI agent appears to have executed the wrong action, first isolate write-capable tool calls and their execution identity, not only the user prompt.
let Window = 6h;
let AgentName = "ops-assistant";
AppTraces
| where TimeGenerated > ago(Window)
| where tostring(Properties.agent_name) == AgentName
| where tostring(Properties.tool_action) in ("create", "update", "delete", "execute", "approve")
| project TimeGenerated,
Agent=tostring(Properties.agent_name),
Tool=tostring(Properties.tool_name),
Action=tostring(Properties.tool_action),
Target=tostring(Properties.target_resource),
Actor=tostring(Properties.execution_identity),
Approval=tostring(Properties.approval_id),
Source=tostring(Properties.source_reference),
OperationId
| order by TimeGenerated desc Quick read: an action without Approval should be treated as a guardrail gap; an unexpected identity points to execution scope; an empty or unapproved source points to grounding and human validation.