Security & safety

Kopilot's premise is that an AI agent may propose anything but execute only what a policy — and where it matters, a human — allows. This page describes each layer, and just as importantly, what the layers do not guarantee.

Risk assessment

Every command a sub-agent wants to run is classified before execution: low (read-only), medium (mutating but not destructive, e.g. kubectl apply), high (destructive), or critical (blocked). A task's response reports the highest risk seen across all commands it attempted.

The approval gate

Commands classified as destructive are not executed. The set includes:

Instead of running, the executor registers a pending approval request and the agent reports the approval id in its answer. A human lists the queue (GET /approvals) and decides (POST /approvals/{id}/approve or /deny); an optional X-Kopilot-Operator header records the decider. Approvals:

Protected namespaces

Destructive commands targeting kube-system, kube-public, or kube-node-lease (configurable via SAFETY_PROTECTED_NAMESPACES) are refused outright. They never enter the approval queue — there is no override through the API.

Hard-blocked patterns

Some commands are always refused, in any namespace, with no approval path: rm -rf / variants, dd of=/dev/…, mkfs, fork bombs, shutdown/reboot/halt, and similar host-destructive patterns.

Execution limits

API security

Audit log

Every significant action is written as a structured JSON event: task submitted, command executed, command blocked, approval requested, approval approved/denied/consumed, webhook received. Ship stdout to your log pipeline and you have a reviewable trail of everything the agent did and who authorized it.

Honest limitations

Read this section before granting the agent write access to anything.