Skip to main content
Version: 0.20.0

Step gate

The step gate is a PreToolUse hook that stops every tool call (the main agent's and its subagents') until a person answers. It's what interactive mode means. Tools that ask the person themselves (ask_human, present_plan, the approval and manual-intervention tools, request_file, retire_source) and the task list (TodoWrite) go through without asking first.

When it's active​

buildSessionOptions() registers it in guided and interactive sessions and checks the current mode on each call: while the mode is interactive it asks, otherwise it gives no decision and the call proceeds as if it weren't there. That's what lets a guided session switch to interactive and back (Modes). An autonomous session doesn't have it.

What it asks​

A decision checkpoint titled Proposed action, with the tool's name and its parameters as formatted JSON:

Proposed action
Tool: WebFetch
Parameters: {
"url": "https://example.com/news",
"prompt": "Summarize the headlines"
}

What each answer does​

AnswerValuesEffect
Yesy, yes, Enter ("")The call proceeds.
Non, anything elseThe call is denied. The model is told "Action rejected by the user in step-by-step mode." and decides what to do next.
StopqThe call is denied and the turn stops (continue: false): "Execution stopped manually by the user."

The texts for the model are always in English, whatever the kit's language; the panel is in the kit's language.

Using it in your own hook chain​

createStepGate(runDir, isActive?) is exported to build the same hook yourself, for instance in a session you assemble by hand:

import { createStepGate } from "@falkenslab/agent-kit";

const stepGate = createStepGate(runDir, () => supervised); // asks only while `supervised` is true

const options: Options = {
// …
hooks: { PreToolUse: [{ hooks: [stepGate] }] },
};