Efficient and Controllable Web Exploration with Tree-Structured Reasoning and Action Memory
Branch-and-Browse is a fine-grained web agent framework that unifies structured reasoning-acting, contextual memory, and efficient execution. It:
- employs explicit subtask management with tree-structured exploration for controllable multi-branch reasoning,
- accelerates exploration through efficient web state replay and background reasoning, and
- maintains a page action memory that shares explored actions within and across sessions.
On the WebArena benchmark, Branch-and-Browse achieves a 35.8% task success rate and reduces execution time by up to 40.4% relative to state-of-the-art methods.
main.py # Entry point (interactive browser agent)
browser_agent.py # BrowserAgent: ReAct agent + search/memory mixins
core/
agent.py # Task decomposition, subtask manager, final response
evaluation.py # LLM-as-a-judge state evaluator
memory.py # Memory summarization and chunked observations
utils.py # Tool execution and output filtering
search/
functions.py # Tree exploration, state replay, background
# reasoning, page action memory
build_in_prompt/ # Prompt templates
- Python 3.10+
- Node.js and npm (for the Playwright MCP server)
- A DashScope API key (or adapt
main.pyto another model provider supported by AgentScope)
pip install agentscopePlaywright MCP is fetched automatically via npx; you can verify it starts with:
npx @playwright/mcp@latestexport DASHSCOPE_API_KEY="your_api_key_here"
# Default reasoning-acting loop
python main.py
# Tree-structured search (Branch-and-Browse exploration)
python main.py --use-search-reply
# Other options
python main.py --start-url https://example.com --max-iters 100 --model qwen-maxType your task in the terminal (e.g., a question to answer by browsing), and exit to quit.
| Parameter | Default | Description |
|---|---|---|
use_search_reply |
False |
Enable tree-structured search exploration |
search_branch_factor |
5 |
Branching factor b of the search tree |
search_max_depth |
5 |
Maximum exploration depth d |
replay_mode |
"mixed" |
Web state replay: nearest-URL ("mixed"), URL-only ("url"), or full trajectory ("trajectory") |
use_background_reasoning |
True |
Evaluate unexplored branches offline to prune and pre-expand |
page_action_memory_path |
./logs/page_action_memory.json |
External cache for sharing explored actions across sessions (None disables) |
@inproceedings{he2026branchandbrowse,
title = {Branch-and-Browse: Efficient and Controllable Web Exploration with Tree-Structured Reasoning and Action Memory},
author = {He, Shiqi and Cui, Yue and Ma, Xinyu and Li, Yaliang and Ding, Bolin and Chowdhury, Mosharaf},
booktitle = {Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (ACL)},
year = {2026}
}This project is licensed under the Apache License 2.0 - see the LICENSE file for details.