# AI Agent Runtime Risk & Action Governance Intelligence (`quanmatrix/ai-agent-runtime-risk-governance-intelligence`) Actor

Use this Actor to analyze ai runtime risk and action governance and return decision-ready structured signals. Analyze AI-agent runtime traces, tool calls, approvals, permissions and side effects to detect policy violations, privilege creep, sensitive-data exposure and high-risk autonomous actions, w

- **URL**: https://apify.com/quanmatrix/ai-agent-runtime-risk-governance-intelligence.md
- **Developed by:** [Rafael Barreto Haddad](https://apify.com/quanmatrix) (community)
- **Categories:** Developer tools, Automation, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $12.60 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## AI Agent Runtime Risk & Action Governance Intelligence

Use this Actor to analyze ai runtime risk and action governance and return decision-ready structured signals. It is designed for repeatable human, API, Apify AI, and MCP-driven workflows.

Turn AI-agent execution traces into evidence-backed governance decisions.

This Actor analyzes what an autonomous agent **actually did at runtime**: tool calls, actions, permissions, approval state, sensitive-data access, side effects and behavior drift. It returns event-level risk findings plus an executive ALLOW / REVIEW / BLOCK decision that can feed security, observability, compliance and agent-control workflows.

### Why use this Actor

Runtime behavior is the layer static security cannot prove.

#### Why this is different

Most agent-security scanners inspect repositories, prompts, MCP manifests or workflow configuration before execution. Those checks matter, but they cannot prove what happened after an agent started acting.

This Actor is built for the runtime layer. Supply agent events directly or point it at an Apify Dataset. It evaluates executed behavior against an optional policy and, when a previous snapshot is supplied, detects new permissions and changing risk patterns.

### Key features

#### What it detects

- **Unapproved high-impact actions** such as financial, destructive, execution, deployment or privilege-changing side effects.
- **Actions executed after approval was denied.**
- **Tool allowlist violations** when a runtime call uses a tool outside the permitted set.
- **Denied permission usage** for explicitly forbidden scopes.
- **Privilege creep** when an agent starts using a new high-impact permission compared with the baseline period.
- **Sensitive-data access** when the supplied trace marks an event as containing or touching sensitive data.
- **Runtime risk drift** between current and previous execution snapshots.
- **Concentrated agent risk** through per-agent summaries, blocked/review counts and new permissions.

### Input

Use `currentItems` for inline runtime events or `currentDatasetId` to analyze an Apify Dataset. A previous snapshot is optional through `previousItems` or `previousDatasetId`.

Useful event fields include:

```json
{
  "eventId": "evt-103",
  "sessionId": "sess-44",
  "agent": "procurement-agent",
  "tool": "shell.exec",
  "action": "execute_command",
  "resource": "host:worker-2",
  "permission": "shell:execute",
  "approvalStatus": "denied",
  "sideEffect": "execution",
  "riskType": "privilege_escalation_attempt",
  "riskScore": 96,
  "sensitiveData": false,
  "timestamp": "2026-09-20T14:04:08Z"
}
```

Field aliases are normalized conservatively, so common variants such as `toolName`, `agent_id`, `trace_id`, `approval_status`, `permissionScope` and `side_effect` can also be used.

### Optional policy controls

You can make the Actor evaluate traces against your own governance rules:

- `allowedTools`: exact tool allowlist. Calls outside it become findings.
- `deniedPermissions`: scopes that must never appear in executed events.
- `requireApprovalFor`: side-effect classes that require explicit approval.
- `policy.thresholds.review`: score at which an event becomes REVIEW.
- `policy.thresholds.block`: score at which an event becomes BLOCK.

The defaults are intentionally conservative for financial, destructive, privilege, credential, execution, deployment and external-write actions.

### Output

One decision-ready report is written to the default Dataset and to the `INTELLIGENCE_REPORT` key-value-store record.

Core output includes:

- `policyDecision`: overall ALLOW, REVIEW or BLOCK.
- `risk_score` / `agentRuntimeRiskScore`: portfolio-level runtime risk.
- `criticalCount`, `highCount`, `blockedActionCount`, `reviewActionCount`.
- `privilegeCreepCount`, `approvalViolationCount`, `sensitiveDataEventCount`.
- `runtimeDrift`: baseline availability, risk delta and blocked-action delta.
- `topViolationTypes`: dominant governance failures.
- `agentRiskSummary`: per-agent event volume, max risk and new permissions.
- `findings`: evidence-backed event findings with remediation guidance.
- `agentAction`: machine-readable recommended next action.

Example finding:

```json
{
  "eventId": "evt-103",
  "agent": "procurement-agent",
  "tool": "shell.exec",
  "permission": "shell:execute",
  "runtimeRiskScore": 100,
  "severity": "CRITICAL",
  "policyDecision": "BLOCK",
  "violations": ["ACTION_AFTER_DENIED_APPROVAL", "PRIVILEGE_CREEP"],
  "evidence": [
    "approval status is 'denied' for a high-impact action",
    "new high-impact permission versus baseline: 'shell:execute'"
  ],
  "remediation": [
    "Require an explicit approval token before the tool call can execute",
    "Reduce permission scope and bind elevated scopes to short-lived approval"
  ]
}
```

### Use cases

#### Practical workflows

#### Agent observability

Feed traces from your orchestration layer on a schedule and monitor changes in blocked actions, sensitive-data access and privilege use.

#### MCP / tool-call governance

Normalize MCP calls into runtime events and use `allowedTools`, approval state and permission scopes to identify tools or actions that exceed policy.

#### Incident review

Run a suspicious session as `currentItems` to obtain a ranked, auditable set of findings and remediation actions.

#### Regression monitoring

Store each period as an Apify Dataset, then compare the latest period against a previous Dataset to detect risk and permission drift.

#### CI / release evidence

Run representative agent traces before and after a release. A rising risk score or new high-impact permission can become a release-review signal.

### Security model

The Actor uses **limited permissions** and reads only the Dataset resources explicitly supplied to it. It does not require access to the rest of your Apify account. It does not execute submitted tool calls, scripts or commands; it analyzes trace records as data.

This is deliberate: a governance Actor should not become another privileged execution surface. Humanity has already invented enough of those.

### Decision model

The engine combines explicit source risk scores, high-risk action terms, approval requirements, tool policy, denied scopes, sensitive-data markers and baseline permission drift. Multiple violations raise confidence in escalation without pretending that a heuristic score is a legal or security guarantee.

The result is deterministic for the same input and policy.

### Pricing

Pay per event. One primary charge corresponds to one decision-ready intelligence report, not every trace row. This keeps recurring runtime governance economical even when the report summarizes many events.

### Limitations

- The Actor analyzes supplied trace records; it does not intercept live agent traffic by itself.
- It is decision support, not a replacement for platform-level authorization, sandboxing or incident-response controls.
- Sensitive-data detection uses supplied flags and observable fields; it does not attempt exhaustive secret/PII discovery.
- Preserve stable identifiers across snapshots for the strongest drift analysis.

### Suggested upstream sources

Any system that can emit JSON runtime events can feed this Actor: agent frameworks, observability pipelines, MCP gateways, workflow engines, API logs, audit logs or custom tracing systems.

**Workflow:** `agent traces -> normalization -> policy evaluation -> permission/approval analysis -> runtime drift -> ranked findings -> ALLOW/REVIEW/BLOCK -> agentAction`

# Changelog

This Actor's version history is a separate document: https://apify.com/quanmatrix/ai-agent-runtime-risk-governance-intelligence/changelog.md

# Actor input Schema

## `currentItems` (type: `array`):

Current source or normalized rows to analyze.

## `currentDatasetId` (type: `string`):

Optional Apify Dataset ID used when currentItems is not supplied.

## `previousItems` (type: `array`):

Optional previous snapshot rows for period-over-period comparison.

## `previousDatasetId` (type: `string`):

Optional previous Apify Dataset ID used instead of previousItems.

## `maxItems` (type: `integer`):

Maximum records loaded from a Dataset input.

## `previousAnalysis` (type: `object`):

Optional prior Gen2 output used to calculate decision-metric deltas and regression.

## `valuePerImpactUnitUsd` (type: `number`):

Optional user-supplied economic value per impact unit. Leave empty to avoid monetary estimation.

## `monthlyRuns` (type: `integer`):

Optional expected monthly run count used only with valuePerImpactUnitUsd for economic impact estimation.

## `allowedTools` (type: `array`):

Optional exact tool allowlist. When supplied, a runtime call to another tool is treated as a governance violation.

## `deniedPermissions` (type: `array`):

Permission or scope names that must never appear in executed runtime events.

## `requireApprovalFor` (type: `array`):

Side-effect classes that require an explicit approval signal before execution.

## `policy` (type: `object`):

Optional governance overrides. Supports allowedTools, deniedPermissions, requireApprovalFor, and thresholds.review / thresholds.block.

## `mcpConnectors` (type: `array`):

Optional MCP connectors authorized in your Apify account. Use them to send or write this Actor result to tools such as Slack, Notion, GitHub, Sentry, Supabase, or another compatible MCP service.

## `mcpActionPreset` (type: `string`):

Choose a safe action pattern. AUTO\_SAFE\_WRITE discovers a compatible non-destructive write tool automatically; use a specific preset for Slack, GitHub, Notion, or database delivery.

## `mcpToolName` (type: `string`):

Optional exact MCP tool name. Leave blank to let the selected MCP action preset discover a compatible tool automatically.

## `mcpToolArguments` (type: `object`):

JSON object passed to the selected MCP tool. String values may use {{actor\_title}}, {{result\_summary}}, or {{result\_json}} placeholders.

## `mcpFailOnError` (type: `boolean`):

When enabled, an MCP delivery error fails the Actor run. Disabled by default so data extraction and intelligence results remain available even if the external destination is unavailable.

## Actor input object example

```json
{
  "currentItems": [
    {
      "eventId": "evt-101",
      "sessionId": "sess-44",
      "agent": "procurement-agent",
      "tool": "payments.create",
      "action": "create_payment",
      "resource": "vendor:acme",
      "permission": "payments:write",
      "approvalStatus": "missing",
      "sideEffect": "financial",
      "riskType": "unapproved_financial_action",
      "riskScore": 92,
      "sensitiveData": false,
      "timestamp": "2026-09-20T14:04:00Z"
    },
    {
      "eventId": "evt-102",
      "sessionId": "sess-44",
      "agent": "procurement-agent",
      "tool": "crm.search",
      "action": "read_contacts",
      "resource": "crm:contacts",
      "permission": "contacts:read",
      "approvalStatus": "not_required",
      "sideEffect": "read",
      "riskType": "sensitive_data_access",
      "riskScore": 48,
      "sensitiveData": true,
      "timestamp": "2026-09-20T14:04:04Z"
    },
    {
      "eventId": "evt-103",
      "sessionId": "sess-44",
      "agent": "procurement-agent",
      "tool": "shell.exec",
      "action": "execute_command",
      "resource": "host:worker-2",
      "permission": "shell:execute",
      "approvalStatus": "denied",
      "sideEffect": "execution",
      "riskType": "privilege_escalation_attempt",
      "riskScore": 96,
      "sensitiveData": false,
      "timestamp": "2026-09-20T14:04:08Z"
    }
  ],
  "previousItems": [
    {
      "eventId": "evt-091",
      "sessionId": "sess-41",
      "agent": "procurement-agent",
      "tool": "crm.search",
      "action": "read_contacts",
      "resource": "crm:contacts",
      "permission": "contacts:read",
      "approvalStatus": "not_required",
      "sideEffect": "read",
      "riskType": "sensitive_data_access",
      "riskScore": 35,
      "sensitiveData": true,
      "timestamp": "2026-09-13T14:04:04Z"
    }
  ],
  "maxItems": 20000,
  "monthlyRuns": 1,
  "allowedTools": [],
  "deniedPermissions": [],
  "requireApprovalFor": [
    "financial",
    "destructive",
    "external_write",
    "deployment",
    "privilege",
    "credential",
    "execution",
    "account_change",
    "message_send"
  ],
  "policy": {
    "thresholds": {
      "review": 55,
      "block": 80
    }
  },
  "mcpActionPreset": "AUTO_SAFE_WRITE",
  "mcpToolName": "",
  "mcpToolArguments": {},
  "mcpFailOnError": false
}
```

# Actor output Schema

## `results` (type: `string`):

Decision-ready intelligence report.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "currentItems": [
        {
            "eventId": "evt-101",
            "sessionId": "sess-44",
            "agent": "procurement-agent",
            "tool": "payments.create",
            "action": "create_payment",
            "resource": "vendor:acme",
            "permission": "payments:write",
            "approvalStatus": "missing",
            "sideEffect": "financial",
            "riskType": "unapproved_financial_action",
            "riskScore": 92,
            "sensitiveData": false,
            "timestamp": "2026-09-20T14:04:00Z"
        },
        {
            "eventId": "evt-102",
            "sessionId": "sess-44",
            "agent": "procurement-agent",
            "tool": "crm.search",
            "action": "read_contacts",
            "resource": "crm:contacts",
            "permission": "contacts:read",
            "approvalStatus": "not_required",
            "sideEffect": "read",
            "riskType": "sensitive_data_access",
            "riskScore": 48,
            "sensitiveData": true,
            "timestamp": "2026-09-20T14:04:04Z"
        },
        {
            "eventId": "evt-103",
            "sessionId": "sess-44",
            "agent": "procurement-agent",
            "tool": "shell.exec",
            "action": "execute_command",
            "resource": "host:worker-2",
            "permission": "shell:execute",
            "approvalStatus": "denied",
            "sideEffect": "execution",
            "riskType": "privilege_escalation_attempt",
            "riskScore": 96,
            "sensitiveData": false,
            "timestamp": "2026-09-20T14:04:08Z"
        }
    ],
    "previousItems": [
        {
            "eventId": "evt-091",
            "sessionId": "sess-41",
            "agent": "procurement-agent",
            "tool": "crm.search",
            "action": "read_contacts",
            "resource": "crm:contacts",
            "permission": "contacts:read",
            "approvalStatus": "not_required",
            "sideEffect": "read",
            "riskType": "sensitive_data_access",
            "riskScore": 35,
            "sensitiveData": true,
            "timestamp": "2026-09-13T14:04:04Z"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("quanmatrix/ai-agent-runtime-risk-governance-intelligence").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "currentItems": [
        {
            "eventId": "evt-101",
            "sessionId": "sess-44",
            "agent": "procurement-agent",
            "tool": "payments.create",
            "action": "create_payment",
            "resource": "vendor:acme",
            "permission": "payments:write",
            "approvalStatus": "missing",
            "sideEffect": "financial",
            "riskType": "unapproved_financial_action",
            "riskScore": 92,
            "sensitiveData": False,
            "timestamp": "2026-09-20T14:04:00Z",
        },
        {
            "eventId": "evt-102",
            "sessionId": "sess-44",
            "agent": "procurement-agent",
            "tool": "crm.search",
            "action": "read_contacts",
            "resource": "crm:contacts",
            "permission": "contacts:read",
            "approvalStatus": "not_required",
            "sideEffect": "read",
            "riskType": "sensitive_data_access",
            "riskScore": 48,
            "sensitiveData": True,
            "timestamp": "2026-09-20T14:04:04Z",
        },
        {
            "eventId": "evt-103",
            "sessionId": "sess-44",
            "agent": "procurement-agent",
            "tool": "shell.exec",
            "action": "execute_command",
            "resource": "host:worker-2",
            "permission": "shell:execute",
            "approvalStatus": "denied",
            "sideEffect": "execution",
            "riskType": "privilege_escalation_attempt",
            "riskScore": 96,
            "sensitiveData": False,
            "timestamp": "2026-09-20T14:04:08Z",
        },
    ],
    "previousItems": [{
            "eventId": "evt-091",
            "sessionId": "sess-41",
            "agent": "procurement-agent",
            "tool": "crm.search",
            "action": "read_contacts",
            "resource": "crm:contacts",
            "permission": "contacts:read",
            "approvalStatus": "not_required",
            "sideEffect": "read",
            "riskType": "sensitive_data_access",
            "riskScore": 35,
            "sensitiveData": True,
            "timestamp": "2026-09-13T14:04:04Z",
        }],
}

# Run the Actor and wait for it to finish
run = client.actor("quanmatrix/ai-agent-runtime-risk-governance-intelligence").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "currentItems": [
    {
      "eventId": "evt-101",
      "sessionId": "sess-44",
      "agent": "procurement-agent",
      "tool": "payments.create",
      "action": "create_payment",
      "resource": "vendor:acme",
      "permission": "payments:write",
      "approvalStatus": "missing",
      "sideEffect": "financial",
      "riskType": "unapproved_financial_action",
      "riskScore": 92,
      "sensitiveData": false,
      "timestamp": "2026-09-20T14:04:00Z"
    },
    {
      "eventId": "evt-102",
      "sessionId": "sess-44",
      "agent": "procurement-agent",
      "tool": "crm.search",
      "action": "read_contacts",
      "resource": "crm:contacts",
      "permission": "contacts:read",
      "approvalStatus": "not_required",
      "sideEffect": "read",
      "riskType": "sensitive_data_access",
      "riskScore": 48,
      "sensitiveData": true,
      "timestamp": "2026-09-20T14:04:04Z"
    },
    {
      "eventId": "evt-103",
      "sessionId": "sess-44",
      "agent": "procurement-agent",
      "tool": "shell.exec",
      "action": "execute_command",
      "resource": "host:worker-2",
      "permission": "shell:execute",
      "approvalStatus": "denied",
      "sideEffect": "execution",
      "riskType": "privilege_escalation_attempt",
      "riskScore": 96,
      "sensitiveData": false,
      "timestamp": "2026-09-20T14:04:08Z"
    }
  ],
  "previousItems": [
    {
      "eventId": "evt-091",
      "sessionId": "sess-41",
      "agent": "procurement-agent",
      "tool": "crm.search",
      "action": "read_contacts",
      "resource": "crm:contacts",
      "permission": "contacts:read",
      "approvalStatus": "not_required",
      "sideEffect": "read",
      "riskType": "sensitive_data_access",
      "riskScore": 35,
      "sensitiveData": true,
      "timestamp": "2026-09-13T14:04:04Z"
    }
  ]
}' |
apify call quanmatrix/ai-agent-runtime-risk-governance-intelligence --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,quanmatrix/ai-agent-runtime-risk-governance-intelligence"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Ciof8wGaGKXj4HCQx/builds/F9rKGRhjBa4F37oKL/openapi.json
