How browser-use/web-ui works
Main Components
a) Frontend Layer:
• Gradio Web Interface (webui.py)
• Theme System (with multiple theme options)
• Dark/Light Mode Support
b) Core Components:
• Agent System (src/agent/)
• Browser Integration (src/browser/)
• Controller Layer (src/controller/)
• Utilities (src/utils/)
c) External Integrations:
• LLM Services (Gemini, OpenAI, Azure OpenAI, Anthropic, DeepSeek, Ollama)
• Browser Instances (Chrome/Custom Browser)
• Playwright Integration
[User Interface Layer]
[Core Processing Layer]
[External Services Layer]
Component Relationships
a) User Interface → Controller:
• How webui.py interfaces with custom_controller.py
b) Controller → Agent:
• How custom_controller.py manages custom_agent.py
• Message flow through custom_message_manager.py
c) Agent → Browser:
• Connection between custom_agent.py and custom_browser.py
• Context management via custom_context.py
d) External Services Integration:
• LLM API connections
• Browser instance management
• Playwright automation flow
Implementation Details
[webui.py] → [custom_controller.py] → [custom_agent.py]
• ↓
• [custom_browser.py]
• ↓
• [External Browser Instance]
Additional Elements
• Environment configuration flow (.env)
• Test coverage relationship (tests/ directory)
• Asset management (assets/ directory)
The central role of the agent system
Keep the abstraction level high enough to show the overall architecture while including sufficient detail to understand the interaction between components. Focus on showing how the system enables AI agents to interact with web browsers through the Gradio-based UI.
Remember to include version compatibility notes (Python 3.11+) and environment setup requirements as supplementary information.