pub struct SequentialBuilder { /* private fields */ }Expand description
Builder for a sequential pipeline of agents. Rust analogue of
SequentialBuilder. Each participant sees the running conversation and
appends its reply; the final conversation is yielded as output.
Implementations§
Source§impl SequentialBuilder
impl SequentialBuilder
Sourcepub fn with_checkpointing(
self,
storage: Arc<dyn CheckpointStorage>,
) -> SequentialBuilder
pub fn with_checkpointing( self, storage: Arc<dyn CheckpointStorage>, ) -> SequentialBuilder
Enable checkpointing of the built workflow to storage at each
superstep boundary, as upstream’s checkpoint_storage /
with_checkpointing (required for a hosted workflow to pause and
resume).
Sourcepub fn new() -> SequentialBuilder
pub fn new() -> SequentialBuilder
Create an empty builder.
Sourcepub fn participants(
self,
agents: impl IntoIterator<Item = Arc<dyn SupportsAgentRun>>,
) -> SequentialBuilder
pub fn participants( self, agents: impl IntoIterator<Item = Arc<dyn SupportsAgentRun>>, ) -> SequentialBuilder
Set the ordered list of participants.
Sourcepub fn add(self, agent: Arc<dyn SupportsAgentRun>) -> SequentialBuilder
pub fn add(self, agent: Arc<dyn SupportsAgentRun>) -> SequentialBuilder
Append a participant to the pipeline.
Sourcepub fn name(self, name: impl Into<String>) -> SequentialBuilder
pub fn name(self, name: impl Into<String>) -> SequentialBuilder
Set the workflow name.
Sourcepub fn output_from(
self,
ids: impl IntoIterator<Item = impl Into<String>>,
) -> SequentialBuilder
pub fn output_from( self, ids: impl IntoIterator<Item = impl Into<String>>, ) -> SequentialBuilder
Designate participants (by SupportsAgentRun::id) whose turn output
becomes a terminal WorkflowEvent::Output
event, resolved to the pipeline’s internal executor ids at
build time and forwarded to
WorkflowBuilder::output_from.
When neither this nor Self::intermediate_output_from is called,
the builder preserves its current default: only the last participant
yields output. Once either is called, only the designated
participants yield at all — every participant still forwards the
running conversation to the next stage regardless of designation, so
the pipeline itself is unaffected.
Rejected at build() if an id does not match any registered
participant, or overlaps Self::intermediate_output_from.
Sourcepub fn intermediate_output_from(
self,
ids: impl IntoIterator<Item = impl Into<String>>,
) -> SequentialBuilder
pub fn intermediate_output_from( self, ids: impl IntoIterator<Item = impl Into<String>>, ) -> SequentialBuilder
Designate participants (by SupportsAgentRun::id) whose turn output
becomes a non-terminal
WorkflowEvent::Intermediate
event rather than the workflow’s final output. See
Self::output_from for the full designation semantics.
Sourcepub fn with_request_info(self) -> SequentialBuilder
pub fn with_request_info(self) -> SequentialBuilder
Opt in to post-agent human approval: every participant’s turn pauses
the workflow (a WorkflowEvent::RequestInfo
event, surfaced as a PendingRequest)
until a response is supplied. An empty response approves the reply and
the pipeline continues to the next participant; a non-empty response is
treated as revision feedback and re-invokes that participant, pausing
again — repeating until approved. Rust analogue of upstream’s
post-agent .with_request_info() (see UPSTREAM_DRIFT.md §12),
implemented via AgentApprovalExecutor. Default (not called): no
pausing, matching prior behavior.
Sourcepub fn ensure_trailing_user_turn(self, ensure: bool) -> SequentialBuilder
pub fn ensure_trailing_user_turn(self, ensure: bool) -> SequentialBuilder
When set, a participant whose input conversation ends on an assistant
message — every participant after the first, since each is handed the
previous one’s reply — is run with a synthetic "please continue."
user turn appended (upstream #8779). Some chat-completions providers
answer a prompt ending on assistant with empty text.
The turn exists only for that invocation: it is not added to the running conversation, so it is never forwarded to the next participant or included in the workflow’s output. Off by default, which keeps the existing behaviour.
Sourcepub fn with_chain_only_agent_responses(
self,
chain_only: bool,
) -> SequentialBuilder
pub fn with_chain_only_agent_responses( self, chain_only: bool, ) -> SequentialBuilder
Pass each participant only the previous one’s response rather than
the whole conversation (upstream WithChainOnlyAgentResponses). Not
applied to participants wrapped for request info.