Runtime and eventsRuntime Integration API

Runtime Integration API

Use the Runtime Integration API when a hook, gateway, collector, or fleet script needs to send data into AgentKeeper or request a policy decision. These endpoints are intentionally POST-heavy...

Use the Runtime Integration API when a hook, gateway, collector, or fleet script needs to send data into AgentKeeper or request a policy decision. These endpoints are intentionally POST-heavy because the caller is reporting observations or asking for enforcement before a tool runs.

For data export, SIEM sync, warehouse ingestion, or settings automation, use API Reference to check the current customer API boundary.

Base URL

https://www.agentkeeper.dev
export AGENTKEEPER_API_URL="https://www.agentkeeper.dev"
export AGENTKEEPER_API_KEY="ak_live_..."

Authentication

Runtime endpoints use organization-scoped API keys from Settings > Access > API keys.

curl -fsS "$AGENTKEEPER_API_URL/api/v1/shield/policy" \
  -H "Authorization: Bearer $AGENTKEEPER_API_KEY"

Runtime keys are write-oriented. They can evaluate policy, submit events, report workstation posture, and send telemetry. They cannot read dashboard history, list users, change billing, or administer the organization.

Endpoint Index

Runtime Evaluation

MethodPathUse
POST/api/v1/evaluate?tool=<tool>Unified policy evaluation for supported agent adapters
POST/api/v1/audit?tool=<tool>Unified post-tool audit ingestion
POST/api/v1/claude-code/evaluateClaude Code UserPromptSubmit and PreToolUse evaluation
POST/api/v1/claude-code/auditClaude Code PostToolUse audit
POST/api/v1/claude-code/checkinClaude Code SessionStart check-in
GET/api/v1/claude-code/healthAPI-key connectivity check

Supported values for evaluation and audit tool:

ValueSurface
claude-codeClaude Code-compatible payloads
claude-chatClaude Desktop Chat MCP Gateway activity
coworkClaude Cowork Local Agent Mode activity
cursorCursor
windsurfWindsurf
copilotVS Code Copilot
codexCodex
geminiGemini CLI
antigravityGoogle Antigravity
grokGrok

Events And Policy

MethodPathUse
GET/api/v1/shield/policyFetch baseline Runtime Shield policy for the API key's organization
POST/api/v1/shield/eventsIngest a batch of Runtime Shield events
POST/api/v1/shield/heartbeatMark Runtime Shield active on a workstation
POST/api/v1/eventsIngest lifecycle events such as install or uninstall

Workstation Posture

MethodPathUse
POST/api/v1/scansUpload workstation posture, gateway posture, or Cowork posture scan results

MCP

MethodPathUse
POST/api/v1/mcp/evaluateEvaluate an MCP server/tool call before execution
POST/api/v1/mcp/eventsIngest MCP activity events
POST/api/v1/mcp/syncSync MCP Gateway inventory

OTLP

MethodPathUse
POST/api/v1/otlp/v1/logsIngest Claude Code, Claude Agent SDK, and Cowork logs as evidence
GET/api/v1/otlp/healthCheck OTLP ingestion health
GET/api/v1/otlp/setup-healthValidate telemetry setup

When setting Claude Code environment variables, use the base endpoint https://www.agentkeeper.dev/api/v1/otlp. When a product UI asks for an exact logs endpoint, use https://www.agentkeeper.dev/api/v1/otlp/v1/logs.

Evaluate A Tool Call

POST /api/v1/evaluate?tool=cursor
Authorization: Bearer ak_live_...
Content-Type: application/json
curl -fsS "$AGENTKEEPER_API_URL/api/v1/evaluate?tool=cursor" \
  -H "Authorization: Bearer $AGENTKEEPER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "hook_event_name": "PreToolUse",
    "tool_name": "Bash",
    "tool_input": {
      "command": "cat ~/.aws/credentials"
    },
    "hostname": "dev-laptop-01",
    "session_id": "session-123",
    "cwd": "/Users/alex/work/app"
  }'

Common request fields:

FieldTypeRequiredNotes
tool_namestringYesNormalized tool name such as Bash, Read, Write, or mcp__server__tool
tool_inputobjectYesTool arguments used for policy evaluation
hook_event_namestringRecommendedHook phase, usually PreToolUse
hostnamestringRecommendedWorkstation identity fallback
machine_idstringRecommended for fleet installsStable workstation identity
session_idstringRecommendedGroups events into investigations
cwdstringRecommendedWorking directory for path and repository context
user_hintstringOptionalEmail or username for attribution and group policy

Claude-compatible deny response:

{
  "hookSpecificOutput": {
    "hookEventName": "PreToolUse",
    "permissionDecision": "deny",
    "permissionDecisionReason": "Blocked by AgentKeeper org policy"
  }
}

Generic adapter response:

{
  "decision": "deny",
  "reason": "Blocked by AgentKeeper org policy"
}

Evaluation endpoints may return 200 even when an action is blocked. Agent hook runtimes often treat non-200 responses as hook failures instead of policy decisions. Read the response body for the verdict.

Audit A Completed Tool Call

POST /api/v1/audit?tool=cursor
Authorization: Bearer ak_live_...
Content-Type: application/json

Audit endpoints record completed actions and output-risk findings. They do not block the completed action.

curl -fsS "$AGENTKEEPER_API_URL/api/v1/audit?tool=cursor" \
  -H "Authorization: Bearer $AGENTKEEPER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "tool_name": "Read",
    "tool_input": {
      "file_path": "/Users/alex/work/app/package.json"
    },
    "tool_output": "{ "name": "app" }",
    "hostname": "dev-laptop-01",
    "session_id": "session-123",
    "cwd": "/Users/alex/work/app"
  }'

Successful audit response:

{}

Upload Shield Events

POST /api/v1/shield/events
Authorization: Bearer ak_live_...
Content-Type: application/json

Use this endpoint when a collector has already made a policy decision and needs to send events in batches.

{
  "events": [
    {
      "hostname": "dev-laptop-01",
      "detection_layer": "claude_code",
      "verdict": "blocked",
      "severity": "high",
      "security_level": "strict",
      "input_hash": "sha256-or-client-hash",
      "session_id": "session-123",
      "tool_name": "Bash",
      "enforcement_reason": "Blocked by AgentKeeper org policy",
      "context": {
        "tool_input": {
          "command": "cat ~/.aws/credentials"
        }
      }
    }
  ]
}

Limits:

LimitValue
Events per batch100
Stored context sizeBounded and truncated server-side

Upload A Workstation Scan

POST /api/v1/scans
Authorization: Bearer ak_live_...
Content-Type: application/json
{
  "hostname": "dev-laptop-01",
  "machine_id": "hardware-or-mdm-stable-id",
  "platform": "darwin",
  "os_version": "macOS 15.5",
  "agent_version": "agentkeeper-gateway/0.3.2",
  "source": "gateway",
  "score": 92,
  "grade": "A",
  "checks": [
    {
      "status": "passed",
      "check_name": "Claude Code hooks installed",
      "category": "runtime",
      "severity": "medium"
    }
  ],
  "raw_report": {
    "collector": "agentkeeper-gateway"
  }
}

Required fields:

FieldTypeNotes
hostnamestringWorkstation display name
checksarrayPosture checks and evidence
raw_reportobject or stringCollector evidence

MCP Evaluation And Events

MCP calls can reach AgentKeeper through native agent hooks as tool names like mcp__notion__notion-create-pages, or through MCP-specific endpoints.

Use /api/v1/mcp/evaluate when the caller needs a pre-execution decision for an MCP server/tool call.

Use /api/v1/mcp/events when the caller is reporting observed MCP activity after the call.

Use /api/v1/mcp/sync when a gateway or collector is reporting inventory.

Security Notes

  • API keys are scoped to one organization.
  • Raw API keys are shown only at creation time.
  • Server-side storage uses hashed keys.
  • Runtime API keys do not grant dashboard read or admin access.
  • All API calls should use HTTPS.
  • Use separate API keys for MDM, GitHub repo hooks, Cowork, and gateway installs when independent rotation matters.