Skip to main content
MaxSteps is a useful safety net. StopWhen adds composable product limits that are evaluated as the run progresses.
Other helpers include HasToolCall("publish_report") and FinishReasonIs("content_filter"). You can also provide a custom StopCondition when the decision depends on application context. When a condition matches, inspect result.Run.StopReason, the normalized usage totals, and the last completed step. Stopping is a successful bounded outcome unless your application chooses to treat that reason as an error.
Last modified on July 26, 2026