Cortex · API
run.deny
run.deny rejects a pending approval with a reason. The tool function is not executed and the run continues: the model receives the reason as the tool result and produces its answer. The model’s turns are scripted; no model is called.
const askFirst: ToolGate = (call) =>
call.toolId === 'refund' ? { ask: { reason: 'A refund moves money.' } } : { allow: true };
const desk = defineAgent({
id: 'desk',
instructions: 'Help the member. Refund a booking when the member asks for it.',
tools: [refund],
toolGates: [askFirst],
});
const run = desk.run('Please refund my two seats for Saturday. Grace', { llm });Run, step by step
calls refund {"booking":"B-2041","amount_cents":7600}{
type: 'tool-start',
call: {
toolId: 'refund',
args: { booking: 'B-2041', amount_cents: 7600 },
},
}Runs in this page on the installed package. The input and the expected output are defined by the example.