Skip to main content

crabtalk_runtime/
task.rs

1//! Tool schema for the delegate tool.
2//!
3//! Schema types live here. Dispatch logic is server-specific and lives in
4//! the [`RuntimeBridge`](crate::bridge::RuntimeBridge) implementation.
5
6use serde::Deserialize;
7use wcore::{
8    agent::{AsTool, ToolDescription},
9    model::Tool,
10};
11
12#[derive(Deserialize, schemars::JsonSchema)]
13pub struct Delegate {
14    /// List of tasks to run in parallel. Each task has an agent name and a message.
15    pub tasks: Vec<DelegateTask>,
16}
17
18#[derive(Deserialize, schemars::JsonSchema)]
19pub struct DelegateTask {
20    /// Target agent name.
21    pub agent: String,
22    /// Message/instruction for the target agent.
23    pub message: String,
24}
25
26impl ToolDescription for Delegate {
27    const DESCRIPTION: &'static str = "Delegate tasks to other agents. Runs all tasks in parallel, blocks until all complete, and returns their results.";
28}
29
30pub fn tools() -> Vec<Tool> {
31    vec![Delegate::as_tool()]
32}