Skip to main content
While an agent runs, your application can send it new input or stop it. Name a steering signal and an interrupt signal on the run. Shared handlers then send signals to the running invocation while the exclusive handler holds the object’s lock:
  • Steering: The run records the message in its history as a user message, with the steering text in a JSON note. With a conversation, the run saves the message as described in Saving progress. The model receives it in the next step, after the current tool calls finish. A running run_program call doesn’t delay it: the program continues in the background, and the model receives its result in a later step. Steering doesn’t undo tool calls that already started. A message that the run accepts during a model call discards that call’s response, and the run asks the model again in a new step, which counts toward maxSteps.
  • Interruption: The run cancels unfinished tool calls and the child invocations of handlerTool, serviceTool, and awaitChild, and returns {status: "interrupted", reason, output}, with a summary in output, unless the agent sets finalize: false.
The chat handler stores its invocation ID in state, so steer and interrupt can read which invocation to signal. It clears the ID in finally, so a failed run leaves no stale ID behind. Interrupting a run is different from cancelling the invocation: cancellation fails the handler instead of returning a result. See Error handling. To check or redact steering messages before the run uses them, add a beforeSteering guardrail. To control the run from your own code instead of signals, pass controls: {steering, interrupt} to run. steering is a function that returns a future for the next message, and interrupt is a future that resolves to the reason.