use super::*;
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct ParallelTaskParams {
pub tasks: Vec<TaskParams>,
#[serde(default)]
pub allow_partial_failure: bool,
#[serde(default, alias = "timeoutMs", skip_serializing_if = "Option::is_none")]
pub timeout_ms: Option<u64>,
#[serde(
default,
alias = "minSuccessCount",
skip_serializing_if = "Option::is_none"
)]
pub min_success_count: Option<usize>,
}
pub fn parallel_task_params_schema() -> serde_json::Value {
serde_json::json!({
"type": "object",
"additionalProperties": false,
"properties": {
"tasks": {
"type": "array",
"description": "List of tasks to execute in parallel. Each task runs as an independent delegated child run concurrently.",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"agent": {
"type": "string",
"description": "Required. Canonical agent type for this task."
},
"description": {
"type": "string",
"description": "Required. Short task label for display and tracking."
},
"prompt": {
"type": "string",
"description": "Required. Detailed instruction for the delegated child run."
},
"background": {
"type": "boolean",
"description": "Optional. Run this delegated child task in the background. Default: false.",
"default": false
},
"max_steps": {
"type": "integer",
"description": "Optional. Maximum number of tool/model steps for this delegated child task."
},
"output_schema": {
"type": "object",
"description": "Optional. JSON Schema object the delegated child result must satisfy. When provided, the validated object is returned in each result's metadata."
}
},
"required": ["agent", "description", "prompt"]
},
"minItems": 1,
"maxItems": MAX_PARALLEL_TASKS_PER_CALL
},
"allow_partial_failure": {
"type": "boolean",
"description": "Optional. Defaults to false. When true, the parallel_task tool succeeds if at least one child task succeeds, while preserving failed child results in the output and metadata.",
"default": false
},
"timeout_ms": {
"type": "integer",
"minimum": 1,
"description": "Optional total timeout in milliseconds. On timeout, completed child results are returned and unfinished children are marked failed."
},
"min_success_count": {
"type": "integer",
"minimum": 1,
"description": "Optional successful child count that is enough to return early. Early return is only used when allow_partial_failure is true."
}
},
"required": ["tasks"],
"examples": [
{
"tasks": [
{
"agent": "explore",
"description": "Find Rust files",
"prompt": "List Rust files under src/."
},
{
"agent": "explore",
"description": "Find tests",
"prompt": "List test files and summarize their purpose."
}
]
}
]
})
}