mirror of
https://github.com/browser-use/browser-use.git
synced 2026-09-14 19:59:47 +08:00
cbe07e14d3
Agent(ultrafast=True) assigns its settings unconditionally, so passing an override alongside it did nothing: Agent(ultrafast=True, use_vision=True) ran without vision. Every ultrafast_* ablation profile was built that way and was therefore a silent duplicate of the preset, which invalidates the vision, thinking and history comparisons taken from them. The preset now lives in ULTRAFAST_AGENT_SETTINGS and the flag applies exactly that dict, so an ablation spreads it and overrides the one key under test. Two tests pin the behaviour: the flag and the spread must agree, and a spread override must survive. Adds ultrafast_memory and ultrafast_noloop profiles for the looping seen on real tasks, and fixes demo.py, which combined flash_mode with flash_memory=False and no flash_thinking -- leaving 'action' as the only output field, so the model planned a multi-item task with nowhere to reason.
Codebase Structure
The code structure inspired by https://github.com/Netflix/dispatch.
Very good structure on how to make a scalable codebase is also in this repo.
Just a brief document about how we should structure our backend codebase.
Code Structure
src/
/<service name>/
models.py
services.py
prompts.py
views.py
utils.py
routers.py
/_<subservice name>/
Service.py
Always a single file, except if it becomes too long - more than ~500 lines, split it into _subservices
Views.py
Always split the views into two parts
# All
...
# Requests
...
# Responses
...
If too long → split into multiple files
Prompts.py
Single file; if too long → split into multiple files (one prompt per file or so)
Routers.py
Never split into more than one file