Developer docs

Agent gate, SDKs & API

KollGuard is the governance layer above your agent frameworks. Before an agent runs a risky tool, it asks KollGuard: allow, deny, or wait for a named human. Every decision is audited and the agent’s spans become sealed evidence. These docs cover the gate, the packages, the HTTP API, the evidence record, and the read-only findings API and MCP server.

Overview

The agent gate is a runtime authorization service. Your agent sends the tool it is about to call, an action class and a short resource string. KollGuard checks that against the agent’s status, your risk-class policy, its autonomy tier, its write scopes and the kill switches, then answers. It works with any framework: the adapters are thin layers over one HTTP contract.

Decision lifecycle

AnswerMeaning
allowThe call may run. The allow is valid for 15 minutes (validUntil); after that it reads as expired and counts as a deny. For a resumable approval the 15 minutes count from its first use, not from the approval. The row is saved and audited before an allow is returned.
denyThe call must not run. reason says why and is safe to show a model. A pending request that nobody decides in time (15 minutes inline, 72 hours or 7 days resumable) also ends as a deny.
pendingA named human has to decide in Agent Control → Agent requests (web) or from the mobile push. Inline: poll the request id every pollAfterMs (5 s) until it becomes allow or deny. Resumable: suspend the run, and re-decide with the same idempotencyKey when it resumes or a webhook arrives.
  1. The agent asks (POST /v2/decide) with its kgw_ token.
  2. KollGuard decides. For allow and deny the answer comes back at once.
  3. For pending, a named approver decides in Agent Control → Agent requests, on the web or from the mobile push. The agent polls the request until it turns into allow or deny.
  4. Every decision is stored and written to the hash-chained audit log. An allow is returned only after both succeed; if anything fails the answer is deny.

Calls the policy marks as ungated (for example Read with gate: false) make no network call at all and are reported as spans only.

Enforcement modes

Be clear about what each integration can and cannot stop. KollGuard is not in the network path, so the mode decides who applies the answer.

ModePackagesHow the answer is appliedLimit
Cooperative (SDK)@kollguard/core, @kollguard/mastra, @kollguard/vercel-ai, @kollguard/openai-agents, @kollguard/langgraph, PyPI kollguard (LangGraph, OpenAI Agents), or two HTTP callsYour code asks, then honours the answer.The gate only covers calls that go through it. An agent that skips the call, or ignores a deny, can still act with the credentials it holds. Not a sandbox.
Hook@kollguard/claude-hook, @kollguard/agent-sdk (kollguardHooks)Claude Code (or the Agent SDK) runs the check before every matching tool call, so the model cannot skip it. A deny applies even in bypassPermissions.Runs on the developer’s machine. Anyone who can edit that machine’s settings can remove it; deliver it through Claude Code managed settings for a team.
Proxy (MCP Guard)@kollguard/mcp-guardSits between an MCP client and the MCP server: hides denied tools, holds approve-mode calls for a person, and has no fail-open flag.Runs on the agent’s host. Someone who controls that host can point the client at the real server instead.

Agent Watch shows the enforcement mode on each agent’s passport. When a deny must be a hard stop, pair the gate with credentials that your own broker issues only after an allow.

Quickstarts

Every quickstart needs one agent token. Create it once:

  1. In KollGuard open Agent Watch → Propose agent, describe the agent, and click Create intake.
  2. Approve the agent to pilot or production. The gate denies agents that are still in intake, or that are disabled, killed, rejected or retired.
  3. Copy the kgw_ token. It is shown once, at Create intake; use Rotate token if you lost it. Keep it in an environment variable or secret manager as KOLLGUARD_AGENT_TOKEN.
PackageVersionUse it for
@kollguard/claude-hook (npm)0.2.0Claude Code PreToolUse hook
@kollguard/agent-sdk (npm)0.2.0Agents built on the Claude Agent SDK
@kollguard/mcp-guard (npm)0.1.0Any MCP server, for any MCP client
@kollguard/core (npm)0.2.0 (publishing)Typed client, CLI and local mode; the base for adapters. Adds the decision callback.
@kollguard/mastra (npm)0.1.1 (publishing)Mastra agents and workflows
@kollguard/vercel-ai (npm)0.1.1 (publishing)Vercel AI SDK agents
@kollguard/openai-agents (npm)0.1.1 (publishing)OpenAI Agents SDK (JavaScript)
@kollguard/langgraph (npm)0.1.1 (publishing)LangGraph (JavaScript) and LangChain createAgent
kollguard (PyPI)0.2.0 (publishing)Python, with LangGraph and OpenAI Agents extras; resumable approvals and webhook verification

Versions marked publishing are being released: until they are on npm and PyPI, npm install and pip install give the previous version. The adapters are 0.1.0 on npm today and work with it; 0.1.1 only lets them accept @kollguard/core 0.2.

Claude Code

kollguard-claude-hook is a PreToolUse hook. Before Bash, Edit, Write, WebFetch or an MCP tool runs, it asks the gate. A deny blocks the call and Claude reads the reason. A pending call waits up to KOLLGUARD_WAIT_SECONDS (default 120) for an approval.

npm install -g @kollguard/claude-hook
export KOLLGUARD_AGENT_TOKEN=kgw_…

Then add the hook to ~/.claude/settings.json (all projects) or .claude/settings.json (one repo):

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "^(Bash|Edit|MultiEdit|Write|NotebookEdit|WebFetch|WebSearch|mcp__.*)$",
        "hooks": [
          {
            "type": "command",
            "command": "kollguard-claude-hook",
            "args": [],
            "timeout": 150,
            "onFailure": "block",
            "statusMessage": "Checking with KollGuard"
          }
        ]
      }
    ]
  }
}

Keep timeout above KOLLGUARD_WAIT_SECONDS. "onFailure": "block" needs Claude Code v2.1.295 or later; with it a crash, a missing binary or a timeout blocks the call. Without a global install use npx -y @kollguard/claude-hook, which adds start-up time to every call. Details: Gate Claude Code and Claude agents with KollGuard.

Claude Agent SDK

kollguardHooks is a PreToolUse hook for options.hooks. It runs for every tool call, including calls that allowedTools, acceptEdits or bypassPermissions would approve, and a deny applies even in bypassPermissions. It uses the same core and default policy as the Claude Code hook.

npm install @kollguard/agent-sdk @anthropic-ai/claude-agent-sdk
export KOLLGUARD_AGENT_TOKEN=kgw_…   # Agent Watch → your agent → token
import { query } from '@anthropic-ai/claude-agent-sdk';
import { kollguardHooks } from '@kollguard/agent-sdk';

for await (const m of query({
  prompt: 'Run the tests and fix the first failure',
  options: { hooks: kollguardHooks({ onAllow: 'approve', waitSeconds: 120 }) },
})) {
  if (m.type === 'result' && m.subtype === 'success') console.log(m.result);
}

onAllow: 'approve' lets a KollGuard allow approve the call, for headless agents with no other approver. kollguardCanUseTool is a fallback approver, not a gate: the SDK calls it only when nothing earlier approved the call.

MCP Guard

MCP Guard is an MCP server your client launches instead of the real one. It forwards to the real server and applies the per-tool allow / approve / deny policy from Agent Control → MCP tool policy: denied tools are hidden from tools/list, approve-mode calls wait for a person, and a tool whose description or schema changed since the last scan is treated as unknown until you re-scan. Tool arguments and results never leave your host.

First register the server (Scans → Add MCP server), set the policy, and copy the agent’s token. Then point your client at the Guard. A remote server:

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@kollguard/mcp-guard", "--upstream", "https://api.githubcopilot.com/mcp"],
      "env": { "KOLLGUARD_AGENT_TOKEN": "kgw_…", "UPSTREAM_AUTHORIZATION": "Bearer ghp_…" }
    }
  }
}

A local (stdio) server:

{
  "command": "npx",
  "args": ["-y", "@kollguard/mcp-guard", "--upstream-command", "npx -y @modelcontextprotocol/server-filesystem /repo", "--server-id", "fs-repo"],
  "env": { "KOLLGUARD_AGENT_TOKEN": "kgw_…" }
}
Flag or variableMeaning
--upstream <url>Remote server (Streamable HTTP).
--upstream-command "<cmd>"Local server, run as a child process over stdio.
--server-id <id>Identity KollGuard knows a local server by (default: the command line).
--wait <seconds>How long a call waits for a person before returning a retryable error (default 45, max 900).
KOLLGUARD_AGENT_TOKENRequired. The calling agent’s kgw_ token.
UPSTREAM_AUTHORIZATIONOptional. Authorization header value for a remote server.

Errors: -32010 denied (policy, gate, or KollGuard unreachable), -32011 waiting for a human (retry with the same arguments; the same request is replayed, not re-queued), -32012 Guard-side error. There is no fail-open flag. Resources and prompts pass through unchanged; tools are governed.

TypeScript: @kollguard/core

A framework-neutral client with zero runtime dependencies (Node 18.17+, and Deno for the client). Adapters for other frameworks are built on it.

npm install @kollguard/core
import { createKollGuard } from '@kollguard/core';

const kg = createKollGuard({
  token: process.env.KOLLGUARD_AGENT_TOKEN,      // kgw_... from Agent Control
  policy: './kollguard.policy.json',
});

const d = await kg.decide({
  tool: 'stripe.refund',
  actionClass: 'money_auth',
  resource: 'stripe:refund/ch_123',
  args,                                           // only the NAMES are sent
  framework: 'my-agent',
  runRef: run.id,                                 // run id + tool-call id = a stable idempotency key
  callId: toolCall.id,
});

if (d.decision === 'allow') await refund(args);
else throw new Error(d.reason);                   // deny, or a wait that ran out

decide never throws for a normal answer. For exceptions use kg.assertAllowed(input), which throws KollGuardDeniedError or KollGuardPendingError. To wait for a person:

await kg.decide({ ..., wait: { mode: 'inline', maxMs: 120_000 } });   // default: poll at the server's pollAfterMs
const p = await kg.decide({ ..., wait: { mode: 'none' } });           // returns pending at once
const done = await kg.waitForDecision(p.requestId, { signal });       // or kg.getDecision(id) for one poll

kollguard.policy.json maps tools to a class and a fail mode, in the same schema the Claude Code hook uses:

{
  "tools": {
    "Read":          { "class": "read",       "fail": "open", "gate": false },
    "stripe.refund": { "class": "money_auth", "fail": "closed" }
  },
  "mcp":     { "class": "write", "fail": "closed" },
  "default": { "class": "unclassified", "fail": "closed" }
}

gate: false makes no network call. Classes: read, propose, write, external_comm, money_auth, phi_access, patient_facing, unclassified. Idempotency keys come from framework ids, HMAC’d with your token: run id plus tool-call id is a stable key.

For runs that suspend for hours (contract: 'auto' and wait: { mode: 'resumable' }), see Long approvals, webhooks & quorum:

const kg = createKollGuard({ token, contract: 'auto' });        // 'auto' probes GET /v2/policy once

const d = await kg.decide({
  tool: 'stripe.refund', actionClass: 'money_auth', args,
  runRef: run.id, callId: toolCall.id,                          // a stable key: no time component
  wait: { mode: 'resumable' },                                  // pending at once, up to 72 h (7 days on Enterprise)
  callback: process.env.KOLLGUARD_WEBHOOK_ID,                   // optional: a registered decision webhook
});
if (d.decision === 'pending') suspendRun(d.requestId, d.expiresAt);
// ...hours later: call decide() again with the SAME runRef + callId. The approval is replayed.

Mastra

@kollguard/mastra gates the tool calls and workflow steps of a Mastra agent. A held call suspends the Mastra run, which you resume when the person has decided. Argument values never leave your host.

npm install @kollguard/mastra @kollguard/core @mastra/core
export KOLLGUARD_AGENT_TOKEN=kgw_…
import { Agent } from '@mastra/core/agent';
import { createKollGuard } from '@kollguard/core';
import { guardTools } from '@kollguard/mastra';

const kg = createKollGuard({ contract: 'auto' });   // 'auto' lets long approvals suspend the run

export const agent = new Agent({
  id: 'support',
  name: 'support',
  instructions: 'You help with billing.',
  model: 'openai/gpt-5',
  tools: guardTools({ refund, lookupCustomer }, kg),   // the map keys are the names KollGuard's policy matches on
});

A refund the policy allows runs. One that needs a person is held in Agent Control → Agent requests. A denied call never reaches your tool: the model receives KollGuard’s reason as a tool error. Without the resumable capability the call waits inline (120 s by default; no answer means denied). With it the run suspends:

const first = await agent.generate('Refund order 1042');
if (first.finishReason === 'suspended') {
  // The suspend payload carries { kollguard: { requestId, tool, expiresAt } }. Store first.runId.
  // When KollGuard tells you it is decided (decision webhook, or poll kg.getDecision(requestId)):
  const done = await agent.resumeGenerate({ requestId }, { runId: first.runId });
}

The resume value is never treated as an approval: the wrapper asks KollGuard again with the same idempotency key (run id plus tool-call id). Suspending needs a Mastra storage provider. kollguardHooks covers every tool source with an inline wait and kollguardStep gates a workflow step. Enforcement is cooperative. Tested against @mastra/core 1.85 (Node 22.13+).

Vercel AI SDK

@kollguard/vercel-ai gates the tool calls of a Vercel AI SDK (v7) agent. A call the policy allows runs; one that needs a person waits for them (up to two minutes by default; no answer means denied).

npm install @kollguard/vercel-ai @kollguard/core ai
export KOLLGUARD_AGENT_TOKEN=kgw_…
import { generateText, tool } from 'ai';
import { createKollGuard } from '@kollguard/core';
import { guardTools } from '@kollguard/vercel-ai';

const kg = createKollGuard();

const tools = guardTools({ refund: tool({ /* … */ }), lookupCustomer: tool({ /* … */ }) }, kg);

const result = await generateText({ model, tools, prompt: 'Refund order 1042' });

For approvals that last hours, add kollguardToolApproval as the SDK’s toolApproval, together with guardTools. When the server reports resumable, a pending call ends the run with a tool-approval-request you can hold as long as you like; without it the call waits inline.

import { guardTools, kollguardToolApproval } from '@kollguard/vercel-ai';

const kg = createKollGuard({ contract: 'auto' });       // 'auto' lets the server say it supports long approvals
const tools = guardTools(rawTools, kg);

const result = await generateText({ model, tools, messages, toolApproval: kollguardToolApproval(kg) });

Why both pieces: toolApproval is the pause, but the SDK runs a tool once the history holds an approved response, whoever wrote it. guardTools is the gate: it asks KollGuard again at execute time with the same key, so a forged approval cannot run the tool. Enforcement is cooperative.

OpenAI Agents SDK (JavaScript)

@kollguard/openai-agents gates the tool calls of an OpenAI Agents SDK (JS) agent. A held call stops the run with an interruption you resolve when the person has decided.

npm install @kollguard/openai-agents @kollguard/core @openai/agents
export KOLLGUARD_AGENT_TOKEN=kgw_…
import { Agent, run, tool } from '@openai/agents';
import { createKollGuard } from '@kollguard/core';
import { guardTool } from '@kollguard/openai-agents';

const kg = createKollGuard({ contract: 'auto' });   // 'auto' lets long approvals interrupt the run

const refund = tool({ name: 'refund', /* … */ });
const agent = new Agent({ name: 'support', instructions: '…', tools: [guardTool(refund, kg)] });

const result = await run(agent, 'Refund order 1042');

guardTool attaches a tool input guardrail (the real gate; it runs after any approval, so a client-side state.approve() can never bypass KollGuard) and a needsApproval (the pause). Resolve the interruptions once the person has decided:

import { resolveInterruptions } from '@kollguard/openai-agents';

let result = await run(agent, 'Refund order 1042');
if (result.interruptions?.length) {
  // Store result.state SERVER-SIDE (OpenAI warns snapshots are not authenticated), keyed by your run.
  // When KollGuard says it is decided (a decision webhook, or a poll):
  const { approved, rejected, pending } = await resolveInterruptions(result.state, kg);
  if (pending === 0) result = await run(agent, result.state);
}

resolveInterruptions asks KollGuard for every interrupted call (same key, so it replays the original request) and approves or rejects only on KollGuard’s answer. Without the resumable capability needsApproval waits inline. Enforcement is cooperative.

LangGraph (JavaScript)

@kollguard/langgraph gates the tool calls of a LangGraph (JS) agent. A held call interrupts the graph, and you resume it with new Command({ resume }) when the person has decided.

npm install @kollguard/langgraph @kollguard/core @langchain/langgraph langchain
export KOLLGUARD_AGENT_TOKEN=kgw_…
import { createAgent } from 'langchain';
import { MemorySaver } from '@langchain/langgraph';
import { createKollGuard } from '@kollguard/core';
import { kollguardMiddleware } from '@kollguard/langgraph/middleware';

const kg = createKollGuard({ contract: 'auto' });   // 'auto' lets long approvals interrupt the graph

const agent = createAgent({
  model, tools: [sendEmail, refund],
  middleware: [kollguardMiddleware(kg)],
  checkpointer: new MemorySaver(),                  // required to pause and resume
});

Not using createAgent? Wrap the tools and pass them to a ToolNode, createReactAgent or your own graph: new ToolNode(guardTools([sendEmail, refund], kg)). With the resumable capability a pending call interrupts the graph with { kind: 'kollguard_approval', kollguard_request_id, tool, reason, expires_at } (no argument values); without it the tool node waits inline (120 s by default).

const config = { configurable: { thread_id: 'order-1042' } };
const first = await agent.invoke({ messages: [{ role: 'user', content: 'Refund order 1042' }] }, config);

if (first.__interrupt__?.length) {
  // Show first.__interrupt__[0].value.kollguard_request_id to your approver, or wait for the decision webhook.
  // When KollGuard says it is decided:
  const done = await agent.invoke(new Command({ resume: 'decided' }), config);
}

The resume value is never an approval: the same idempotency key (thread_id plus tool-call id) replays the original request. If KollGuard says allow the tool runs; deny refuses it; still pending interrupts again. Enforcement is cooperative.

Python: LangGraph and OpenAI Agents

The kollguard package has no runtime dependencies (stdlib only), supports sync and async, and runs on Python 3.9+. The adapters are optional extras. The LangGraph and OpenAI Agents extras need Python 3.10+, and LangGraph with async graphs and approvals needs 3.11+.

pip install "kollguard[langgraph]"
pip install "kollguard[openai-agents]"
export KOLLGUARD_AGENT_TOKEN=kgw_...

LangGraph

Swap ToolNode for the gated one, compile with a checkpointer, and resume with Command(resume=...) after the human decides.

from kollguard import KollGuard
from kollguard.langgraph import kollguard_tool_node
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.types import Command

kg = KollGuard(policy={"tools": {"send_email": {"class": "external_comm"},
                                 "lookup":     {"class": "read", "fail": "open"}}})

graph.add_node("tools", kollguard_tool_node([send_email, lookup], kg))      # step 1
app = graph.compile(checkpointer=InMemorySaver())                           # step 2

out = app.invoke({"messages": [("user", "email the customer")]}, {"configurable": {"thread_id": "t1"}})
if "__interrupt__" in out:                                                  # pending approval
    print(out["__interrupt__"][0].value)   # {"kind": "kollguard_approval", "kollguard_request_id": ..., ...}
    # ...the approver clicks Approve in KollGuard...
    out = app.invoke(Command(resume=True), {"configurable": {"thread_id": "t1"}})   # step 3

Allow runs the tool; deny returns a ToolMessage(status="error") to the model and the tool never runs; pending calls interrupt(). On resume, thread_id plus tool_call_id makes the second check a replay of the same request. The resume value is never treated as approval: KollGuard is asked again.

OpenAI Agents SDK

Wrap your tools with guard_tool; a call that needs a human stops the run with an interruption; after the decision, resolve the interruptions and run again from the state.

from agents import Agent, Runner, function_tool
from kollguard import KollGuard
from kollguard.openai_agents import guard_tool, aresolve_interruptions

kg = KollGuard(policy={"tools": {"refund": {"class": "money_auth"}}})

@function_tool
def refund(order_id: str) -> str: ...

agent = Agent(name="support", tools=[guard_tool(refund, kg)])                # step 1
result = await Runner.run(agent, "refund order 42")                          # step 2
while result.interruptions:
    # ...wait for the approver in KollGuard...
    state = result.to_state()
    await aresolve_interruptions(state, kg)      # approves/rejects each call from KollGuard's answer   (step 3)
    result = await Runner.run(agent, state)

Do not enable RunConfig.tool_execution.pre_approval_tool_input_guardrails together with guard_tool: the guardrail would run before the pause and turn a pending call into a refusal.

Any other Python agent

d = kg.gate("send_email", {"to": to, "body": body}, framework="my-agent", resource="mail:outbound")
if not d.allowed:            # d.decision is "deny" or "pending"; d.reason says why
    raise PermissionError(d.reason)

kg.decide() asks once, kg.gate() also waits inline (default 120 s) for a human, and kg.wait_for_decision(request_id) polls. The async twins are adecide, agate, await_decision and apoll. None of them raise for an answer or a network problem. Enforcement is cooperative.

Resumable approvals and webhooks

With contract="auto" the client asks GET /v2/policy once and uses the v2 contract when the server lists it. A resumable wait returns pending at once and needs stable ids (a resumable wait with none raises KollGuardConfigError). The LangGraph and OpenAI Agents adapters choose resumable by themselves when the server reports it, and file an inline (15 minute) request otherwise.

kg = KollGuard(contract="auto")          # probes GET /v2/policy once; the default "v1" never uses resumable
kg.capabilities()                        # ["v2", "resumable", "webhooks", "quorum"]

d = kg.decide("refund", args, action_class="money_auth", ids=(run_id, tool_call_id), wait="resumable")
if d.pending:                            # d.resumable is True; returned at once, nothing is polling
    suspend(d.request_id, d.expires_at)
# ...when the run resumes (any process), call decide() again with the SAME ids:
d = kg.decide("refund", args, action_class="money_auth", ids=(run_id, tool_call_id), wait="resumable")

Verify decision webhooks with verify_webhook, which is byte-compatible with @kollguard/core; see Decision webhooks.

Gate API reference

The fast gate is a small edge function. Base URL:

https://slqciomtynfaxdxbgkqp.supabase.co/functions/v1/agent-gate

Authenticate every request with the agent’s token in an x-agent-token: kgw_… header. Send and receive JSON. The packages switch to this URL when you set KOLLGUARD_API_URL to it. Every response carries a Server-Timing header.

Routes

MethodPath (after the base URL)ContractPurpose
POST/api/agent-watch/authorizev1Ask for a decision.
GET/api/agent-watch/authorize/:requestIdv1Poll one request.
GET/api/agent-watch/authorize/mcp-policy?server=v1Per-tool MCP policy for a registered server (used by MCP Guard).
POST/v2/decidev2Ask for a decision; the v1 body plus evidence fields.
GET/v2/decide/:requestIdv2Poll one request.
GET/v2/policy[?server=]v2Capabilities, the agent’s effective posture and, with server, its MCP policy.

The v1 routes keep the original contract, so existing clients (MCP Guard, the Claude Code hook) work by pointing KOLLGUARD_API_URL at the gate URL. v2 adds evidence fields to the request and reasonCode to the answer. Pending decisions are approved or denied by people in the KollGuard app, not through this API.

Decide: POST /v2/decide

FieldRequiredRules
actionrequiredPrintable ASCII, up to 200 characters, for example stripe.refund.
actionClassoptionalread, propose, write, external_comm, money_auth, phi_access or patient_facing. Missing or unknown becomes unclassified, which always goes to a person.
resourceoptionalPrintable ASCII, up to 500 characters. Redacted before it is stored. Send a short id or template, not a value.
summaryoptionalFree text, up to 1,000 characters, no control or invisible characters. Redacted before it is stored.
idempotencyKeyoptionalUp to 200 characters of A-Z a-z 0-9 . _ : -. The same key with the same action returns the same request; the same key with a different action is a 409.
mcpServer, tooloptional, togetherThe MCP server URL (up to 500) and tool name (up to 200, no spaces). Applies the per-tool MCP policy from Agent Control.

The v2 evidence fields, all optional. Unknown fields are rejected with a 400.

FieldRules
frameworkLowercase [a-z0-9._-], 1-40 characters, for example langgraph.
sdkVersion, runRefUp to 40 and 200 printable ASCII characters.
traceId, spanId32 and 16 lowercase hex characters (W3C ids, not all zeros). spanId needs traceId. They join the decision to its spans in the evidence record.
argNamesUp to 64 argument names, 1-100 printable characters each, no spaces. Names only, never values.
argsHmac, policyHash64 lowercase hex characters each (HMAC-SHA-256 of the arguments with a salt that stays on your host; SHA-256 of your policy file).
wait"inline" (default; the agent polls; 15 minutes) or "resumable" (the run may suspend; 72 hours, or 7 days on Enterprise). "resumable" needs an idempotencyKey: a resumed run must send the same key, so build it from run and tool-call ids, never from the time. Without one the request is a 400.
callbackThe id (lowercase uuid) of a decision webhook registered in your workspace. A webhook that is not yours is a 400 and the request is denied. v2 only: the v1 route rejects the field.
curl -X POST https://slqciomtynfaxdxbgkqp.supabase.co/functions/v1/agent-gate/v2/decide \
  -H "x-agent-token: kgw_..." \
  -H "Content-Type: application/json" \
  -d '{
    "action": "stripe.refund",
    "actionClass": "money_auth",
    "resource": "stripe:refund",
    "idempotencyKey": "run-812:call-3",
    "framework": "my-agent",
    "argNames": ["amount", "charge_id"]
  }'
// 200, pending (v2 adds reasonCode)
{
  "decision": "pending",
  "requestId": "3f0c…",
  "reason": "…",
  "reasonCode": "policy_requires_human",
  "expiresAt": "2026-11-19T10:15:00.000Z",
  "pollAfterMs": 5000
}

// 200, allow
{ "decision": "allow", "requestId": "3f0c…", "reason": "…", "reasonCode": "in_write_scope", "validUntil": "2026-11-19T10:15:00.000Z" }

Reason codes (v2 only): malformed_input, internal_error, tenant_kill_switch, agent_not_runnable, policy_off, policy_requires_human, unclassified_requires_human, class_never_auto, destructive_action, irreversible_agent, no_write_scopes, outside_write_scope, read_allowed, in_write_scope, mcp_server_unregistered, mcp_tool_denied, mcp_tool_requires_human.

Idempotency: retry a request with the same idempotencyKey and the same action and you get the same request back instead of a second one, with the live posture re-applied (a kill switch engaged after an approval turns the answer into deny). The evidence fields are not part of that comparison, so a retry with a new span id still replays.

Poll: GET /v2/decide/:requestId

curl https://slqciomtynfaxdxbgkqp.supabase.co/functions/v1/agent-gate/v2/decide/<requestId> \
  -H "x-agent-token: kgw_..."

// 200
{
  "decision": "allow",          // allow | deny | pending
  "requestId": "3f0c…",
  "status": "approved",         // pending | approved | denied | expired | auto_allowed | auto_denied
  "reason": "…",
  "validUntil": "…"             // allow only
}
// pending also carries expiresAt and pollAfterMs; act only on "allow", and only before validUntil.

Poll at pollAfterMs (5,000). An inline pending request expires, and reads as deny, after 15 minutes (a resumable one: 72 hours, or 7 days on Enterprise). An allow is valid for 15 minutes from when it was granted, or, for a resumable approval, from its first use. After that, send a new request with a new idempotency key. Treat deny, expired, any non-200, a timeout and an unparseable body as deny.

Policy: GET /v2/policy

Lets an SDK sync before it asks: which capabilities the server supports, whether the agent can run right now, and, when you pass server (up to 500 characters), the per-tool MCP policy for that server.

curl "https://slqciomtynfaxdxbgkqp.supabase.co/functions/v1/agent-gate/v2/policy?server=https://api.githubcopilot.com/mcp" \
  -H "x-agent-token: kgw_..."

// 200
{
  "contract": "v2",
  "capabilities": ["v2", "resumable", "webhooks", "quorum"],
  "agent": {
    "agentId": "…",
    "runnable": true,                // false adds notRunnableReason
    "autonomyTier": "…", "lifecycleStage": "…", "decisionStatus": "…",
    "classModes": { … }
  },
  "mcp": { "registered": true, "policy": { "defaultMode": "…", "unknownTools": "…", "tools": { … }, "updatedAt": "…" }, "baseline": …, "pollAfterMs": 60000 },
  "pollAfterMs": 5000
}

The v1 equivalent, GET /api/agent-watch/authorize/mcp-policy?server=, returns the mcp object (registered, policy, baseline, pollAfterMs of 60,000) and needs the server parameter. capabilities is ["v2", "resumable", "webhooks", "quorum"]. SDKs use a feature only when it is listed, so an older server keeps working: a resumable wait falls back to an inline wait and a callback is dropped.

Tokens and scopes

A kgw_ token belongs to one agent. It can carry the scopes ingest (heartbeats and OTLP spans), gate (decide and poll) and policy (policy reads); a token carries all three unless it is restricted. A token can also have an expiry; without one it does not expire. A token that is not allowed to call a route gets a 403, and an expired token gets a 401. Rotate a token in Agent Watch if it leaks.

Errors

The token routes fail closed: every error answers "decision": "deny", so a client that only reads decision still does the safe thing.

StatusMeaning
400Body failed validation (unknown field, value too long, wrong type). The response is still deny-shaped: decision "deny" with the problem in reason and error.
401"invalid agent token" (missing, malformed, not a kgw_ token, or unknown) or "agent token expired". Never treat as allow.
403The token lacks the scope for this route ("this agent token is not allowed to call this endpoint"), or the agent has no workspace.
404Poll only: no such request for this agent. An agent can read only its own requests.
409The idempotencyKey was already used for a different action.
429Rate limited (Retry-After header, seconds), or "too many pending requests": the agent already has 50 open inline requests, or 500 open resumable ones. Both answer decision "deny".
500, 503Internal error, audit log unavailable, or the decision could not be saved or finalised. Always answered as deny, never as allow.

Rate limits

ScopeLimit
POST /v2/decide, POST /api/agent-watch/authorize120 requests per minute per token
Poll routes and policy routes600 requests per minute per token
Fresh decisions, whole workspace6,000 per minute across all agents
Open pending requests50 inline and 500 resumable per agent
Per source IP1,200 requests per minute, as a coarse backstop

Over a limit the gate answers 429 with a Retry-After header in seconds and a deny-shaped body. The packages treat a 429 as “KollGuard could not answer” and apply the tool’s fail mode.

Long approvals, webhooks & quorum

A person may take hours to answer, and an agent run should not sit polling. Resumable approvals let the run suspend and pick up later; signed webhooks tell you when to resume; approver routes decide who may approve and whether two people must.

Resumable approvals

Inline (default, and v1)Resumable
Requestwait: "inline", or no wait fieldwait: "resumable" (v2; needs the resumable capability)
A person has15 minutes72 hours, or 7 days on Enterprise. A workspace can shorten it per action class, never below 15 minutes.
The agentpolls every pollAfterMssuspends. Nothing is polling.
Open requests per agent50500
An approval is valid15 minutes from the approval15 minutes from its first use
curl -X POST https://slqciomtynfaxdxbgkqp.supabase.co/functions/v1/agent-gate/v2/decide \
  -H "x-agent-token: kgw_..." \
  -H "Content-Type: application/json" \
  -d '{
    "action": "stripe.refund",
    "actionClass": "money_auth",
    "idempotencyKey": "run-812:call-3",     // required for a resumable wait; build it from ids, never from the time
    "wait": "resumable",
    "callback": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa"
  }'

// 200
{ "decision": "pending", "requestId": "3f0c…", "reasonCode": "policy_requires_human",
  "waitMode": "resumable", "expiresAt": "2026-11-22T10:00:00.000Z", "pollAfterMs": 5000, "reason": "…" }

// Hours later, the same request again: the stored request is replayed.
//   approved and used the first time  -> { "decision": "allow", "validUntil": <first use + 15 min>, … }
//   denied, or expired unanswered     -> { "decision": "deny", … }
  • Resume by re-deciding with the same idempotencyKey. The server replays the stored request with the live posture applied (a kill switch engaged in the meantime turns it into deny). There is no separate resume call or token.
  • Validity is counted from first use. An approved resumable request is redeemed the first time you re-decide or poll it, and the 15-minute allow starts then. If it is not used before the request’s window ends, it reads as expired, which is a deny.
  • The key must be stable: run id plus tool-call id, never the time. A resumable request without an idempotencyKey is a 400.
  • An expired request, or an expired allow, is a deny. Send a new request with a new key to ask again.

The packages do this for you: with contract: 'auto' (TypeScript) or contract="auto" (Python) they read GET /v2/policy and use wait: "resumable" when the run can suspend and the server lists resumable. Otherwise they wait inline.

Decision webhooks

Register an https endpoint, name it in the callback field of a request, and KollGuard calls it when the request is decided: a person approves (the vote that meets the quorum), a person denies, or the request expires. Auto decisions are answered in the response and send nothing.

POST /api/agent-watch/authorizations/webhooks          (signed-in owner or admin)
{ "url": "https://hooks.example.com/kollguard", "description": "run resumer" }

// 201
{ "webhook": { "webhookId": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa", "url": "…", "secretPrefix": "whsec_AbCd", "enabled": true, … },
  "secret": "whsec_…" }          // shown ONCE; POST …/webhooks/:id/rotate issues a new one

Registering, editing, rotating and deleting webhooks is for signed-in owners and admins (up to 20 per workspace). In the app, open Agents → Approvals → Decision webhooks; the same actions are available through the signed-in session API shown above (app-session routes, not agent-token routes). The signing secret is kept in a vault and shown once. Deleting a webhook does not stop requests that named it; they simply get no callback.

What KollGuard sends

POST https://hooks.example.com/kollguard
Content-Type: application/json
User-Agent: KollGuard-Webhooks/1
webhook-id: 6c1f…                  // the delivery id: the SAME on every retry, so dedupe on it
webhook-timestamp: 1795000000      // unix seconds of THIS attempt (fresh on each retry)
webhook-signature: v1,Zm9v…        // v1,base64(HMAC-SHA256(key, "<webhook-id>.<webhook-timestamp>.<raw body>"))

{"requestId":"3f0c…","decision":"allow","idempotencyKey":"run-812:call-3","runRef":"run-812","framework":"my-agent"}

The body is flat: requestId, decision (allow, deny or expired), and, when the request had them, idempotencyKey, runRef and framework. It never carries the action, resource, summary, reason or who approved.

Verify the signature

The signature is a Standard Webhooks style HMAC. The key is the base64-decoded part of the whsec_ secret. Sign the delivery id, the timestamp and the raw body joined by dots, and compare in constant time. Reject timestamps more than 300 seconds from now. A header may hold several space-separated signatures.

// Express: use the RAW body, not a re-serialised one
app.post('/kollguard', express.text({ type: '*/*' }), async (req, res) => {
  try {
    const p = await kg.verifyWebhook({ headers: req.headers, body: req.body }, { toleranceSec: 300 });
    // secret: createKollGuard({ webhookSecret }) or KOLLGUARD_WEBHOOK_SECRET (the whsec_… value)
    await resumeRun(p.runRef ?? p.idempotencyKey, p.requestId);   // then re-decide with the same key: that answer is the truth
    res.sendStatus(204);
  } catch { res.sendStatus(400); }
});
// Standalone: import { verifyWebhook, signWebhook } from '@kollguard/core';
from kollguard import verify_webhook, WebhookError

@app.post("/kollguard")                                      # Flask shown
def kollguard_hook():
    try:
        p = verify_webhook(request.headers, request.get_data(), WEBHOOK_SECRET)   # the RAW body
    except WebhookError:
        return "", 400
    resume_run(p["requestId"], p.get("runRef"))              # then re-decide with the same ids
    return "", 204

verifyWebhook (TypeScript) and verify_webhook (Python) throw on any problem and return the parsed payload. Both are tested against signatures produced by the live signer.

Retries and ordering

  • Any answer other than 2xx, a timeout (8 seconds) or a connection failure is retried: after 30 s, 2 min, 10 min, 30 min, 1 h, 2 h and 6 h. That is 8 attempts in all, then KollGuard gives up on that delivery.
  • The webhook-id is the same on every retry and the timestamp is fresh. Dedupe on the id, and return 2xx quickly.
  • Callbacks are advisory. The agent’s re-decide with the same idempotency key is the source of truth, so a lost, late or forged callback can only delay a run, never allow one. Do the re-decide before you act.
  • An expiry is reported by a once-a-minute sweep, so an expired callback can arrive up to a minute or so after the deadline.

URL rules

  • https only, port 443 or 8443, no credentials in the URL, up to 2,000 characters.
  • The host must be a real name or a public IP address. localhost, .local and .internal names, private, loopback, link-local and metadata addresses, and IPv4-mapped IPv6 literals are refused.
  • SSRF guard. Every address the name resolves to must be public, checked when you register and again before every send. The connection is pinned to the checked address, so a DNS change cannot redirect it, and redirects are not followed.
  • The URL is stored with the webhook, so do not put a secret in it. KollGuard never logs it, and audit entries record only the host.

Approver routes and the two-person rule

By default one owner or admin (or an agent_approver) can approve a pending request. A route narrows who may decide and can require two different people. The most specific enabled route wins: agent and class, then agent, then class, then the workspace default. The route is copied onto each request when it is filed, so editing or deleting a route never lowers the bar for a request that is already waiting.

Set routes up in the app under Agents → Approvals → Approver routes (approval settings, approver routes and decision webhooks all live on that screen), or call the signed-in session API:

POST /api/agent-watch/authorizations/routes                 (signed-in owner or admin)
{
  "agentId": null,                      // one agent, or null for every agent
  "actionClass": "money_auth",          // one class, or null for every class
  "approverActorIds": ["<member id>", "<member id>"],   // up to 20 named people; or use approverRole
  "approverRole": null,                 // "admin" (owners and admins) or "agent_approver"
  "requiredApprovals": 2,               // 1 or 2 different people
  "forbidRequester": true               // default true: the agent's owner cannot decide its requests
}
// GET lists routes (any member); PATCH /routes/:id edits (agentId and actionClass cannot change); DELETE removes.
RuleWhat happens
approverActorIdsOnly those people may approve or deny (up to 20). They must be members who can decide agent requests.
approverRole"admin": owners and admins only. "agent_approver": agent approvers, owners and admins. With neither a named list nor a role the route is refused.
requiredApprovals: 2Two different people must approve. Each vote is audited before it counts, one vote per person, and the request stays pending until the second. A route with two required approvals needs at least two named approvers, or a role.
forbidRequester (default true)The owner of the agent that asked cannot approve its requests on this route.
DenyingOwners and admins can always deny, on every route, including their own agent’s requests. One deny ends the request, even before the quorum is met.

agent_approver is a member role that can decide agent requests but cannot change who decides or where callbacks go: creating routes and webhooks needs an owner or admin. Every vote, approval and denial lands in the audit log.

Evidence

Decisions say what was allowed. Spans say what the agent then did. KollGuard stores both, links them, and seals each day’s spans so later changes are detectable.

Export spans (OTLP)

Point an OpenTelemetry OTLP/HTTP JSON trace exporter at the ingest route, with the agent’s token in x-agent-token (or Authorization: Bearer, for exporters that can only set that header):

POST <api base>/api/agent-watch/otel/v1/traces

With @kollguard/core, the span processor does the batching:

import { NodeSDK } from '@opentelemetry/sdk-node';
new NodeSDK({ spanProcessors: [kg.spanProcessor()] }).start();   // OTel is an optional peer; core never imports it
kg.exportSpans(spans);                                           // or feed spans from a framework's own tracing hook
await kg.flush();
LimitValue
FormatOTLP/HTTP JSON. OTLP/protobuf is refused with a 415; set OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/json.
Request sizeUp to 1,000 spans and 4 MB after decompression. gzip is accepted.
Per workspace60,000 spans per minute across all agents. Over it you get a 429 with Retry-After.
Evidence store downA retryable 503 with Retry-After, so the exporter’s retry cannot duplicate runs.

@kollguard/core batches every 5 s or 100 spans, drops the oldest at 10,000 queued spans, and never blocks or throws into the agent. Only allowlisted attributes are exported: names, ids, timings, status code, model, token counts and server.address.

What is stored

  • One row per span: its kind (agent, tool, model, guardrail, approval, eval or other), framework, tool name, status and timing.
  • Argument names and the SDK’s argument HMAC, plus a small allowlist of attributes.
  • The controls the row is evidence for (for example SOC 2 CC6 and CC7, HIPAA 164.312(a)(1) and (b), EU AI Act Art. 9, 12, 14 and 15).
  • A link to the gate decision, through kollguard.request_id or the trace and span ids.

Never stored: prompts, completions, tool results and argument values.

Read a trace: GET /api/agent-watch/evidence/:traceId

Returns one trace’s spans (up to 1,000), the decisions they link to, the day seal, and each span’s inclusion proof. It is a workspace-scoped read for signed-in users with Agent Watch access, not an agent-token route. The trace id is 32 hex characters.

GET /api/agent-watch/evidence/<traceId>      // traceId: 32 hex characters

{
  "traceId": "…",
  "spans": [ { "span_id": "…", "kind": "tool", "tool_name": "…", "status": "…", "arg_names": […],
               "controls": […], "authorization_request_id": "…",
               "proof": { "date": "2026-11-18", "leaf": "…", "index": 4, "size": 212, "path": ["…"] } } ],
  "decisions": [ { "request_id": "…", "action": "…", "action_class": "…", "status": "…", "decided_at": "…" } ],
  "seals": [ { "date": "2026-11-18", "sealed": true, "span_count": 212, "merkle_root": "…",
               "alg": "merkle-sha256-rfc6962/leaf-v1", "sealed_at": "…",
               "recomputedRoot": "…", "intact": true } ]
}

Daily seal and verification

  • Each night at 00:41 UTC, every workspace’s spans from the previous UTC day (by the time KollGuard received them) are hashed into one Merkle tree, in the RFC 6962 / RFC 9162 form: leaf = SHA-256(0x00 || leaf bytes), node = SHA-256(0x01 || left || right), an odd last node carried up unchanged, leaves ordered by trace id and span id.
  • The root is stored in an evidence seal and written to your hash-chained audit log as one agent_evidence.sealed row. Re-running a seal never adds a second row.
  • A day that is not closed yet shows sealed: false. Its spans are still stored, but not yet covered by a root.

To check a span:

  1. Read intact on the seal. KollGuard recomputes the day’s root from the stored rows and compares it with the sealed root and span count.
  2. Or recompute it yourself: starting from the span’s proof.leaf, combine it with each hash in proof.path using the node rule above (the index and size say which side each hash is on), and compare the result with merkle_root.
  3. Check that the root appears in your audit log as agent_evidence.sealed, and verify the audit log’s own hash chain.

Retention

PlanSpan evidence kept
Free30 days
Starter180 days
Growth, Scale, Enterprise365 days
  • Paid plans never keep spans for less than 180 days, because EU AI Act Art. 26(6) asks deployers of high-risk AI systems to keep the logs they control for at least six months. Retention helps with that duty; it does not by itself make a system compliant.
  • Span rows are deleted (around 01:53 UTC) only after their day is sealed. The seal is kept.
  • Gate decisions, approvals and the audit log are kept for at least six years and are not touched by the retention job.
  • The tier used is the higher of the plan and any complimentary tier, so a billing problem never shortens retention.

Security

What leaves your host

DataSent?Notes
Tool name, action, action class, resource stringYesThe resource is redacted server-side before storage. Use short ids or templates.
Argument namesYesNames only.
Argument valuesNeverOn contract v2 only an HMAC of the arguments is sent; the salt stays on your host.
Prompts, completions, tool resultsNeverStripped from spans by the exporter’s attribute allowlist and not accepted by the gate.
File paths and command lines (Claude Code)NeverThe hook sends a path class (in-project, outside-project, sensitive-name) and the first word of each command segment, not the text.
The kgw_ tokenHeader onlySent in x-agent-token (or Authorization: Bearer on the OTLP route). Never logged and never put in an error message.

Free text that does reach KollGuard (action, resource, summary) is limited to printable ASCII or clean text, capped in length, and redacted for personal data before it is stored. The audit row holds keys and enums only, not the summary or resource.

Token handling

  • Treat a kgw_ token like a password. It is shown once. KollGuard looks tokens up by hash, so a lost token cannot be shown again; rotate it.
  • Load it from the environment or a secret manager. Do not put it in a settings file that you commit.
  • The token is accepted only in the x-agent-token header, or as a Bearer token on the OTLP route. It is never logged or echoed in an error.
  • Tokens are per agent. Disabling an agent, engaging its kill switch or the workspace kill switch turns every later answer, including a replay of an earlier approval, into deny.
  • The read-only kgr_ API key used by the findings API and MCP server is a different credential and cannot call the gate.

Fail-open and fail-closed

  • The server fails closed. A validation error, an internal error, an unreachable audit log or a failed save all answer deny. An allow is returned only after it is saved, audited and promoted.
  • Clients choose per tool what to do when KollGuard cannot answer (timeout, DNS, 5xx, 429). "fail": "closed" blocks. "fail": "open" lets the call run, and is allowed only for read and propose. A policy that fails open for write or above is refused.
  • An explicit deny is always honoured, and a bad token (401) is never failed open. Every fail-open is counted and reported as an unverified_allow span.
  • Default for the Claude Code hook: write tools and MCP tools closed, web tools closed, read-only tools open, unknown tools closed. MCP Guard has no fail-open flag. The default for anything unclassified is closed.
  • There is no local allow cache. An allow is valid only once the server has persisted and audited it.

Audits

KollGuard records who or what asked, what class of action, who approved it and when, and keeps that in a hash-chained log with sealed span evidence alongside. That supports your SOC 2, HIPAA and EU AI Act evidence work. It does not replace your auditor, and nothing here is a certification of your agents or of KollGuard.

Local mode: no signup

Try the real decision logic with no account and no network. Local mode runs the same pure decision modules the hosted gate runs (a checked copy of the server code, with a test that fails on drift) against the posture in your policy file’s local block: classModes, writeScopes, autonomyTier, reversibility, patientImpacting and kill switches.

npx kollguard init                               # writes kollguard.policy.json with a "local" block
KOLLGUARD_MODE=local npx kollguard decide --tool stripe.refund --class money_auth
npx kollguard dev                                # viewer at http://127.0.0.1:4747
const kg = createKollGuard({ mode: 'local', policy: './kollguard.policy.json' });
  • kollguard decide exits 0 for allow, 1 for deny and 2 for pending or error, so it also works in CI to check a policy.
  • Decisions are appended to .kollguard/dev.jsonl (names and classes only) and marked evidence: false.
  • This is a parity simulator, not a gate. Nothing is audited and there are no human approvers: a step that needs one is denied unless you pass local.onPending.

The CLI is kollguard init | decide | dev | policy | doctor. When you are ready, create an agent token and drop the local mode flag.

Findings API & MCP server (read-only)

Separately from the agent gate, you can read your KollGuard findings and posture from an AI agent in your IDE, a CLI, or CI, with a read-only key.

To connect Claude or another web assistant without a key, use the remote connector: MCP connector setup.

1. Create an API key

In KollGuard go to Settings → API keys and create a key. It's shown once — copy it. Keys look like kgr_… and are read-only: they can read findings, posture, scans, and stats, and can never change anything. Revoke a key any time.

2. Connect your IDE (MCP)

Add the KollGuard MCP server to your client's config, with your key. It's the open-source kollguard-mcp package — run via npx, nothing to install. The same snippet works in every MCP client:

{
  "mcpServers": {
    "kollguard": {
      "command": "npx",
      "args": ["-y", "kollguard-mcp"],
      "env": { "KOLLGUARD_API_KEY": "kgr_your_key_here" }
    }
  }
}
ClientWhere the config lives
Claude Code.mcp.json in your project root (or `claude mcp add`)
Claude Desktopclaude_desktop_config.json (Settings → Developer → Edit Config)
Grok CLI.grok/settings.json (or /mcps in the TUI)
Cursor.cursor/mcp.json
VS Code.vscode/mcp.json (native), or your Cline / Continue extension settings
Windsurf~/.codeium/windsurf/mcp_config.json (Settings → MCP)
Zedsettings.json → context_servers
Goose~/.config/goose/config.yaml (extensions), or `goose configure`

MCP is an open standard, so any MCP-compatible client works — the JSON above is identical everywhere; only the file location differs. Then ask your agent things like: “List my KollGuard projects, then pull the open critical & high findings for the api-server project and propose fixes.” (In a multi-project org, have it call kollguard_list_projects first, then pass that projectId to the other tools.)

Tools the server exposes

kollguard_list_projectsYour projects (repo/db groups) with ids — call first to pick one in a multi-project org
kollguard_list_findingsFindings (filter by projectId / severity / status / framework), each mapped to controls + remediation
kollguard_get_postureOpen findings, risk score, per-framework gaps, top risks (incl. a byProject breakdown)
kollguard_list_scansRecent scan runs with severity counts
kollguard_statsHeadline stats: open findings, by severity & framework, scans last 7 days

3. Or use the REST API directly

Prefer a script or CI step? Hit the API with the same key. Base URL https://api.kollguard.com/v1:

curl -H "Authorization: Bearer kgr_your_key_here" \
  https://api.kollguard.com/v1/findings
EndpointReturns
GET /v1/findingsFindings, optional ?severity= ?status= ?framework=
GET /v1/postureAggregated posture + top risks
GET /v1/scansRecent scan runs
GET /v1/statsHeadline stats

All endpoints are GET and tenant-scoped to the key. Findings are JSON, each mapped to SOC 2 / HIPAA + 10 more frameworks with remediation.

FAQ

What can a KollGuard API key do?
A `kgr_` API key is read-only and GET-only: it can read your findings, posture, scans, and stats, but can never change anything in your account. Create and revoke keys in Settings → API keys. It is separate from the `kgw_` agent token used by the agent gate.
Which IDEs and tools work with the KollGuard MCP server?
Any MCP-compatible client — Claude Code, Cursor, VS Code (Cline/Continue), Windsurf, and Zed all use the same config shape. The server is the npm package kollguard-mcp, run via npx. The REST API works with any HTTP client (curl, a CI step, a script).
What is the KollGuard API base URL?
https://api.kollguard.com/v1 — for example, https://api.kollguard.com/v1/findings. Authenticate with an Authorization: Bearer kgr_… header. The agent gate has its own base URL, shown in the gate API reference on this page.
Do I need an SDK to use the agent gate?
No. The gate is HTTP: one POST to ask, and one GET to poll while the answer is pending, authenticated with the agent’s kgw_ token in the x-agent-token header. The packages (@kollguard/core, @kollguard/claude-hook, @kollguard/agent-sdk, @kollguard/mcp-guard and the Python package kollguard) wrap those calls, fail modes and policy files for you.
Does KollGuard see my prompts or argument values?
No. Only tool names, argument names, an action class and a short resource string are sent. Argument values never leave your host; on contract v2 the gate receives only an HMAC computed with a salt that stays with you. Prompts, completions and tool results are stripped from exported spans.
Can an approval take days?
Yes, with resumable approvals. A request made with wait "resumable" waits up to 72 hours for a person (7 days on Enterprise) while the agent run suspends, and the agent resumes by asking again with the same idempotency key. An inline request, and anything on the v1 routes, still expires after 15 minutes. The packages choose resumable automatically when the server reports it.
How do I find out that a person decided?
Either poll, or register a signed decision webhook and name it in the callback field. KollGuard calls it when a request is approved, denied or expires, with a Standard Webhooks style signature you verify with verifyWebhook (TypeScript) or verify_webhook (Python). The callback is advisory: re-decide with the same idempotency key to read the answer.
Can I require two approvers?
Yes. An approver route can name approvers or a role and require two different people to approve. Owners and admins can always deny. The route is fixed on each request when it is filed.
Can an agent bypass the gate?
It depends on the enforcement mode. The SDK and HTTP gate are cooperative: the agent has to ask and honour the answer. The Claude Code hook and MCP Guard run on the agent’s host and apply the answer for it, but someone who controls that host can remove them. Pair the gate with credentials that are only issued after an allow when a deny must be a hard stop.
Does KollGuard replace my auditor?
No. The decision record, approvals and sealed span evidence are designed to support your audit work and your own controls review. The audit opinion stays with your auditor.