1use serde::Deserialize;
7use wcore::{
8 agent::{AsTool, ToolDescription},
9 model::Tool,
10};
11
12#[derive(Deserialize, schemars::JsonSchema)]
13pub struct Delegate {
14 pub tasks: Vec<DelegateTask>,
16 #[serde(default)]
19 pub background: bool,
20}
21
22#[derive(Deserialize, schemars::JsonSchema)]
23pub struct DelegateTask {
24 pub agent: String,
26 pub message: String,
28}
29
30impl ToolDescription for Delegate {
31 const DESCRIPTION: &'static str = "Delegate tasks to other agents. Runs all tasks in parallel. Set background=true to return immediately with task IDs — results arrive via agent completion events.";
32}
33
34pub fn tools() -> Vec<Tool> {
35 vec![Delegate::as_tool()]
36}