a3s_code_core/tools/task/
parallel_params.rs1use super::*;
2
3#[derive(Debug, Clone, Serialize, Deserialize)]
5#[serde(deny_unknown_fields)]
6pub struct ParallelTaskParams {
7 pub tasks: Vec<TaskParams>,
9 #[serde(default)]
12 pub allow_partial_failure: bool,
13 #[serde(default, alias = "timeoutMs", skip_serializing_if = "Option::is_none")]
18 pub timeout_ms: Option<u64>,
19 #[serde(
24 default,
25 alias = "minSuccessCount",
26 skip_serializing_if = "Option::is_none"
27 )]
28 pub min_success_count: Option<usize>,
29}
30
31pub fn parallel_task_params_schema() -> serde_json::Value {
33 parallel_task_params_schema_for_agents(&AgentRegistry::new().list_visible())
34}
35
36pub(super) fn parallel_task_params_schema_for_agents(
37 agents: &[AgentDefinition],
38) -> serde_json::Value {
39 serde_json::json!({
40 "type": "object",
41 "additionalProperties": false,
42 "properties": {
43 "tasks": {
44 "type": "array",
45 "description": "List of tasks to execute in parallel. Each task runs as an independent delegated child run concurrently.",
46 "items": {
47 "type": "object",
48 "additionalProperties": false,
49 "properties": {
50 "agent": task_agent_parameter_schema(agents),
51 "description": {
52 "type": "string",
53 "description": "Required. Short task label for display and tracking."
54 },
55 "prompt": {
56 "type": "string",
57 "description": "Required. Detailed instruction for the delegated child run."
58 },
59 "background": {
60 "type": "boolean",
61 "description": "Optional. Run this delegated child task in the background. Default: false.",
62 "default": false
63 },
64 "max_steps": {
65 "type": "integer",
66 "description": "Optional. Maximum number of tool/model steps for this delegated child task."
67 },
68 "output_schema": {
69 "type": "object",
70 "description": "Optional. JSON Schema object the delegated child result must satisfy. When provided, the validated object is returned in each result's metadata."
71 }
72 },
73 "required": ["agent", "description", "prompt"]
74 },
75 "minItems": 1,
76 "maxItems": MAX_PARALLEL_TASKS_PER_CALL
77 },
78 "allow_partial_failure": {
79 "type": "boolean",
80 "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.",
81 "default": false
82 },
83 "timeout_ms": {
84 "type": "integer",
85 "minimum": 1,
86 "description": "Optional total timeout in milliseconds. On timeout, completed child results are returned and unfinished children are marked failed."
87 },
88 "min_success_count": {
89 "type": "integer",
90 "minimum": 1,
91 "description": "Optional successful child count that is enough to return early. Early return is only used when allow_partial_failure is true."
92 }
93 },
94 "required": ["tasks"],
95 "examples": [
96 {
97 "tasks": [
98 {
99 "agent": "explore",
100 "description": "Find Rust files",
101 "prompt": "List Rust files under src/."
102 },
103 {
104 "agent": "explore",
105 "description": "Find tests",
106 "prompt": "List test files and summarize their purpose."
107 }
108 ]
109 }
110 ]
111 })
112}