Skip to main content

Handoff

Defined in the handoff module.
Rust AI Agent SDK Represents a handoff configuration for delegating tasks to another agent. Handoffs are represented as tools to the LLM, allowing agents to transfer control to specialized agents for specific tasks.

Fields

NameTypeDescription
target_agent_nameStringTarget agent name
tool_name_overrideOption<String>Custom tool name override
tool_description_overrideOption<String>Custom tool description override
configHandoffConfigHandoff configuration

Methods

new

fn new(target_agent_name: impl Into<String>) -> Self
Create a new handoff to a target agent Parameters:
NameType
target_agent_nameimpl Into&lt;String&gt;

tool_name

fn tool_name(mut self, name: impl Into<String>) -> Self
Set custom tool name Parameters:
NameType
nameimpl Into&lt;String&gt;

tool_description

fn tool_description(mut self, description: impl Into<String>) -> Self
Set custom tool description Parameters:
NameType
descriptionimpl Into&lt;String&gt;

config

fn config(mut self, config: HandoffConfig) -> Self
Set handoff configuration Parameters:
NameType
configHandoffConfig

get_tool_name

fn get_tool_name(&self) -> String
Get the tool name for this handoff

get_tool_description

fn get_tool_description(&self) -> String
Get the tool description for this handoff

check_safety

fn check_safety(
        &self,
        _source_agent_name: &str,
        chain: &HandoffChain,
    ) -> Result<()>
Check safety constraints before handoff Parameters:
NameType
_source_agent_name&str
chain&HandoffChain

prepare_context

fn prepare_context(
        &self,
        messages: Vec<serde_json::Value>,
        source_agent: &str,
        chain: &HandoffChain,
        extra_context: HashMap<String, serde_json::Value>,
    ) -> HandoffInputData
Prepare context data for handoff based on context policy Parameters:
NameType
messagesVec&lt;serde_json::Value&gt;
source_agent&str
chain&HandoffChain
extra_contextHashMap&lt;String
serde_json:Value&gt;

Source

View on GitHub

praisonai/src/handoff/mod.rs at line 492