classify_stop#
Understand request ownership, phases, and runtime limits. See the guide.
- zett_agent.stop.classify_stop(raw, *, has_tool_calls=False, category=None, message=None, recommended_model=None, detail=None)[source]#
Turn a provider’s raw stop value into a
StopInfo.The raw value is looked up without regard to case. A step that finished (
stop,end_turn) but carries tool calls isStopReason.TOOL_USE, because that is what Gemini, which reportsSTOPeither way, means. A step with no value at all is treated as finished, or as asking for tools, so an adapter that reports nothing does not look like a failure.A refusal or an interruption with no
categorytakes the raw value as its category, so “what kind” is never empty when the provider said anything.- Parameters:
raw (str | None) – The provider’s value, or None when it gave none.
has_tool_calls (bool) – Whether the step produced tool calls.
category (str | None) – A more specific category than the raw value, when the provider has one.
message (str | None) – A sentence for a person.
recommended_model (str | None) – A model the provider suggests retrying on.
detail (Mapping[str, Any] | None) – Provider-specific facts to keep.
- Return type: