Skip to main content

Hooks classify

Classifies agent tool calls into permission tiers as part of the Docker agent pre-tool-use hook system. This endpoint is called by the hook script running inside Docker agent containers, not by end users directly. When a Docker agent invokes a tool, the pre-tool-use hook script sends the tool name and input to this endpoint. The classifier evaluates the request and returns one of three outcomes:
  • Safe — auto-approved, the agent proceeds immediately
  • Dangerous — queued for dashboard approval via the permissions API
  • Destructive — blocked, the agent cannot proceed
This endpoint uses internal API key authentication, not session-based auth. It is designed to be called by the hook script running inside the agent container, not by the dashboard or end users.

Classify a tool call

Classifies a tool call and returns a permission decision. Safe tools are auto-approved. Dangerous tools are queued for user approval and return a requestId that can be resolved through the permissions API. Destructive tools are blocked.

Authentication

Requires a valid internal API key in the Authorization header:

Request body

Response

The response shape depends on the classification tier.

Safe (auto-approved)

Dangerous (queued for approval)

Destructive (blocked)

Response fields

Errors

Hook flow

The classify endpoint is one step in the Docker agent pre-tool-use hook flow:
  1. The agent invokes a tool inside its Docker container
  2. The --hook-pre-tool-use flag triggers the hook script
  3. The hook script sends the tool details to POST /api/hooks/classify
  4. The endpoint classifies the tool call and returns a decision
  5. For dangerous tier results, the server pushes a permission_request message to the dashboard via the WebSocket endpoint (the dashboard can also poll GET /api/permissions as a fallback)
  6. The user approves or rejects via POST /api/permissions or through the WebSocket decision message
  7. The agent receives the decision and proceeds or stops
The hook system is fail-closed. If the classify endpoint is unreachable, all tool calls are denied by default.

Classification rules

The classifier evaluates tool calls using the same tiered rules described in the permissions API classification tiers. Refer to that page for the full list of safe commands, dangerous patterns, and destructive patterns.

Tool-specific classification