Source-linked AI summary
EnvOpt: Automated Optimization for Agent Environments
Mingxuan Li, Huanzhi Mao, Qiuyang Mang, Hanchen Li, Joseph E. Gonzalez, Alex Dimakis
TL;DR
Agent performance depends not only on model parameters and harnesses but also on how shared environments are organized and represented. EnvOpt automates optimization of those environments for a target agent. Across five benchmarks, it reduces costs while maintaining or improving pass rates, and its optimizations transfer across models and harnesses.
Problem
Model parameters and harnesses are actively optimized, but the organization and representation of stationary environments shared across tasks have received less systematic attention.
Source: §1 · p. 1Method
EnvOpt uses a coding agent and training tasks without verifiers to optimize a stationary environment for a target agent, monitoring results with validation queries and testing on held-out tasks.
Source: §1 · p. 2Results
Across five benchmarks, EnvOpt reduces unseen-test agent costs by an average of 48% while achieving higher or similar pass rates.
Source: §1 · p. 2Takeaways & Limitations
Environment optimization is a third direction that can be combined with parameter tuning and harness optimization and can transfer across agents.
Source: §1 · pp. 2–3On Workspace-Bench, using answer length and keyword matching as training-time verification proxies often hurt held-out performance.
Source: §4.6 · p. 10
Abstract
from arXiv · showhide
An LLM agent's cost and success depend on its model, its harness, and its environment. In addition to the widely studied directions of parameter tuning and harness optimization, we propose the third direction: optimization over stationary environments. Agents are often deployed in rich environments shared by many tasks, such as a company's Slack workspace or a complex collection of data sources, documents or tickets. We call these environments stationary environments. We introduce EnvOpt, a method for automated end-to-end optimization of stationary environments for any given model and harness, using real or synthetic tasks without needing any graders or reference answers. On AutomationBench, EnvOpt reduces the cost of Claude Haiku 4.5 by 72.7% and raises its pass rate by 14.34%. The same environment transfers to Opus 5, cutting its cost by 68.1% with a 1.34% gain. Added on top of Meta-Harness's optimized harness for Haiku 4.5, it lowers cost by a further 83.4% and adds 11.17% accuracy over Meta-Harness alone. Across 5 benchmarks, EnvOpt significantly reduces the cost of agents while improving or maintaining pass rate, and is transferable to different models and different harnesses. We also discuss common successful and rejected environment optimization strategies during automated optimization. More broadly, our results show that how information is represented to an agent shapes both its cost and its success, making the environment worth optimizing in addition to the parameters and the harness.
1 Introduction
The introduction proposes optimizing the structure and representation of stationary environments as a third axis of agent improvement alongside model parameters and harnesses. ENVOPT automates this optimization, reducing costs across five benchmarks while maintaining or improving pass rates and transferring across agents and harnesses.
1 Introduction
- Stationary environments contain artifacts shared across tasks, and their organization and representation can affect the work agents need to solve those tasks.The introduction proposes optimizing this environment structure alongside model parameters and harnesses.Source: §1 · p. 1
- Prior work addressed environment interfaces, training, or reusable skills, but the introduction describes direct optimization of stationary-environment organization and representation as underexplored.The cited work includes manually designed interfaces and environment changes aimed at reinforcement-learning training.Source: §1 · pp. 1–2
- ENVOPT uses a coding agent and unverified training tasks to optimize an environment for a target agent, then tracks cost and pass rate with validation queries.The pipeline tests on a held-out set; Figure 2 illustrates its iterative optimization and validation process.Source: §1 · p. 2, Figure 2 · p. 3
- Across five benchmarks, ENVOPT reduces unseen-test agent costs by an average of 48% while achieving higher or similar pass rates.On AutomationBench, it outperforms Meta-Harness by 9.67% pass rate at 15% of its cost.Source: §1 · p. 2
- Environment optimizations transfer to different models and harnesses, and combining ENVOPT with Meta-Harness yields a 16% pass-rate improvement over either method alone.The introduction presents this transfer and combination as evidence that environment optimization is orthogonal to harness optimization and parameter tuning.Source: §1 · pp. 2–3
- The paper discusses accepted and rejected design choices from running ENVOPT as guidance for future environment-optimization work.Figure 2 illustrates examples including a SQLite catalog, a tool-use cheatsheet, and programs that rank files for bug fixes.Source: §1 · p. 3, Figure 2 · p. 3
2 Method
ENVOPT uses a research agent to iteratively reshape a stationary environment for a target agent, aiming to reduce task costs while preserving pass rate. Training tasks lack verifiers; a separate validation set guides stopping, and the target agent’s harness remains unchanged.
Optimization Objective
- For fixed underlying task information, ENVOPT seeks a representation that minimizes target-agent cost and may also improve accuracy.The objective evaluates cost over tasks drawn from the initial environment’s task distribution.Source: §2 · pp. 3–4
Environment Evolution
- At each step, a research agent runs the target agent on a disjoint subset of training tasks and edits the environment to lower cost without hurting pass rate.It can reorganize files, create access guides or databases, or add tool endpoints; harness changes are discarded.Source: §2 · p. 4
- ENVOPT changes the environment representation, not the target agent’s harness, making environment evolution an orthogonal optimization direction.The research agent’s harness edits are discarded at the end of each step.Source: §2 · p. 4
Training Without Verifiers
- Training tasks omit verifiers, so the research agent uses proxies or answer consistency; a separate validation set with verifiers guides when to stop evolution.The prior environment is retained if validation cost rises or pass rate falls beyond the allowed tolerance.Source: §2 · pp. 4–5
3 Experiments
Across five benchmarks, ENVOPT reduces agent costs while maintaining or improving pass rates, and optimized environments transfer across models and harnesses. On AutomationBench and other settings, it also complements harness optimization.
Overall Results
- Up to 88% lower cost with higher or similar success rates was observed across five benchmarks, with transfer across models and harnesses and further gains on top of Meta-Harness.The benchmarks cover workspace, data engineering, and software engineering tasks.Source: §3 · p. 5
AutomationBench
- 72.7% lower cost and a 14.3% pass-rate increase were observed for Haiku 4.5 on AutomationBench; ENVOPT also outperformed GEPA and Meta-Harness on both outcomes.The figure reports pass rate and USD cost averaged over three independent runs for each agent and method.Source: §3 · p. 5, Figure 3 · p. 6
Transferability
- 75.7% average cost reduction with generally higher pass rates was observed when transferring the optimized environment across models and harnesses.Haiku 5.5 with ENVOPT achieved higher pass rate than Opus 4.8 and a rate close to Opus 5.Source: §3 · p. 5
Combining with Meta-Harness
- ENVOPT further improved token efficiency and pass rate when applied on top of Meta-Harness, including after transfer to Opus 5.For Opus 5, Meta-Harness alone did not improve pass rate, while ENVOPT on top of it did so at much lower cost.Source: §3 · p. 5
Workspace-Bench
- 47.65% lower cost and 3.3% higher pass rate were observed on Workspace-Bench; transfer to non-target agents yielded 56.7% average cost reductions with steady pass rates.The benchmark uses workers’ personal workspaces, including those of researchers, engineers, and product managers.Source: §3 · p. 5
Data-Eng-Bench
- 53.44% lower cost without hurting performance was observed on Data-Eng-Bench, with an average 53.54% cost reduction on non-target agents.Source: §3 · p. 6
Software Engineering Tasks
- On Bleve, ENVOPT stayed near perfect using 56.9% of GSKILL’s completion time; on tenacity, it achieved 8.9% higher pass rate with fewer steps than ADVISOR MODELS.Source: §3 · p. 6
4 Discussion
The discussion illustrates environment representations that reduce agent work, explains why several plausible optimizations were rejected, and analyzes cost savings, training overhead, and research-agent behaviors. Across examples, ENVOPT’s gains depend on useful information access and careful validation.
4.1 Example Environment Optimizations
- Across AutomationBench, Workspace-Bench, and Data-Eng-Bench, ENVOPT significantly reduces cost and improves or maintains pass rate; examples also show lower completion time or higher accuracy on software tasks.The bleve result keeps accuracy close to perfect at 56.9% of GSKILL’s completion time; on tenacity, accuracy is 8.9% higher than ADVISOR MODELS with fewer steps.Source: Table 1 · p. 7, Figure 4 · p. 8
4.2 Rejected Environment Optimizations
- Rejected designs increased cost when they exposed too much information or encouraged extra reading, while a Bleve-specific test rejected some correct fixes outside its fitting task.A large Data-Eng-Bench file prompted more exploration; a Workspace-Bench search tool returned unnecessary files, and a Bleve check worked for X2 but rejected correct X3 fixes.Source: §4.2 · p. 8
4.3 Cost Reduction Analysis
- Most cost reduction comes from input-token savings in environment feedback, while output-token savings are smaller, at around 20% versus baseline.The breakdown covers AutomationBench and Data-Eng-Bench; examples of saved feedback include endpoint lookup and data inspection.Source: §4.3 · pp. 8–9, Figure 5 · p. 9
4.4 Ablation: Tool Optimization Only
- Tool-only optimization improves token efficiency and pass rate over baseline, but optimizing both tools and environment yields significantly greater gains, particularly in cost.The comparison is reported for AutomationBench and Data-Eng-Bench.Source: §4.4 · p. 9, Table 2 · p. 10
4.5 Training Cost and Time
- For frontier agents deployed at scale, the cost saved over 1,000 unseen tasks can exceed ENVOPT’s training cost by more than 10 times.The comparison uses cumulative training cost and savings for running different agents on unseen tasks.Source: Figure 6 · p. 7, §4.5 · p. 10
4.6 Research Agent Behaviors
- Using answer-length or keyword proxies to judge training-task quality sometimes hurt Workspace-Bench heldout performance, prompting the authors to prohibit that behavior.Training tasks have no verifiers, so the research agent occasionally used these proxies.Source: §4.6 · p. 10
- For AutomationBench, changes in tool-call patterns and the share of tasks with over 30% training-task cost reduction correlate with validation cost reduction.The reported Pearson correlations for the latter measure are 0.82 on AutomationBench, 0.70 on Workspace-Bench, and 0.56 on Data-Eng-Bench.Source: §4.6 · p. 10
- An early SQL splitter bug that failed on semicolons inside quoted text remained undetected until step 5 and inflated costs across four steps.The target agent could not identify the corrupted query and spent tokens rebuilding it.Source: §4.6 · p. 11
5 Related Work
Related work adapts agent environments for test-time use or training, while another line optimizes harnesses and their components. ENVOPT is situated among approaches that change agent interfaces, workflows, prompts, tools, context, or memory.
Agent Environment Adaptation
- Test-time environment work includes manually designed or automatically aligned interfaces, interaction-failure taxonomies, access changes, documentation optimization, navigable indices, and procedural memory.The passage also notes META-AGENT’s pass-rate gains but no significant token-efficiency improvement.Source: §5 · p. 11
- Other environment-adaptation methods target agent training by reshaping environments or wrappers to provide corrective feedback, curricula, progress rewards, or verifiable tasks.These works focus on reinforcement learning or training support.Source: §5 · pp. 11–12
Harness Optimization
- Harness-optimization work improves agent workflows and automates changes to harness code or components using execution trajectories and evaluation feedback.Examples include OpenHands, mini-SWE-agent, automated harness evolution, and joint modification of tools, middleware, and memory.Source: §5 · p. 12
- Component-level work optimizes prompts, text artifacts, skills, contextual playbooks, context strategies, and agent memory contents or architectures.The passage groups methods including DSPy, GEPA, Combee, SkillOpt, ACE, Meta Context Engineering, ReasoningBank, and MemEvolve.Source: §5 · p. 12
6 Conclusion
ENVOPT positions stationary-environment optimization as a third direction for agent optimization and reports lower costs with maintained or improved success across five benchmarks.
- Across five benchmarks, ENVOPT significantly reduces agent cost while maintaining or improving success rates.Source: §6 · p. 12
- ENVOPT transfers across models and harnesses, outperforms GEPA, Meta-Harness, GSKILL, and ADVISOR MODELS, and can build on Meta-Harness to push the Pareto frontier further.Source: §6 · p. 12
- ENVOPT significantly outperforms tool-only optimization and yields cost savings exceeding 10 times its own running cost.Source: §6 · p. 12
- The paper frames stationary-environment optimization as a third agent-optimization direction alongside harness optimization and parameter tuning.Source: §6 · p. 12
- The authors provide qualitative examples of successful and rejected environment optimizations as design experience for future research.Source: §6 · p. 12
A Research Agent Instructions
The instructions frame environment optimization as redesigning the information and access layer for a fixed agent, aiming to reduce cost or wasted steps while preserving task performance, correctness, recovery, and coverage. They emphasize generalization beyond visible tasks and validating changes through actual task runs and trajectories within the prescribed constraints.
A.1 AutomationBench
- For AutomationBench, repeatedly change the access layer, run the full training set, inspect cost and trajectories, and keep changes that improve results.Compare runs more than once because cost varies, and judge whether the assistant found the right records and completed the requested actions.Source: §A.1 · pp. 16–17
- AutomationBench prioritizes per-task front-loading and denormalizing world state, alongside tools that reduce round-trips and guidance for efficient work.The instructions describe front-loading as the bigger lever; injected context is prepared at task start and its pre-fetching is cheap in assistant-token cost.Source: §A.1 · pp. 16–17
- The AutomationBench layer must generalize to unseen tasks, reshape access without pre-answering or mutating the world, and leave the best measured version with a report.The answering model remains Haiku 4.5, and real SaaS writes must still be performed by the assistant.Source: §A.1 · pp. 17–18
A.2 Workspace-Bench
- Workspace-Bench permits broad workspace restructuring, but requires preserving information needed for unseen queries and avoiding any reduction in task performance for lower cost.The fixed agent and harness are not to be changed.Source: §A.2 · pp. 18–19
- Workspace-Bench comparisons must cover every training task and assess both cost and task quality from agent trajectories and outputs, rather than output length or other proxies.The instructions call for repeated full-set runs because cost and behavior vary, and recommend keeping the lowest-cost version that does not significantly harm task completion.Source: §A.2 · pp. 19–20
A.3 Data-Eng-Bench
- For Data-Eng-Bench, iterate by changing the access layer, rebuilding the image, running the target on training tasks, and inspecting cost and behavior before continuing.The session instructions require runs to finish within the active session and call for a final report describing what helped, what failed, and what to try next.Source: §A.3 · p. 20
- For Data-Eng-Bench, improve only the fixed agent’s access layer to lower cost while keeping its work intact and generalizing to unseen tickets.The access layer can reorganize, index, describe, or augment the warehouse and dbt project, but must not supply ticket answers.Source: §A.3 · pp. 21–22
- Judge Data-Eng-Bench changes on the full training set and inspect actual trajectories to identify waste and verify that the agent uses the improvement.Repeat baselines because costs vary, and assess the produced SQL and trajectory without a grader or answer key.Source: §A.3 · pp. 21–22
- For Data-Eng-Bench, use repeated runs to compare candidates, track cost, and retain the best verified environment rather than stopping at the first improvement.Read trajectories to understand why a change saves cost, and revert regressions before delivering the access layer and report.Source: §A.3 · pp. 22–23
A.4 Bleve
- For Bleve, reshape the fixed agent’s entire environment to reduce cost through better information, without restricting effort or sacrificing correctness.The environment includes how the codebase is organized, represented, indexed, and described; improvements must generalize to unseen bugs.Source: §A.4 · pp. 23–24
- For Bleve, evaluate every available task and check correctness yourself; cost reductions must not come from weakened tests, capped searches, or task-specific answers.The repository’s existing source must remain unchanged, and validation helpers must fail when tests fail.Source: §A.4 · p. 24
A.5 Tenacity
- For Tenacity, optimize the fixed agent’s environment to reduce shell-command steps, while keeping its resolve rate from worsening.Each command is one step, and tasks reaching the 40-step cap count as unresolved.Source: §A.5 · pp. 24–25
- For Tenacity, optimize against held-out bugs by writing general codebase knowledge, such as source maps or invariants, rather than fixes tailored to the development sample.The held-out bugs may involve different functions, modules, and symptoms in the same repository.Source: §A.5 · p. 25
- Optimize by giving the agent better information, never by forbidding searches, checks, or further work when it remains uncertain.If a rule prevents recovery from an incorrect first guess, delete it even if it reduces step count.Source: §A.5 · pp. 25–26
- Put required guidance in the layer’s mandatory AGENTS.md entry point, since the agent reads no files unless directed to them.The layer is added to the checkout before the run; files not reachable from AGENTS.md have no effect, and a layer without it is rejected.Source: §A.5 · p. 25
- Optimize and test across all available tasks, using trajectories as the only signal and checking whether each run submitted or exhausted its limit.Review the trajectory to find wasted steps, and inspect the fix diff against the problem statement rather than treating repeated diffs as proof.Source: §A.5 · pp. 25–27
- Use run step count and trajectory to identify waste, while remembering that only tracked source-file changes count as the agent’s fix.The runner records the full trajectory and fix diff; scratch files are ignored, and a non-Submitted exit status means the run’s work is discarded.Source: §A.5 · pp. 25–26
- Judge efficiency alongside correctness: do not trade fewer steps for reduced bug-fix rates, and verify each fix against the problem statement.A matching diff or lower step count does not establish correctness; validation helpers must fail when their tests fail.Source: §A.5 · p. 26
- Keep target-run spend within $30 and do not end the turn while task runs remain unfinished.Runs across all tasks may take tens of minutes or hours; continue waiting or polling in the same turn, then write REPORT.md describing the changes, observed waste, and step-count effect.Source: §A.5 · pp. 26–27
- Add environment materials alongside the repository without changing existing source or supplying repaired code, task-specific answers, or a stronger agent.Work on one task checkout at a time; recurring themes across tasks may inform general codebase notes, but task source must not be carried between checkouts.Source: §A.5 · p. 26
B Additional Results
Appendix B presents additional results across five benchmarks beyond those included in the main text.
- Appendix B reports additional results on five benchmarks beyond the main-text results.Source: B Additional Results · p. 27
B.1 Detailed results on AutomationBench
This section presents detailed results for GEPA, Meta-Harness, and ENVOPT combined with Meta-Harness on tested agents.
- Table 4 reports detailed performance for GEPA, Meta-Harness, and ENVOPT + Meta-Harness on tested agents.Source: §B.1 · p. 27
B.2 Validation set results
The appendix describes validation-set reporting across benchmarks and illustrates how ENVOPT can convert a similar unseen environment into a compact prompt representation.
B.2 Validation set results
- Validation results report each step’s optimized environment with its target agent, using benchmark-specific efficiency metrics and pass rates; AutomationBench also compares test and validation results.The metrics are cost for AutomationBench, Workspace-Bench, and Data-Eng-Bench; time per bug for Bleve; and average agent steps for Tenacity.Source: §B.2 · p. 27, Table 5 · p. 28, Figure 7 · p. 28
B.3 How AutomationBench ENVOPT converts a similar unseen environment
- For similar unseen environments, ENVOPT can create a task-start converter that reads data through the agent’s API and places it in a compact prompt block, letting the agent skip search and listing.The same converter reads the unseen world’s data and builds its block in the same way.Source: §B.3 · pp. 27, 29
C Example Synthetic Tasks
This appendix section points to example synthetic tasks for Workspace-Bench.
C.1 Workspace-Bench
- Table 6 showcases two example synthetic tasks for each of Workspace-Bench’s five workspaces.Source: §C.1 · p. 29
C.2 Data-Eng-Bench
The section presents three example synthetic training tasks for Data-Eng-Bench.
- Three examples of synthetic training tasks are provided for Data-Eng-Bench.Source: §C.2 · p. 29
Example Training Task 1: dbt-order-channel-mix-synthetic
This synthetic task asks an agent to build a monthly sales-channel report from order and channel data. It specifies aggregation rules, output fields, and validation requirements.
- The task builds a monthly view of order volume and revenue by sales channel to show channel growth and discount-heavy demand.Source: Example Training Task 1:… · p. 29
- The output has one row per (order_month, channel_id), using order and channel staging data; cancelled orders and orders missing channel_id or ordered_at are excluded.Source: Example Training Task 1:… · p. 29
- Retired channels remain reportable, and unmatched channel references use ’UNKNOWN’ for channel name and type.Source: Example Training Task 1:… · p. 29
- The report includes order and customer counts, revenue and discounts, average order value, discount rate, and each channel’s share of monthly revenue.Source: Example Training Task 1:… · p. 30
- The model must compile, produce unique month-channel rows, avoid numeric infinity or NaN, and have channel revenue shares sum to approximately 100% each month.Source: Example Training Task 1:… · p. 31
- The task requires a table materialization, portable SQL for DuckDB and Snowflake, and no changes to upstream staging models.Source: Example Training Task 1:… · p. 31
Example Training Task 2: dbt-product-price-history-synthetic
This synthetic task specifies a per-variant price movement report built from effective-dated price rows. It defines how to resolve current list prices, calculate price changes, and validate the output.
Example Training Task 2: dbt-product-price-history-synthetic
- The task addresses ambiguity in effective-dated prices, where multiple rows may be live for a variant and the customer-visible price or movement is unclear.Source: Example Training Task 2:… · p. 31
- List prices are standard-list rows with NULL customer_tier_id and channel_id; tier- and channel-specific prices are counted separately.Source: Example Training Task 2:… · p. 32
- The reference date is the latest effective_from in the data, and a current price must be active and cover that date.Source: Example Training Task 2:… · p. 32
- Overlapping current list prices for a variant and currency are treated as a configuration error; select the latest effective_from, then highest price_id, and count the variant.Source: Example Training Task 2:… · p. 32
2. Each (variant_id, currency_code) pair appears exactly once
- The report has one row per variant and currency with at least one list-price row, and price changes are differences between consecutive list-price rows ordered by effective_from.Source: Example Training Task 2:… · p. 32
5. Variants whose only price rows are tier or channel specific do not appear
- NULL price amounts break the movement chain and, like NULL effective_from values, count toward undated_or_unpriced_rows; tier- or channel-only variants are excluded.Source: Example Training Task 2:… · p. 32, §5 · p. 33
Example Training Task 2: dbt-product-price-history-synthetic
- The output includes current and historical price measures, movement counts and magnitudes, margins, and an overlapping-current-prices indicator.Source: Example Training Task 2:… · p. 32
7. No infinity or NaN values anywhere in the output
- The task calls for an ordered price chain built with a window function and requires the output to avoid infinity or NaN values.Source: §7 · p. 33
Example Training Task 3: dbt-payroll-cost-by-department-synthetic
This synthetic task asks for a department-and-payroll-period report combining payroll runs, employee details, and time entries. It compares paid and recorded hours while reporting pay measures and data-quality indicators.
Example Training Task 3: dbt-payroll-cost-by-department-synthetic
- Payroll details and time entries are not currently compared, leaving department costs and whether paid hours match worked hours unclear.Source: Example Training Task 3:… · p. 33
- A discrepancy is a paid-versus-recorded hours difference greater than 0.5 hours, while employees without time entries are counted separately by employment type.Source: Example Training Task 3:… · p. 34
- It reports pay totals, paid and recorded hours, hours gaps, directional discrepancy counts, employees without time entries, and header gross drift.Source: Example Training Task 3:… · p. 34
- The report combines payroll detail, approved time entries within each run period, and the run header; posted runs count, while unmatched detail rows are excluded and counted.Source: Example Training Task 3:… · pp. 33–34
7. No infinity or NaN values anywhere in the output
- Header gross drift is apportioned by detail-row share as a crude convention, not a measured department-level amount or a figure to book.Source: Example Training Task 3:… · p. 34
Example Training Task 3: dbt-payroll-cost-by-department-synthetic
- The example period reports 3 employees paid, 227.0 paid hours, 139.5 recorded hours, and 1 employee with a discrepancy; its 87.5-hour gap is not itself a discrepancy measure.Source: Example Training Task 3:… · p. 35
- An employee appearing across periods is attributed to their current department, and overlapping payroll periods can count their time entries in both runs.Source: Example Training Task 3:… · p. 35
7. No infinity or NaN values anywhere in the output
- Aggregate time entries to one row per employee and run before joining payroll detail to avoid multiplying pay by days worked.Source: §7 · p. 36
Related papers
This paper cites
- SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering2024
- OpenHands: An Open Platform for AI Software Developers as Generalist Agents2024
- SkillOpt: Executive Strategy for Self-Evolving Agent Skills2026
- EnvHarness: Awakening Static Worlds for Agent Learning2026
- Combee: Scaling Prompt Learning for Self-Improving Language Model Agents2026
- SlackBench: Benchmarking Agents on Collaborative Projects Grounded in Real Code Repositories2026