- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.6k
 
Checkpoint from VS Code for coding agent session #687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            Copyxyzai
  wants to merge
  1
  commit into
  browser-use:main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
Copyxyzai:copilot/vscode1758553710896
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
      
        
          +100
        
        
          −72
        
        
          
        
      
    
  
  
     Open
                    Changes from all commits
      Commits
    
    
  File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
This file was deleted.
      
      Oops, something went wrong.
      
    
  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| # Browser Use Web UI Development Guide | ||
| 
     | 
||
| ## Project Overview | ||
| Browser Use Web UI is a Gradio-based web interface for browser automation agents built on the browser-use library (https://github.com/browser-use/browser-use). The architecture follows a modular design with clear separation between browser control, agent logic, and UI components. | ||
| 
     | 
||
| ## Core Architecture | ||
| 
     | 
||
| ### Key Components | ||
| - **`src/agent/`**: Agent implementations (`BrowserUseAgent`, `DeepResearchAgent`) | ||
| - **`src/browser/`**: Custom browser and context wrappers extending browser-use | ||
| - **`src/controller/`**: Custom action controller with MCP tool integration | ||
| - **`src/webui/`**: Gradio interface with modular tab components | ||
| - **`src/utils/`**: Configuration, LLM providers, and utilities | ||
| 
     | 
||
| ### Critical Files | ||
| - `webui.py`: Main entry point with CLI args for IP/port/theme | ||
| - `src/webui/interface.py`: UI assembly with tab-based layout | ||
| - `src/controller/custom_controller.py`: Action registry with custom actions | ||
| - `src/utils/config.py`: LLM provider definitions and model mappings | ||
| 
     | 
||
| ## Development Patterns | ||
| 
     | 
||
| ### LLM Provider Integration | ||
| Follow the pattern in `src/utils/config.py` for new providers: | ||
| ```python | ||
| PROVIDER_DISPLAY_NAMES = {"provider_key": "Display Name"} | ||
| model_names = {"provider_key": ["model1", "model2"]} | ||
| ``` | ||
| 
     | 
||
| ### Custom Actions | ||
| Register new browser actions in `CustomController._register_custom_actions()`: | ||
| ```python | ||
| @self.registry.action("Description of when to use this action") | ||
| async def action_name(param: str, browser: BrowserContext): | ||
| # Implementation | ||
| return ActionResult(extracted_content=result, include_in_memory=True) | ||
| ``` | ||
| 
     | 
||
| ### UI Components | ||
| Create new tabs as separate files in `src/webui/components/` following the pattern: | ||
| ```python | ||
| def create_tab_name_tab(ui_manager: WebuiManager): | ||
| with gr.Column(): | ||
| # Gradio components | ||
| pass | ||
| ``` | ||
| 
     | 
||
| ### Agent Implementations | ||
| Extend `BrowserUseAgent` or create new agents inheriting from browser-use's `Agent` class. Key patterns: | ||
| - Override `_set_tool_calling_method()` for model-specific configurations | ||
| - Use `@time_execution_async("--run (agent)")` for performance tracking | ||
| - Implement proper cleanup in `finally` blocks | ||
| 
     | 
||
| ## Configuration & Environment | ||
| 
     | 
||
| ### Environment Variables | ||
| - LLM API keys: `{PROVIDER}_API_KEY`, `{PROVIDER}_ENDPOINT` | ||
| - Browser: `BROWSER_PATH`, `BROWSER_USER_DATA`, `BROWSER_DEBUGGING_PORT` | ||
| - Logging: `BROWSER_USE_LOGGING_LEVEL`, `ANONYMIZED_TELEMETRY` | ||
| 
     | 
||
| ### Docker Development | ||
| - Uses supervisord for multi-service orchestration (VNC, noVNC, WebUI) | ||
| - VNC available at `:6080/vnc.html` for browser observation | ||
| - Playwright browsers installed to `/ms-browsers` | ||
| 
     | 
||
| ## Testing & Running | ||
| 
     | 
||
| ### Local Development | ||
| ```bash | ||
| python webui.py --ip 127.0.0.1 --port 7788 --theme Ocean | ||
| ``` | ||
| 
     | 
||
| ### Test Structure | ||
| Tests in `tests/` demonstrate usage patterns: | ||
| - `test_agents.py`: Complete agent workflows with LLM/browser setup | ||
| - MCP server integration examples with desktop-commander | ||
| 
     | 
||
| ### Docker Deployment | ||
| ```bash | ||
| docker compose up --build | ||
| # For ARM64: TARGETPLATFORM=linux/arm64 docker compose up --build | ||
| ``` | ||
| 
     | 
||
| ## MCP Integration | ||
| Model Context Protocol (MCP) tools are dynamically registered via `setup_mcp_client()`. Tools are prefixed with `mcp.{server_name}.{tool_name}` and integrated into the action registry. | ||
| 
     | 
||
| ## Browser Configuration | ||
| - Custom browser extends browser-use's Browser class | ||
| - Supports persistent sessions via `BROWSER_USER_DATA` | ||
| - Window dimensions configurable via `window_w`, `window_h` variables | ||
| - Use `use_own_browser=True` for existing Chrome profiles | ||
| 
     | 
||
| ## Key Dependencies | ||
| - `browser-use==0.1.48`: Core browser automation | ||
| - `gradio==5.27.0`: Web UI framework | ||
| - `langchain-*`: LLM provider adapters | ||
| - `playwright`: Browser automation backend | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of the
.env.examplefile has led to a significant loss of configuration documentation. The replacement instructions in.github/copilot-instructions.mdare incomplete, omitting dozens of necessary environment variables for LLM providers, browser settings, and other features, making project setup difficult and obscure.Prompt for AI agents