PolicyDecision
type PolicyDecision = | { kind: "allow";} | { kind: "ask"; title?: string;} | { kind: "deny"; reason: string;};Whether a tool call runs, asks a human first, or is refused.
needsApproval?: boolean on a tool answers exactly one question — “pause for a human?” —
and cannot express the things a governed run actually needs: a read-only worker, an
allowlist of shell commands, a spend lane that only gates above a threshold, or a rule
that depends on the arguments rather than the tool name. Those all want a decision
function, so the decision is the primitive and needsApproval becomes sugar over it.
Union Members
Section titled “Union Members”Type Literal
Section titled “Type Literal”{ kind: "allow";}Type Literal
Section titled “Type Literal”{ kind: "ask"; title?: string;}Suspend durably and wait for a human. title is what they are shown.
Type Literal
Section titled “Type Literal”{ kind: "deny"; reason: string;}Refuse without asking anyone. reason is surfaced to the model.