pub enum AnyHandoffPolicy {
Explicit(ExplicitHandoffPolicy),
MultiExplicit(MultiExplicitHandoffPolicy),
Sequential(SequentialHandoffPolicy),
Composite(CompositeHandoffPolicy),
}Expand description
Enum for composing different handoff policies.
Variants§
Explicit(ExplicitHandoffPolicy)
MultiExplicit(MultiExplicitHandoffPolicy)
Sequential(SequentialHandoffPolicy)
Composite(CompositeHandoffPolicy)
Trait Implementations§
Source§impl Clone for AnyHandoffPolicy
impl Clone for AnyHandoffPolicy
Source§fn clone(&self) -> AnyHandoffPolicy
fn clone(&self) -> AnyHandoffPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AnyHandoffPolicy
impl Debug for AnyHandoffPolicy
Source§impl From<CompositeHandoffPolicy> for AnyHandoffPolicy
impl From<CompositeHandoffPolicy> for AnyHandoffPolicy
Source§fn from(policy: CompositeHandoffPolicy) -> Self
fn from(policy: CompositeHandoffPolicy) -> Self
Converts to this type from the input type.
Source§impl From<ExplicitHandoffPolicy> for AnyHandoffPolicy
impl From<ExplicitHandoffPolicy> for AnyHandoffPolicy
Source§fn from(policy: ExplicitHandoffPolicy) -> Self
fn from(policy: ExplicitHandoffPolicy) -> Self
Converts to this type from the input type.
Source§impl From<MultiExplicitHandoffPolicy> for AnyHandoffPolicy
impl From<MultiExplicitHandoffPolicy> for AnyHandoffPolicy
Source§fn from(policy: MultiExplicitHandoffPolicy) -> Self
fn from(policy: MultiExplicitHandoffPolicy) -> Self
Converts to this type from the input type.
Source§impl From<SequentialHandoffPolicy> for AnyHandoffPolicy
impl From<SequentialHandoffPolicy> for AnyHandoffPolicy
Source§fn from(policy: SequentialHandoffPolicy) -> Self
fn from(policy: SequentialHandoffPolicy) -> Self
Converts to this type from the input type.
Source§impl HandoffPolicy for AnyHandoffPolicy
impl HandoffPolicy for AnyHandoffPolicy
Source§fn handoff_tools(&self) -> Vec<ChatCompletionTool>
fn handoff_tools(&self) -> Vec<ChatCompletionTool>
Generate handoff tools that the LLM can call.
These tools will be injected into the agent’s available tools.
Source§fn handle_handoff_tool(
&self,
invocation: &ToolInvocation,
) -> Result<HandoffRequest, BoxError>
fn handle_handoff_tool( &self, invocation: &ToolInvocation, ) -> Result<HandoffRequest, BoxError>
Handle a handoff tool call by converting it to a HandoffRequest.
This is called when the LLM invokes one of the handoff tools.
Source§fn should_handoff(
&self,
state: &LoopState,
outcome: &StepOutcome,
) -> Option<HandoffRequest>
fn should_handoff( &self, state: &LoopState, outcome: &StepOutcome, ) -> Option<HandoffRequest>
Make runtime handoff decisions based on agent state and step outcome.
This allows for automatic handoffs based on conditions (e.g., no tools called).
Source§fn is_handoff_tool(&self, tool_name: &str) -> bool
fn is_handoff_tool(&self, tool_name: &str) -> bool
Check if a tool call is a handoff tool managed by this policy.
Source§fn transform_on_handoff(
&self,
messages: Vec<ChatCompletionRequestMessage>,
_from_agent: &str,
_to_agent: &str,
_handoff: &HandoffRequest,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChatCompletionRequestMessage>, BoxError>> + Send>>
fn transform_on_handoff( &self, messages: Vec<ChatCompletionRequestMessage>, _from_agent: &str, _to_agent: &str, _handoff: &HandoffRequest, ) -> Pin<Box<dyn Future<Output = Result<Vec<ChatCompletionRequestMessage>, BoxError>> + Send>>
Transform messages during handoff. Read more
Auto Trait Implementations§
impl Freeze for AnyHandoffPolicy
impl RefUnwindSafe for AnyHandoffPolicy
impl Send for AnyHandoffPolicy
impl Sync for AnyHandoffPolicy
impl Unpin for AnyHandoffPolicy
impl UnsafeUnpin for AnyHandoffPolicy
impl UnwindSafe for AnyHandoffPolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more