Skip to main content

make_subagent

Function make_subagent 

Source
pub fn make_subagent(options: MakeSubagentOptions) -> Result<SubagentTool>
Expand description

Creates a subagent tool whose input schema follows the axis policies and presets.

use strands::multiagent::{Choice, Preset};
use strands::vended_tools::subagent::{MakeSubagentOptions, make_subagent};

let researcher = make_subagent(MakeSubagentOptions {
    presets: Some(vec![(
        "researcher".to_owned(),
        Preset::builder().instructions("You research topics.").description("research").build(),
    )]),
    context: Some(Choice::new(["none", "all"]).into()),
    ..MakeSubagentOptions::default()
})?;
let agent = strands::Agent::builder().tools([researcher]).printer(false).build()?;
assert!(agent.tool_registry().get("subagent").is_some());

ยงErrors

When max_depth is 0, name or description is empty, default_preset is not a preset, an axis has a mode it does not support, a Choice has no options or (for tools) is not multiple, or a context mode is not none, all or no_tools.