use serde::Deserialize;
use wcore::{
agent::{AsTool, ToolDescription},
model::Tool,
};
#[derive(Deserialize, schemars::JsonSchema)]
pub struct Delegate {
pub tasks: Vec<DelegateTask>,
#[serde(default)]
pub background: bool,
}
#[derive(Deserialize, schemars::JsonSchema)]
pub struct DelegateTask {
pub agent: String,
pub message: String,
}
impl ToolDescription for Delegate {
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.";
}
pub fn tools() -> Vec<Tool> {
vec![Delegate::as_tool()]
}