#[non_exhaustive]pub struct Step {Show 18 fields
pub id: String,
pub step_index: u32,
pub trajectory_id: String,
pub cascade_id: String,
pub step_type: StepType,
pub source: StepSource,
pub target: StepTarget,
pub status: StepStatus,
pub content: String,
pub content_delta: String,
pub thinking: String,
pub thinking_delta: String,
pub tool_calls: Vec<ToolCallInfo>,
pub error: String,
pub http_code: u16,
pub is_complete_response: Option<bool>,
pub structured_output: Option<Value>,
pub usage_metadata: Option<UsageMetadata>,
}Expand description
A single step in the agent trajectory, mirroring the SDK’s Step.
§Construction
Step is #[non_exhaustive], so outside this crate it can only be built
with the TypedBuilder. Every field defaults (matching Default), so
callers set only the fields they care about:
use agy_bridge::Step;
let step = Step::builder()
.id("traj:0")
.content("Running command...")
.build();
assert_eq!(step.id, "traj:0");
// Unset fields fall back to their defaults.
assert_eq!(step.step_index, 0);
assert!(step.tool_calls.is_empty());Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: StringUnique string identifier for the step.
step_index: u32Integer index of the step in the trajectory.
trajectory_id: StringIdentifier of the trajectory this step belongs to.
The SDK’s connection layer assigns one trajectory id per agent
trajectory. Compare with cascade_id to tell a
primary-agent step (trajectory_id == cascade_id) apart from a subagent
step (trajectory_id != cascade_id); see Step::is_subagent_step.
Empty when the harness did not report one.
cascade_id: StringIdentifier of the top-level cascade — i.e. the primary agent trajectory.
Every step in a turn, primary and subagent alike, shares the same
cascade_id, so it identifies the parent trajectory. A step originates
from a subagent when its trajectory_id differs
from this value. Empty when the harness did not report one.
step_type: StepTypeThe high-level type of the step.
source: StepSourceThe source that generated the step.
target: StepTargetThe target of the step interaction.
status: StepStatusThe status of the step.
content: StringThe text content/output of the step.
content_delta: StringIncremental text content added since the last update for this step.
thinking: StringFull model reasoning/thinking text for planner responses.
thinking_delta: StringIncremental thinking text added since the last update for this step.
tool_calls: Vec<ToolCallInfo>List of tool calls associated with the step.
error: StringShort error message if the step failed.
http_code: u16HTTP status code from the harness error, if any (e.g. 400, 429, 503).
The SDK populates this from the harness’s error.http_code field.
Used by error detection in forward_step_to_writer for logging.
is_complete_response: Option<bool>Whether this step is a completed model response directed at the user.
Multiple steps per turn may have this flag set; consumers wanting only the last response should iterate fully.
structured_output: Option<Value>Structured output payload extracted from the FINISH step.
This is serde_json::Value because it contains user-defined schema data
whose shape is not known at compile time.
usage_metadata: Option<UsageMetadata>Token usage for this step’s model invocation.
Implementations§
Source§impl Step
impl Step
Sourcepub fn builder() -> StepBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>
pub fn builder() -> StepBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>
Create a builder for building Step.
On the builder, call .id(...)(optional), .step_index(...)(optional), .trajectory_id(...)(optional), .cascade_id(...)(optional), .step_type(...)(optional), .source(...)(optional), .target(...)(optional), .status(...)(optional), .content(...)(optional), .content_delta(...)(optional), .thinking(...)(optional), .thinking_delta(...)(optional), .tool_calls(...)(optional), .error(...)(optional), .http_code(...)(optional), .is_complete_response(...)(optional), .structured_output(...)(optional), .usage_metadata(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of Step.
Source§impl Step
impl Step
Sourcepub fn is_subagent_step(&self) -> bool
pub fn is_subagent_step(&self) -> bool
Whether this step originates from a subagent trajectory rather than the primary agent’s.
Mirrors the SDK’s own parent/subagent discrimination
(cascade_id AND trajectory_id AND trajectory_id != cascade_id): a step
is a subagent step only when it carries a known parent
cascade_id and a
trajectory_id that differs from it. Steps
missing either id — e.g. from mocks or older harnesses — are treated as
primary.