pub struct TransferToAgentTool { /* private fields */ }Expand description
Tool that signals the agent loop to transfer conversation to another agent.
When called, validates the target exists in the AgentRegistry (and
optionally that it appears in the allowed-targets set), then returns an
AgentToolResult carrying a TransferSignal. The agent loop detects
the signal and terminates the turn with
StopReason::Transfer.
Implementations§
Source§impl TransferToAgentTool
impl TransferToAgentTool
Sourcepub fn new(registry: Arc<AgentRegistry>) -> Self
pub fn new(registry: Arc<AgentRegistry>) -> Self
Create a new transfer tool that can transfer to any registered agent.
Sourcepub fn with_allowed_targets(
registry: Arc<AgentRegistry>,
targets: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_allowed_targets( registry: Arc<AgentRegistry>, targets: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Create a transfer tool restricted to the given set of allowed target agents.
Trait Implementations§
Source§impl AgentTool for TransferToAgentTool
impl AgentTool for TransferToAgentTool
Source§fn description(&self) -> &str
fn description(&self) -> &str
Natural-language description included in the LLM prompt.
Source§fn parameters_schema(&self) -> &Value
fn parameters_schema(&self) -> &Value
JSON Schema describing the tool’s input shape, used for validation.
Source§fn execute(
&self,
_tool_call_id: &str,
params: Value,
cancellation_token: CancellationToken,
_on_update: Option<Box<dyn Fn(AgentToolResult) + Send + Sync>>,
_state: Arc<RwLock<SessionState>>,
_credential: Option<ResolvedCredential>,
) -> ToolFuture<'_>
fn execute( &self, _tool_call_id: &str, params: Value, cancellation_token: CancellationToken, _on_update: Option<Box<dyn Fn(AgentToolResult) + Send + Sync>>, _state: Arc<RwLock<SessionState>>, _credential: Option<ResolvedCredential>, ) -> ToolFuture<'_>
Execute the tool with validated parameters. Read more
Source§fn requires_approval(&self) -> bool
fn requires_approval(&self) -> bool
Whether this tool requires user approval before execution.
Default is
false — tools execute immediately.Source§fn metadata(&self) -> Option<ToolMetadata>
fn metadata(&self) -> Option<ToolMetadata>
Optional organizational metadata (namespace, version). Read more
Source§fn approval_context(&self, _params: &Value) -> Option<Value>
fn approval_context(&self, _params: &Value) -> Option<Value>
Optional rich context for the approval UI. Read more
Source§fn auth_config(&self) -> Option<AuthConfig>
fn auth_config(&self) -> Option<AuthConfig>
Optional authentication configuration for this tool. Read more
Auto Trait Implementations§
impl Freeze for TransferToAgentTool
impl RefUnwindSafe for TransferToAgentTool
impl Send for TransferToAgentTool
impl Sync for TransferToAgentTool
impl Unpin for TransferToAgentTool
impl UnsafeUnpin for TransferToAgentTool
impl UnwindSafe for TransferToAgentTool
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