Skip to main content

Module auto_classifier

Module auto_classifier 

Source
Expand description

LLM-based permission classifier for PermissionMode::Auto.

When the agent is in Auto mode, each tool call is sent to a small classifier prompt running against the same LLM provider. The classifier returns {"block": true/false, "reason": "..."} and the result is enforced before the tool executes.

A DenialTracker prevents runaway denial loops: after 3 consecutive or 10 total denials, the classifier stops calling the LLM and blocks everything, triggering a [FinishReason::PermissionDenialLimit].

Structsยง

AutoClassifier
LLM-based classifier that decides whether a tool call should be auto-approved in PermissionMode::Auto.
DenialTracker
Tracks classifier denial counts to enforce safety limits.