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 serde_json::json!({
34 "type": "object",
35 "additionalProperties": false,
36 "properties": {
37 "tasks": {
38 "type": "array",
39 "description": "List of tasks to execute in parallel. Each task runs as an independent delegated child run concurrently.",
40 "items": {
41 "type": "object",
42 "additionalProperties": false,
43 "properties": {
44 "agent": {
45 "type": "string",
46 "description": "Required. Canonical agent type for this task."
47 },
48 "description": {
49 "type": "string",
50 "description": "Required. Short task label for display and tracking."
51 },
52 "prompt": {
53 "type": "string",
54 "description": "Required. Detailed instruction for the delegated child run."
55 },
56 "background": {
57 "type": "boolean",
58 "description": "Optional. Run this delegated child task in the background. Default: false.",
59 "default": false
60 },
61 "max_steps": {
62 "type": "integer",
63 "description": "Optional. Maximum number of tool/model steps for this delegated child task."
64 },
65 "output_schema": {
66 "type": "object",
67 "description": "Optional. JSON Schema object the delegated child result must satisfy. When provided, the validated object is returned in each result's metadata."
68 }
69 },
70 "required": ["agent", "description", "prompt"]
71 },
72 "minItems": 1,
73 "maxItems": MAX_PARALLEL_TASKS_PER_CALL
74 },
75 "allow_partial_failure": {
76 "type": "boolean",
77 "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.",
78 "default": false
79 },
80 "timeout_ms": {
81 "type": "integer",
82 "minimum": 1,
83 "description": "Optional total timeout in milliseconds. On timeout, completed child results are returned and unfinished children are marked failed."
84 },
85 "min_success_count": {
86 "type": "integer",
87 "minimum": 1,
88 "description": "Optional successful child count that is enough to return early. Early return is only used when allow_partial_failure is true."
89 }
90 },
91 "required": ["tasks"],
92 "examples": [
93 {
94 "tasks": [
95 {
96 "agent": "explore",
97 "description": "Find Rust files",
98 "prompt": "List Rust files under src/."
99 },
100 {
101 "agent": "explore",
102 "description": "Find tests",
103 "prompt": "List test files and summarize their purpose."
104 }
105 ]
106 }
107 ]
108 })
109}