Search

Search papers and lessons

WebArena: A Realistic Web Environment for Building Autonomous Agents

Shuyan Zhou, Frank F. Xu, Hao Zhu et al. · 2023

WebArena is a self-hosted set of realistic websites plus 812 tasks scored by checking the final state; the best GPT-4 agent succeeded on 14.41% of tasks, humans on 78.24%.

On this page

  • Colour = topic mix
  • Probability
  • Discrete math
  • Calculus
  • Neural network basics
  • Linear algebra
  • Language & LLMs
  • ReadReady to readNot yet

TL;DR

WebArena is a test bed for AI agents that use websites. It is six self-hosted websites (an online shop, a Reddit-style discussion forum, a GitLab code-hosting site, a store content management system, a map and an English Wikipedia), plus a calculator and a scratchpad, all packaged so that anyone can run the same copy. The authors curated 812 tasks from 241 templates, written as plain-English goals, and scored each one by checking what the website ended up holding, not by comparing the agent's clicks with a reference list.

The best agent they tested, GPT-4 prompted with two examples, finished 14.41% of the tasks. Human volunteers finished 78.24%.

Builds on: LLM Agent, Chain-of-Thought Prompting, Partially Observable Markov Decision Process · Leads to: SWE-bench: Can Language Models Resolve Real-World GitHub Issues?, a related benchmark that tests agents on code

Why it mattered

The paper's premise is that autonomous agents could handle everyday tasks given plain-language commands, but that this can only be measured in an environment that is both authentic and reproducible. Earlier agent benchmarks often ran on simplified copies of websites or on live sites that change and block bots. WebArena gave the field a benchmark that is realistic enough to be useful and fixed enough to be repeated. It was also the first web environment, in the authors' account, to include multi-tab tasks, which let an agent compare pages across tabs the way a person does.

The problem

To judge an agent you need three things. The environment must behave like the real thing, so that the skills an agent learns transfer. Runs must be reproducible, so that two systems tested a year apart face the same pages. And success must be measured on what the task achieved.

Live websites fail the reproducibility test: they bring CAPTCHAs for bots, unpredictable content changes and configuration changes that make fair comparison hard across systems and over time. Simplified copies of sites fail the realism test, because the tasks become easier than real ones. WebArena tries to pass both tests by running standalone sites built on open-source libraries that underlie real sites, with data imported from their real counterparts. A third issue is scoring: a task can be done in several correct ways, so checking the agent's actions against one reference sequence is fragile.

Terms used below. A benchmark is a fixed set of tasks with a fixed way of scoring them. Functional correctness means the outcome is right, whatever path produced it. The DOM tree is a page's full structure of HTML elements. The accessibility tree is a smaller version of that structure that keeps the elements useful for displaying a page, each with its role (for example, link or button), its text and its properties (such as whether it can take focus). A reward is a number the environment gives after a run, here 1 for success and 0 for failure.

How it works

Here is one task traced from start to finish, using a made-up but typical intent. The steps follow the order in which the benchmark runs.

  1. Input. The benchmark gives the agent an intent in plain English, for example: "Post to ask whether I need a car in NYC." The agent also gets an observation: the current URL, the list of open tabs, and the content of the active tab. The content can be a screenshot, the DOM tree or the accessibility tree. The baseline agents in the paper use the accessibility tree, with an ID prepended to each element.
  2. Choose an action. The agent reads the observation and picks one action from a fixed list that copies what a keyboard and mouse can do: click, hover, type, press a key combination, open, close or switch tabs, go to a URL, or go back and forward. An element is named by its ID, so the action click [1582] means "click the element with ID 1582, which reads Add to Cart." Naming elements by ID turns the choice into a choice among a fixed set, which keeps comparisons between agents fair.
  3. Apply the action. The site runs the action and moves to a new state. The transition is deterministic: the same state and the same action give the same next state, so the environment itself adds no randomness.
  4. Repeat. Steps 1 to 3 repeat until the agent stops or hits a limit. The runs are capped at 30 state transitions. The run also halts if the same action is repeated more than three times on the same observation, or if the agent produces three consecutive invalid actions.
  5. Score. After the run, the environment looks at the states the run passed through. For this task, a checker finds the URL of the newest post, opens that page, reads the post's text, and checks that the URL points to the nyc forum and the text contains "a car in NYC." If both hold, the reward is 1. If the post went to the wrong forum, or lacks the text, the reward is 0.
  6. Reset. Each website runs in its own Docker container, a packaged bundle of code, data and dependencies. To return a site to its starting state, the container is stopped and a fresh one is started from the original image. The paper says this takes from a few seconds to one minute.
flowchart LR
  A[Intent in plain English] --> B[Observation: URL, tabs, accessibility tree]
  B --> C[Agent picks one action]
  C --> D[Website changes state]
  D -->|not done| B
  D -->|done or limit hit| E[Checker reads final states]
  E --> F[Reward 1 or 0]

The math

We need only a few symbols. An agent run is a sequence of actions a1,…,aTa_1, \ldots, a_T and of states s1,…,sTs_1, \ldots, s_T that the website passes through. The environment gives the run a reward r(a1T,s1T)r(a_1^T, s_1^T), which the paper uses as a binary score: 1 if the task is achieved, 0 otherwise.

Step 1 in symbols: the observation

The agent chooses its action from the intent i\mathbf{i}, the current observation oto_t, and the history of past actions and observations. Written as a choice of action:

at∼π(⋅∣i, ot, a1t−1, o1t−1)a_t \sim \pi\left(\cdot \mid \mathbf{i},\, o_t,\, \mathbf{a}_1^{t-1},\, \mathbf{o}_1^{t-1}\right)

The symbol π\pi stands for the agent's policy, the rule that maps what it has seen to what it does next. In the paper's baselines the policy is a language model prompted with instructions and two examples.

Step 2 in symbols: the action space

The actions form a finite set A\mathcal{A}. An element is chosen by its ID, so an element action is one choice among nn elements on the page. This is why the paper calls element selection "an nn-way classification problem."

Step 3 in symbols: the transition

The website is a deterministic function T:S×A→S\mathcal{T}: \mathcal{S} \times \mathcal{A} \to \mathcal{S}. Given state sts_t and action ata_t, the next state is st+1=T(st,at)s_{t+1} = \mathcal{T}(s_t, a_t). Any variation in outcomes across runs comes from the agent.

Step 4 in symbols: the reward and the success rate

For information-seeking tasks the reward compares the predicted answer a^\hat{a} with the annotated answer a∗a^{*}. The paper defines three scoring functions, each returning 1 or 0:

  • exact_match: 1 if a^\hat{a} is identical to a∗a^{*}.
  • must_include: 1 if a∗a^{*} appears inside a^\hat{a}.
  • fuzzy_match: 1 if a judge model says the two answers are semantically equivalent.

For navigation and content tasks, the reward inspects the final states and checks keywords, as in Step 5 above.

The end-to-end success rate is the average reward over the tasks:

SR=1N∑i=1Nri,ri∈{0,1}\mathrm{SR} = \frac{1}{N}\sum_{i=1}^{N} r_i, \qquad r_i \in \{0, 1\}

where NN is the number of tasks. If 40 of 100 tasks get reward 1, then SR=40%\mathrm{SR} = 40\%.

Worked numbers

Three examples, from tiny to realistic.

Example 1: a tiny success rate. An agent is given 10 tasks and finishes 2.

  1. The rewards are two 1s and eight 0s.
  2. Their sum is 1+1=21 + 1 = 2.
  3. The average is 2/10=0.22 / 10 = 0.2.
  4. As a percentage, SR=20%\mathrm{SR} = 20\%.

Interpretation: a 20% success rate means the agent completed one task in five.

Example 2: scoring one navigation task. Take the task from Step 5, and a run that posted "Do I need a car in NYC?" in the right forum.

  1. The checker finds the URL of the newest post. It is the URL of a post in the nyc forum.
  2. It checks that the URL points to the nyc forum. It does, so the first condition is 1.
  3. It reads the post body and checks that it contains "a car in NYC." It does, so the second condition is 1.
  4. Both hold, so the reward is r=1⋅1=1r = 1 \cdot 1 = 1.
  5. Had the post gone to another forum, the first condition would be 0, and the product would be 0 whatever the body said.

Interpretation: the reward is an AND of the keyword checks, so a run must get every part of the goal right to score.

Example 3: the gap between the best agent and people. Table 2 of the paper gives the best GPT-4 row (no UA hint) at 14.41% and the human row at 78.24%.

  1. Subtract the agent's rate from the human rate: 78.24−14.41=63.8378.24 - 14.41 = 63.83.
  2. The gap is 63.83 percentage points.
  3. Divide the human rate by the agent's rate: 78.24/14.41≈5.4378.24 / 14.41 \approx 5.43.
  4. Humans finish about 5.4 times as many tasks as the best agent.

Try it: in Table 2, GPT-3.5 without chain-of-thought (CoT), with the UA hint, scores 6.41%. With CoT and the UA hint it scores 8.75%. By what percentage does CoT raise the rate, relative to 6.41%? Answer: the absolute gain is 8.75−6.41=2.348.75 - 6.41 = 2.34 points, and 2.34/6.41≈0.3652.34 / 6.41 \approx 0.365, so about 36.5% relative. The paper quotes the gain from the hint-and-CoT row as 2.34%.

Results

The main results use end-to-end success rate (SR, percent of tasks scored 1) on the benchmark. The paper's Table 2 reports the rows below. "CoT" means the model writes reasoning before each action. "UA hint" means the prompt tells the model it may answer "N/A" for impossible tasks. SR_AC and SR_UA split the rate between achievable and unachievable tasks.

CoTUA hintModelSRSR_ACSR_UA
yesyestext-bison-0015.054.0027.78
noyesGPT-3.56.414.9038.89
yesyesGPT-3.58.756.4458.33
yesyesGPT-411.708.6377.78
nonoGPT-3.55.104.908.33
yesnoGPT-3.56.166.068.33
yesnoGPT-414.4113.0244.44
n/ayesHuman78.2477.30100.00

What the numbers say:

  • The best agent, GPT-4 with CoT and no UA hint, reached 14.41%. Humans reached 78.24%, with lower scores on information-seeking tasks (74.68%) than on the rest (81.32%). The human baseline came from five computer science graduate students, who performed one sampled task from each of 170 templates.
  • CoT helped a little where the paper compares it. For GPT-3.5 it added 2.34 points with the UA hint (6.41 to 8.75) and 1.06 points without it (5.10 to 6.16). The gain is small next to the gap to people.
  • The UA hint trades one failure for another. In the error analysis, GPT-4 wrongly judged 54.9% of feasible tasks impossible. Removing the hint raised its overall rate from 11.70% to 14.41%, and the model still recognised 44.44% of impossible tasks, by writing reasons it was impossible even without being told to.
  • Consistency is weak. Of the 61 templates with at least one success for a GPT model, GPT-4 reached 100% on only four, and GPT-3.5 on none. Tasks from one template can differ a lot in difficulty.
  • Other failure modes were observed. GPT-3.5 often hallucinated answers, repeated invalid actions or ran out of steps. GPT-4 often used the first related number it saw on a page, such as a homepage's recent best sellers, instead of running the report that gives a yearly ranking, and it sometimes ignored details it had already entered, such as a search term.

Limits. The results cover three models and two prompting styles, using temperature 1.0 and top-p 0.9 to encourage exploration. The fuzzy match judge was GPT-4-0613, which the authors checked: it agreed with human judgement on 39 of 40 hand-checked examples, and both GPT-4 versions tested reached 100% accuracy on 900 date and 900 duration format variants. The environment is a snapshot, so the scores belong to this version of the sites.

Reading guide

  • Abstract and Section 1: the goal and the claim that current environments are too simple. Needs LLM Agent for what an agent is.
  • Section 2 (the environment): the six sites, the observation and action spaces. Needs Partially Observable Markov Decision Process for the idea that the agent sees only part of the state, and Tool Use for the map, calculator and scratchpad.
  • Section 3 (the benchmark): intents, templates and the three answer checks. Needs Language Model for the judge used by fuzzy matching.
  • Section 4 (baseline agents): prompting with two examples, and chain-of-thought. Needs In-Context Learning and Chain-of-Thought Prompting.
  • Section 5 (results and analysis): Table 2 and the error analysis. Needs GPT-4 Technical Report for the model used.
  • Appendices A.1 to A.3: the websites, reset and user roles, useful if you want to rebuild the environment.

Check yourself

QuestionThe benchmark has 812 tasks. Suppose 117 of them are completed. What is the success rate, to two decimal places?Show answer

117/812=0.14408…117 / 812 = 0.14408\ldots, so the success rate is 14.41%.

QuestionIn the paper's template analysis, GPT-4 reaches a 100% success rate on only four of the 61 templates. What fraction of templates is that, to one decimal place?Show answer

4/61=0.0656…4 / 61 = 0.0656\ldots, so about 6.6% of templates.

QuestionWhy does the benchmark score final states rather than comparing the agent's actions with a reference sequence?Show answer

Several action sequences can reach the same correct outcome, so comparing action text would mark correct paths as wrong. A state check measures whether the goal was achieved, which is functional correctness.

QuestionA user asks an agent, 'Tell me the contact phone number of OneStopShop.' The site has no phone number. What should a correct answer be, and why?Show answer

The correct answer is "N/A," because the task is unachievable on this site. The benchmark labels such tasks this way, so agents are rewarded for not making up facts.

QuestionRemoving the UA hint raised GPT-4's success rate from 11.70% to 14.41%. What did the hint cost, and what did it give?Show answer

It cost performance on feasible tasks, because the model often stopped early and labelled feasible tasks as impossible. It gave the model a way to recognise impossible tasks. After the hint was removed the model still identified 44.44% of impossible tasks.

Sources

Read the full paper

Shuyan Zhou, Frank F. Xu, Hao Zhu et al., 2023. arXiv:2307.13854