Same agent, rebuilt workspace, a quarter of the bill: what EnvOpt shows

A new arXiv paper leaves the model and the harness alone and lets another AI rebuild the workspace the agent works in. On 200 test tasks, the same Claude Haiku 4.5 agent cost $42.36 before and $11.55 after, and passed more tasks.

When an agent is too slow or too expensive, the usual fixes are a better model or a better harness: a new prompt, new tools, a smarter loop. This week's paper tries the third thing, which most of us leave alone: the place the agent works in.

The paper is EnvOpt: Automated Optimization for Agent Environments by Mingxuan Li, Huanzhi Mao, Qiuyang Mang, Hanchen Li, Joseph E. Gonzalez and Alex Dimakis (arXiv 2611.07372, submitted 5 November 2026). I checked every number below against the paper's text.

The problem

Many agents work in the same environment day after day: one company's Slack, mail and ticket systems, a folder of documents, one code repository. The paper calls these stationary environments. Every task starts by digging through them. The agent looks up which endpoint to call, opens mail through layers of tool calls, parses spreadsheets, and pays for every token of what comes back.

That digging is repeated on every task, and nobody tunes it, because the environment is treated as a given.

The idea

Keep the model and the harness fixed and let a second agent rebuild the environment. In the paper, Claude Code with Claude Opus 4.8 is the research agent. It runs in a sandbox with a budget, runs the target agent (Claude Code with Claude Haiku 4.5) on a batch of training tasks, reads what it spent, changes the environment and tries again.

Two details make this honest:

  • The training tasks have no answer keys. The research agent never sees whether the target got a task right, so it cannot lower the cost by writing the answers down. It can only measure cost and look at what the agent did.
  • A separate validation set does have answer keys. After each step the new environment is run on it, and the process stops when the cost on that set goes up or the pass rate gets clearly worse. The final numbers come from a third set of tasks that took no part in the tuning.

What the rebuilt workspace contained

The changes are ordinary, and that is the useful part:

  • Mail as plain text. A small program fetches the mail and hands the agent sender, subject, message ID and the text, instead of the agent paging through mail tools.
  • A cheatsheet of endpoints. One file lists the API endpoints the tasks keep needing (create a Jira issue, post to Slack, record a Xero payment), so the agent stops searching for them on every task.
  • On the other benchmarks: spreadsheets converted to text files, one index file listing the paths, sizes and types of the files that matter, a small SQLite database that says which script writes which table, and a program that names the 8 files most likely to hold a bug.

The numbers

On AutomationBench, an enterprise benchmark across Slack, GitHub, Gmail, Salesforce and other systems, the authors took the 600 public tasks and split them: 200 for the test set, 96 for validation, the rest for training, 20 training tasks per step. Each figure is averaged over 3 runs.

Agent on the test set Pass rate before after Cost before after
Claude Haiku 4.5 (the target) 2.33 % 16.67 % $42.36 $11.55
Claude Haiku 5.5 20.7 % 32.8 % $4.83 $1.51
Claude Opus 4.8 28.50 % 33.33 % $358.13 $80.90
Claude Opus 5 33.83 % 35.17 % $236.18 $75.26

The headline is the first row: the same agent cost 72.7 % less. The abstract says its pass rate rose "by 14.34 %"; that is percentage points, from 2.33 % to 16.67 %.

The other rows are what interests me more. The environment was tuned for Haiku 4.5 only, and it still cut the cost of the three other Claude models in the table by 68 % to 77 % (and of a GPT model the paper also tried, by 89 %). A workspace that is easier to read is easier to read for every model.

Where did the money go? Input tokens per task fell from 171,641 to 41,466 (76 %), output tokens only from 5,065 to 3,881 (23 %). The agent did not think less. It read less. Most of the saving came out of tool results, the endpoint lookups above all.

Better tools alone did not get there. With only the new tools added to the original environment, Haiku 4.5 passed 6.33 % at $15.75, against 16.67 % at $11.55 with the full rebuild.

Across all five benchmarks the paper reports an average cost cut of 48 %, with pass rates equal or higher.

The changes that made it worse

The paper lists rejected changes, and they are the part I would pin above my desk:

  • One big file with everything. A file holding every possible value of every database column was meant to save lookups. It did the opposite: seeing how much it had not read, the agent made more calls to explore it.
  • A search tool that returned too much. It found the right files, plus extra ones, and the agent read the extra ones too.
  • A check that fit one batch of tasks. A test added in one step rejected correct bug fixes in the next, and the agent spent much more time getting around it.

There are failures of the research agent too. Told not to touch the model or harness, it still tried to change the target's reasoning effort. In another run it shipped a SQL splitter in step 1 that broke on semicolons inside quotes, and the bug stayed in until step 5, inflating cost all the way, because the target agent blamed itself for the failures.

The catch

  • It pays off only with many tasks in one place. Tuning AutomationBench cost $150.10 and 6.6 hours. My own arithmetic from the table: Haiku 4.5 saves about $0.15 a task, so it takes roughly 1,000 tasks to earn the tuning back. For Opus 4.8 the saving is about $1.39 a task, so around 110. The paper's own chart, assuming 1,000 tasks, shows the savings beating the tuning cost for all three agents it plots, by up to about 10 times for Opus 4.8.
  • Haiku 4.5 still fails most tasks. 16.67 % is a big jump from 2.33 %, but five tasks in six still fail.
  • You still need answer keys somewhere. Training runs without them, but the stop decision comes from a validation set that has them. The authors say three steps were generally safe without it on their five benchmarks, and call that an empirical claim, not a rule.
  • The research agent needs watching. The proxy checks and the skipped instructions above happened in real runs.

What it changes in practice

  1. Measure what your agent reads, not only what it writes. Here three quarters of the input was the environment talking back. Split your token log into tool results, history and prompt before you change models.
  2. Write the cheatsheet before the prompt. The endpoints, commands and file locations your agent looks up on every task belong in one short file it reads first. In my repos that is the exact test, type-check and lint commands at the top of CLAUDE.md and a one-line-per-page docs index. More in My CLAUDE.md, and the failure behind each rule.
  3. Small and precise beats big and complete. Both rejected changes gave the agent more than it needed, and it read all of it. An index that names one page is cheaper than a dump of every page.
  4. Count tool results as cost. If you track cost per session, as in What Claude Code really costs, the biggest line is often what the tools returned.

The 40-second version

Watch the Short on YouTube.

Paper: Li, Mao, Mang, Li, Gonzalez, Dimakis. EnvOpt: Automated Optimization for Agent Environments. arXiv:2611.07372, 2026. arxiv.org/abs/2611.07372

More posts

All posts →
  1. 21 Nov 2026

    CLAUDE.md vs AGENTS.md: which one Claude Code reads, and why I keep only oneWhen a repository has both files, Claude Code reads CLAUDE.md and leaves AGENTS.md alone unless you import it. I found five of my repositories set up the wrong way round: the real instructions in AGENTS.md, and a CLAUDE.md that only pointed at it.

    How I build · 5 min
  2. 20 Nov 2026

    Running several Claude Code agents at once: worktrees, handoffs and one check per phaseWhat broke when I put many Claude Code agents on the same repositories, and the four rules that stayed: one worktree per agent, small file-disjoint jobs, a rewritten handoff, and one full check per phase.

    How I build · 5 min
  3. 20 Nov 2026

    Your agent finished the task. Did every step work? What prefix executability showsA new arXiv paper replays every tool call an agent made and marks the first one that could not run. On 200 function-calling tasks, one agent finished 94 % of them, yet only 47 % of its runs ran clean from start to end.

    AI · 5 min