ArcBench Agent

2026.09 – 2026.10 · Competition entry · Python, Playwright

ArcBench Agent is a coding agent I wrote for the ArcBench Agentic Software Factory Hackathon. It takes a structured requirements document and produces a web app (React + Express + SQLite) that builds, starts, and passes end-to-end browser tests. Official scores: GitHub collaboration platform 23/30, spreadsheet 26/30, total 49/60, cost 4.54 CNY, fourth place, first prize. The code is open source on GitHub (gaoyu06/arcbench-agent, Apache-2.0).

Official passed cases by version

What the competition requires

Constraint Effect on the design
Hidden Playwright tests find elements by ARIA role, accessible name, and visible text. Locators are strict: matching two elements counts as a failure Names, roles, and regions must match the requirement text exactly
Every scenario starts from the home page in a fresh, logged-out session. All scenarios share one server and one database The entry point and navigation are a precondition for every scenario
Tasks evolve in stages. The new stage's app starts on the database left by the previous stage The agent must work out which requirements changed, and migrations must work with old data
The final score combines passed cases and cost. Passed cases weigh more Get the pass count first, then save tokens
The model gateway can be slow to the first token, cut off long replies, and reset connections. A run cannot be resumed after the platform pauses it Needs request hedging, resending broken streams, and resume from checkpoint

Architecture

Architecture

At the core is one main session (the Engineer). In a single context it goes from reading the requirements to delivery: write the plan, write tests, implement, check, fix. Sub-agents do only two kinds of work: parallel work (reviewing a finished feature area, drafting tests for the next one) and mechanical work (reading many files and reporting the key points, investigating failures with unknown cause). Sub-agents do not inherit the main session history, cannot create sub-agents, and at most 4 run at once.

The code is about 3,300 lines of Python. It uses no framework, only openai and pyyaml.

Why not multi-role orchestration

These are the orchestration approaches I tried during development and what I measured. The data comes from docs/architecture.md in the repository:

Approach Result
Free-running loop, no verification gate An early prototype passed 0 cases on the GitHub task, using 290 million tokens, 54.09 CNY, and about 3.9 hours
Task graph with parallel workers Replaced after one day; 930 lines deleted
Main agent writes a Spec, workers build from the Spec Best result 46/60, 3 cases fewer than the final design, with 1.2 to 5.6 times the tokens of the final design
Independent Advisor supervising continuously 71.44 million to 162 million tokens per run. In one run the final review never executed; the run record says complete: false, yet the main agent still claimed it was done
Sub-agents inherit the main session history About 70,000 tokens on each sub-agent's first request
Several workers write the same code One worker's checkout overwrote a file another worker had just changed

Requirements get distorted when they pass through a Spec. One scenario said "open the specified organization". The Spec turned that into "click the link with the display name". In the seed data the display name and the organization ID differ, so all three scenarios failed. The supervisor saw the substitution and accepted it. So the final design feeds the original requirement text directly into the session that writes the code. The cost of one long context is acceptable: the history is append-only and the prefix is stable, so the prompt cache hit rate in real runs was 95% to 97%.

Hard parts and how I handled them

check: validation close to the grader

The check tool installs and builds the frontend with the delivery commands, starts the backend on an empty database with npm start, then runs the Playwright tests the agent wrote itself (4 workers, 15 seconds per test, 3 seconds per action timeout). Every item in the report comes from a specific failure:

  • A failure comes with the page's accessibility snapshot, so the model can compare "what the test is looking for" with "what is on the page".
  • When a click is intercepted, the full reason is given, not truncated.
  • Tests that fail during the concurrent run are rerun one by one. Those that pass on rerun are marked FLAKY. If more than 10 fail on rerun, it stops early.
  • If a seed value from a scenario precondition cannot be found in the fresh database, it is listed.

When a database from the previous stage exists, check also starts the app on a copy of it and runs the tests again. In a run of the final design this showed: empty database 105/105, old database 98/105, with the backend reporting no such column: id. The migration backfill UPDATE used id, while the SELECT used rowid AS id. It only triggers when existing rows need backfilling, so an empty database cannot catch it.

How requirements enter the context

The requirement tool returns, in one call, the cards for all atomic requirements in one feature area: description, quoted UI strings, reference image paths, and the original scenario sentences. Component specs (7 of them: forms, menus, grids, and so on) are attached after the cards automatically, matched by regex on trigger words. I tried letting the model read them on demand. The main session never read them, and problems that had already been solved came back.

For staged tasks, I compute a fingerprint for each requirement (name, description, scenarios, grouping rule) and compare it with the previous stage. The outline marks [new], [changed], and [unverified]. While any marked requirement has not been read, done is refused.

Context and cost

  • When the history passes 200,000 tokens, older long tool outputs, file contents already overwritten by later patches, and screenshots are replaced with placeholders. This only runs if it saves at least 30,000 tokens, to avoid breaking the cache too often.
  • Past 400,000 tokens, the session writes its own handoff summary. The history is replaced with the new task, the summary, and the most recent 60,000 or so tokens.
  • Read-only commands are identified by an allowlist and run concurrently. If a read-only command's output is identical to something already in the conversation, only a one-line notice is returned.

Usage of the final design: GitHub task 3.07 CNY and 20.78 million tokens; spreadsheet task 1.48 CNY and 8.32 million tokens.

Model requests

llm.py handles problems actually seen on the competition gateway. If there is no first token after 12 seconds, it sends a second request and uses whichever answers first. If a stream drops after tokens have arrived, it resends at once and caps the output at about 60% of what was already received. An HTTP 400 caused by a proxy reset (body contains "proxy") is treated as retryable. After 15 minutes with no data, it delivers the current state.

Sandbox and resume

In one competition run, the model used bash to look at the outer runner's configuration and the test directory. We voided that run and added a filesystem boundary: Landlock on Linux and sandbox-exec on macOS. Commands can write only to the workspace and temp directories, and the model key is not passed to child processes. The first version of the boundary refused to run when it found .arc in the input. But the workspace the platform hands over for later stages contains .arc itself, so the run failed after 1 second. I changed it to copy only the app files into an isolated directory.

Each session writes its messages and checkpoints to files. The main session makes one git commit per step, and --resume restores the last checkpoint. I did this because a run once paused on the platform and could not be resumed.

Lessons

The biggest single gain came from one shared entry point. The login entry was not placed in the region the requirement named, so every later step in every scenario could not proceed. Moving the element into the named region, and having tests scope their lookup to the region the step names, changed only 25 lines. The GitHub task went from 6/30 to 23/30. The test helper functions were looser than the requirements (they searched the whole page), so self-testing could not find this kind of problem.

Passing all self-tests also does not mean passing officially. In the final design the spreadsheet task scored 87/87 in self-test on both databases and 26/30 officially. In the most extreme case during exploration, self-test was 87/87 and the official result was 0/30, because the framework gave a wrong "no seed data" summary.

Later iterations

In the finals I kept working on changes from v43 to v48 (Spec division of labor, continuous supervision, a final review in a fresh session, and so on). None of their official scores beat v25 (see the chart at the top). On 2026-10-08 I stopped running scores and recorded the changes, scores, and where the evidence is in docs/finals-handoff-2026-10-08.md. The score on the final leaderboard is still v25's 49/60.

Each version has only one official run. There is no same-version variance data, so differences between versions cannot be attributed strictly.