pub struct HandoffBuilder { /* private fields */ }Expand description
Builder for a handoff workflow. Rust analogue of HandoffBuilder.
let workflow = HandoffBuilder::new()
.participant("triage", triage)
.participant("billing", billing)
.initial_agent("triage")
.add_handoff("triage").to(["billing"])
.autonomous()
.build()?;Implementations§
Source§impl HandoffBuilder
impl HandoffBuilder
Sourcepub fn participant(
self,
name: impl Into<String>,
agent: Arc<dyn SupportsAgentRun>,
) -> Self
pub fn participant( self, name: impl Into<String>, agent: Arc<dyn SupportsAgentRun>, ) -> Self
Register a participant by name.
Sourcepub fn participants(
self,
participants: impl IntoIterator<Item = (String, Arc<dyn SupportsAgentRun>)>,
) -> Self
pub fn participants( self, participants: impl IntoIterator<Item = (String, Arc<dyn SupportsAgentRun>)>, ) -> Self
Register several participants as (name, agent) pairs.
Sourcepub fn initial_agent(self, name: impl Into<String>) -> Self
pub fn initial_agent(self, name: impl Into<String>) -> Self
Designate the entry-point agent that first receives user input.
Sourcepub fn coordinator(self, name: impl Into<String>) -> Self
pub fn coordinator(self, name: impl Into<String>) -> Self
Alias for HandoffBuilder::initial_agent (Python’s set_coordinator).
Sourcepub fn add_handoff(self, source: impl Into<String>) -> HandoffEdgeBuilder
pub fn add_handoff(self, source: impl Into<String>) -> HandoffEdgeBuilder
Begin a handoff edge from source; complete it with
HandoffEdgeBuilder::to.
Sourcepub fn interaction_mode(self, mode: HandoffInteractionMode) -> Self
pub fn interaction_mode(self, mode: HandoffInteractionMode) -> Self
Set the interaction mode.
Sourcepub fn autonomous(self) -> Self
pub fn autonomous(self) -> Self
Run autonomously (single-shot): complete on the first non-handoff answer.
Sourcepub fn with_user_input_request(self) -> Self
pub fn with_user_input_request(self) -> Self
Request fresh user input between turns (the default).
Sourcepub fn max_iterations(self, limit: usize) -> Self
pub fn max_iterations(self, limit: usize) -> Self
Cap the number of agent turns per user message (Python’s autonomous turn limit; default 50).
Sourcepub fn termination_condition<F>(self, condition: F) -> Self
pub fn termination_condition<F>(self, condition: F) -> Self
Set a termination condition evaluated against the conversation.
Sourcepub fn request_prompt(self, prompt: impl Into<String>) -> Self
pub fn request_prompt(self, prompt: impl Into<String>) -> Self
Set the prompt shown when requesting user input.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for HandoffBuilder
impl !UnwindSafe for HandoffBuilder
impl Freeze for HandoffBuilder
impl Send for HandoffBuilder
impl Sync for HandoffBuilder
impl Unpin for HandoffBuilder
impl UnsafeUnpin for HandoffBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more