Handoff • Rust AI Agent SDK
Handoff: Represents a handoff configuration for delegating tasks to another agent. Handoffs are represented as tools to the LLM, allowing agents to transfer…
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
| Name | Type | Description |
|---|---|---|
target_agent_name | String | Target agent name |
tool_name_override | Option<String> | Custom tool name override |
tool_description_override | Option<String> | Custom tool description override |
config | HandoffConfig | Handoff configuration |
Methods
new
fn new(target_agent_name: impl Into<String>) -> SelfCreate a new handoff to a target agent
Parameters:
| Name | Type |
|---|---|
target_agent_name | impl Into<String> |
tool_name
fn tool_name(mut self, name: impl Into<String>) -> SelfSet custom tool name
Parameters:
| Name | Type |
|---|---|
name | impl Into<String> |
tool_description
fn tool_description(mut self, description: impl Into<String>) -> SelfSet custom tool description
Parameters:
| Name | Type |
|---|---|
description | impl Into<String> |
config
fn config(mut self, config: HandoffConfig) -> SelfSet handoff configuration
Parameters:
| Name | Type |
|---|---|
config | HandoffConfig |
get_tool_name
fn get_tool_name(&self) -> StringGet the tool name for this handoff
get_tool_description
fn get_tool_description(&self) -> StringGet 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:
| Name | Type |
|---|---|
_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>,
) -> HandoffInputDataPrepare context data for handoff based on context policy
Parameters:
| Name | Type |
|---|---|
messages | Vec<serde_json::Value> |
source_agent | &str |
chain | &HandoffChain |
extra_context | HashMap<String |
serde_json | :Value> |
Source
View on GitHubpraisonai/src/handoff/mod.rs at line 492