Skip to main content

Type Alias: TToolCallPolicyResult

TToolCallPolicyResult = { verdict: ALLOW; } | { reason: string; verdict: DENY; } | { reasonCode?: string; rejectionText?: string; verdict: NEEDS_APPROVAL; }

Defined in: contracts/types.ts:270

The verdict of a tool's policy on one call (D87): allow it, deny it with a reason, or hand it to a human.

Returned by TToolCallPolicyHandler, decided by ToolPolicy.decide and acted on by the agent loop.

Union Members​

Type Literal​

{ verdict: ALLOW; }


Type Literal​

{ reason: string; verdict: DENY; }

reason​

reason: string

Why the call is refused, as the model reads it; appended to DEFAULT_TOOL_DENIAL_TEXT. Say what would be accepted.

verdict​

verdict: DENY


Type Literal​

{ reasonCode?: string; rejectionText?: string; verdict: NEEDS_APPROVAL; }

reasonCode?​

optional reasonCode?: string

Why this call waits for a human, as a code the app translates; carried by the pause as IToolApprovalEnvelope.reasonCode.

Tells the approval card why the call waits, in the user's language.

The card renders what the call does from toolCall.toolName and its input; this says why it needs a human, when one tool pauses for more than one reason. A key of the app's translations, not text: the app owns the card and its language. Never sent to the model.

Examples​
"amountOverLimit" - the refund of 500 waits because it is above the limit of 100
"newCustomer" - the same tool pauses a first refund of any amount

rejectionText?​

optional rejectionText?: string

Sent to the model as the tool's output when the human rejects this call; the human's reason is appended.

The model does not know what a rejection means for this tool; this text tells it what did not happen and how to go on.

May depend on the input ("the refund of 800 EUR was declined").

Default​
DEFAULT_TOOL_REJECTION_TEXT

verdict​

verdict: NEEDS_APPROVAL