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 "max_steps": {
60 "type": "integer",
61 "description": "Optional. Maximum number of tool/model steps for this delegated child task."
62 },
63 "output_schema": {
64 "type": "object",
65 "description": "Optional. JSON Schema object the delegated child result must satisfy. When provided, the validated object is returned in each result's metadata."
66 }
67 },
68 "required": ["agent", "description", "prompt"]
69 },
70 "minItems": 2,
71 "maxItems": MAX_PARALLEL_TASKS_PER_CALL
72 },
73 "allow_partial_failure": {
74 "type": "boolean",
75 "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.",
76 "default": false
77 },
78 "timeout_ms": {
79 "type": "integer",
80 "minimum": 1,
81 "description": "Optional total timeout in milliseconds. On timeout, completed child results are returned and unfinished children are marked failed."
82 },
83 "min_success_count": {
84 "type": "integer",
85 "minimum": 1,
86 "description": "Optional successful child count that is enough to return early. Early return is only used when allow_partial_failure is true."
87 }
88 },
89 "required": ["tasks"],
90 "examples": [
91 {
92 "tasks": [
93 {
94 "agent": "explore",
95 "description": "Find Rust files",
96 "prompt": "List Rust files under src/."
97 },
98 {
99 "agent": "explore",
100 "description": "Find tests",
101 "prompt": "List test files and summarize their purpose."
102 }
103 ]
104 }
105 ]
106 })
107}