pub struct ReActStep {
pub thought: String,
pub action: String,
pub observation: String,
pub step_duration_ms: u64,
}Expand description
A single ReAct step: Thought → Action → Observation.
Fields§
§thought: StringAgent’s reasoning about the current state.
action: StringThe action taken (tool name + JSON arguments, or “FINAL_ANSWER”).
observation: StringThe result of the action.
step_duration_ms: u64Wall-clock duration of this individual step in milliseconds. Covers the time from the start of the inference call to the end of the tool invocation (or FINAL_ANSWER detection). Zero for steps that were constructed outside the loop (e.g., in tests).
Implementations§
Source§impl ReActStep
impl ReActStep
Sourcepub fn new(
thought: impl Into<String>,
action: impl Into<String>,
observation: impl Into<String>,
) -> Self
pub fn new( thought: impl Into<String>, action: impl Into<String>, observation: impl Into<String>, ) -> Self
Construct a step with zero step_duration_ms.
Primarily useful in tests that need to build [AgentSession] values
without running the full ReAct loop.
Sourcepub fn is_final_answer(&self) -> bool
pub fn is_final_answer(&self) -> bool
Returns true if this step’s action is a FINAL_ANSWER.
Sourcepub fn is_tool_call(&self) -> bool
pub fn is_tool_call(&self) -> bool
Returns true if this step’s action is a tool call (not a FINAL_ANSWER).
Sourcepub fn with_duration(self, ms: u64) -> Self
pub fn with_duration(self, ms: u64) -> Self
Set the step_duration_ms field, returning self for chaining.
Useful in tests and benchmarks that need to build AgentSession values
with realistic timings without running the full ReAct loop.
Sourcepub fn observation_is_empty(&self) -> bool
pub fn observation_is_empty(&self) -> bool
Return true if the observation string is empty.
Useful for identifying steps where the tool produced no output.