Dynamic Harness Search: Building Multi-Agent Systems Per-Query via Prediction
Organizations: Google · Arizona State University
Abstract
Agent harnesses specify the roles, instructions, tools, and communication structure used to solve a task, and the right harness depends on the query. Because the value of each design choice is observable only through execution, tailoring a harness to each query has required either executing alternatives at inference time or costly manual design. We introduce SHIFT, which moves execution out of the per-query search loop. A local LLM architect learns a policy over harness-building actions from search, and a value function that predicts, from measured executions, a utility balancing accuracy against execution cost. For each query, Monte Carlo tree search uses these predictions to construct a harness. Across 9,193 tasks in six benchmarks, from math to document and general-assistant tasks, with a Gemini 3.5 Flash executor, SHIFT attains the highest mean accuracy, about 80%, outperforming 17 baselines that span prompting, prompt optimization, and workflow search, and exceeding the strongest baseline by 7.2 percentage points. A cheaper mode of SHIFT also attains a higher mean accuracy than every baseline while using 32% fewer execution tokens than the strongest baseline. We further show that choosing structure, instructions, and tools jointly beats choosing only instructions or only tools by up to 9.1 percentage points, and that learned value selection identifies more accurate harnesses with lower execution cost from candidate pools.
Figures & tables
| Short-horizon | Long-horizon, tool-intensive | Aggregate | ||||||
| Method | GSM8K | HotpotQA | MBPP | Sheet | OfficeQA | GAIA | Mean | Cost |
| Prompting | ||||||||
| Direct | 97.7 0.1 | 67.9 0.1 | 93.6 0.6 | 0.0 | 8.9 3.7 | 4.6 1.1 | 45.5 | 1.0 |
| CoT | 97.4 0.3 | 68.4 0.1 | 78.3 0.6 | 0.0 | 4.1 1.4 | 3.3 1.1 | 41.9 | 0.9 ‡ |
| CoT (few-shot) | 97.6 0.1 | 68.4 0.2 | 82.6 2.2 | 0.0 | 4.9 2.4 | 2.6 1.1 | 42.7 | 0.9 |
| Self-Consistency | 97.7 0.1 | 68.5 0.0 | 90.0 0.4 | 0.0 | 6.5 2.8 | 6.5 1.1 | 44.9 | 5.2 ‡ |
| Mode | GSM8K | Hotpot | MBPP | SpreadSheet. | OfficeQA | GAIA | Mean | Cost |
|---|---|---|---|---|---|---|---|---|
| SHIFT-greedy | 79.8 | 120.2 | ||||||
| SHIFT-policy-veto | 79.1 | 115.0 | ||||||
| SHIFT-value-greedy | 60.2 | 5.3 | ||||||
| SHIFT-search | 79.9 | 84.3 | ||||||
| SHIFT-value | 74.5 | 27.7 |
Appendix figures & tables16 assets
Supplementary material from the paper’s appendix.
Appendix
| Setting | Value |
|---|---|
| Actions in the vocabulary | 40 |
| Top actions per node, (stop always retained) | 10 |
| Maximum number of actions, | 10 |
| Search simulations, | 64 |
| Exploration constant, | 2.5 |
| Policy temperature, | 1 |
| ID | Target | Action |
| 1–6 | Graph | Add a Planner, Researcher, Reasoner, Critic, Verifier, or Aggregator agent. |
| 7–8 | Graph | Add a feedback loop from the Verifier or the Critic back to the executing agent. |
| 9 | Graph | Give every executing agent the full tool set. |
| 10 | Graph | Stop and return the current harness. |
| 11 | Coder | Think step-by-step before generating code. |
| 12 | Coder | Write clean, concise code without extra comments. |
| Benchmark | Tokens | Latency (s) |
|---|---|---|
| GSM8K | 30,000 | 25 |
| HotpotQA | 40,000 | 30 |
| MBPP | 60,000 | 60 |
| SpreadsheetBench | 250,000 | 100 |
| OfficeQA | 1,500,000 | 400 |
| GAIA | 300,000 | 200 |
| Setting | Value |
|---|---|
| LoRA rank / scale / dropout | 16 / 32 / 0.05 |
| LoRA target layers | attention query, key, value, output |
| Optimizer | AdamW, learning rate , weight decay 0.01 |
| Learning-rate schedule | cosine, minimum |
| Gradient clipping | 1.0 |
| Epochs | 4 |
| Benchmark | Task | Success criterion | Train | Val | Test |
|---|---|---|---|---|---|
| GSM8K | Grade-school math word problems | Final number equals the reference | 472 | 128 | 1,319 |
| HotpotQA | Multi-hop questions over supplied passages (distractor setting) | Exact match after standard answer normalization | 472 | 128 | 7,405 |
| MBPP | Short Python functions from a description (sanitized set) | Generated code passes all unit tests | 120 | 43 | 257 |
| SpreadsheetBench | Spreadsheet manipulation from natural-language instructions | Output workbook matches the reference on every test case | 220 | 60 | 120 |
| OfficeQA Pro | Questions over a corpus of 697 U.S. Treasury Bulletins | Answer matches the reference within 1% | 73 | 19 | 41 |
| GAIA | General assistant tasks needing web search, files, and reasoning | Normalized answer matches the reference | 90 | 24 | 51 |
| Agents | Tools | Directives | ||||
|---|---|---|---|---|---|---|
| Benchmark | 1 | none | all | 0 | ||
| GSM8K | 98.2 (114) | 98.4 (835) | 98.4 (127) | 97.8 (965) | 98.0 (665) | 97.9 (419) |
| MBPP | 94.1 (34) | 99.0 (210) | 95.6 (68) | 99.4 ∗ (319) | 98.0 (247) | 100.0 (37) |
| HotpotQA | 75.6 (90) | 84.3 ∗ (1,116) | 72.4 (76) | 83.7 ∗ (1,611) | 79.6 (554) | 83.1 (278) |
| SpreadsheetBench | 55.3 (38) | 82.8 ∗ (476) | 44.8 (29) | 87.3 ∗ (700) | 65.4 (208) | 83.0 ∗ (406) |
| GAIA | 40.0 (25) | 73.9 ∗ (134) | 35.3 (17) | 66.9 ∗ (290) | 50.0 (90) | 72.2 ∗ (158) |
| Actions allowed | Accuracy (%) | Change vs. full (%) |
|---|---|---|
| All actions | – | |
| Tool grants only | [ , ] | |
| Directives only | [ , ] |
| Configuration | Accuracy (%) | Executor tokens / problem |
|---|---|---|
| SHIFT (learned policy, learned value) | 83.6 | 8,049 |
| Learned policy, constant value | 82.4 | 7,614 |
| Uniform policy, constant value | 82.0 | 6,283 |
| Uniform policy, learned value | 81.2 | 5,585 |
| Fixed single Coder | 81.2 | 1,064 |
Agent Harness Optimization
Agent harness optimization improves the prompts, tools, memory, workflows, and control code that shape how AI agents act.
See all 185 papers