An Imp.Predict.ReActV2 turn that stopped because it could not get a model
response.
Imp.Predict.ReActV2 returns {:error, %StepError{}} when a request of the
turn failed and no further request could answer it: the last request of an
interrupted turn failed, or a step failed with an
Imp.OperationalSafetyError, which ends the turn at once. Two fields carry
what a caller acts on:
:reason— the failed request's error, unchanged, asImp.Predictreturns it: anImp.LMError,{:lm_failed, client, exception}for a client that raised,{:adapter_format_failed, adapter, exception}for a renderer that raised, or anImp.OperationalSafetyError.Imp.Errors.retryable?/1andImp.Errors.context_window_exceeded?/1read it through this struct, andImp.OperationalSafetyErrorguards find a safety error inside it.:history— the turn'sImp.Historyas far as it got: the history a finished turn returns in its prediction's:historymetadata, with every step that ran, its tool calls and their results, and the provider's reasoning continuation. The tools those steps called have run, so a host that keeps a conversation stores it as it stores a finished turn's.
Imp.Errors.retryable?/1 on this error answers whether the last model
request may be sent again, not whether the turn may: the tools in
:history have already run, and running the turn again from its inputs
runs them again. A host that continues continues from :history.
No partial prediction exists: a turn that stopped here has no outputs.
Inspecting the error shows the reason and how many messages the history holds, not the history: a host that logs or records an inspected error does not write the trajectory, with its provider reasoning continuation, there.
Summary
Types
@type t() :: %Imp.Predict.ReActV2.StepError{ __exception__: true, history: Imp.History.t(), message: String.t(), reason: term() }