Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Branch-and-Browse

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:

  1. employs explicit subtask management with tree-structured exploration for controllable multi-branch reasoning,
  2. accelerates exploration through efficient web state replay and background reasoning, and
  3. 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.

Repository Structure

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

Requirements

Installation

pip install agentscope

Playwright MCP is fetched automatically via npx; you can verify it starts with:

npx @playwright/mcp@latest

Usage

export 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-max

Type your task in the terminal (e.g., a question to answer by browsing), and exit to quit.

Key BrowserAgent options

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)

Citation

@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}
}

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

About

An efficient web agent framework

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages