How risenhealthinsurance-dev/reignbrowser works
Purpose and Entry Points
Browser Use is a Python 3.11+ browser-automation framework where an LLM plans and executes web tasks through a local, remote, or cloud browser. The main library API exports agent and model abstractions from browser_use/__init__.py; runtime orchestration is centered in browser_use/agent/service.py. User-facing entry points include the Python API, CLI in browser_use/cli.py, install/bootstrap command in browser_use/init_cmd.py, and MCP server in browser_use/mcp/server.py.
Agent Orchestration Loop
Agent turns a natural-language task into iterative model decisions, browser/tool actions, observations, and history until completion or a stop condition. Prompt variants live in browser_use/agent/system_prompts/; conversation state, compaction, and model context boundaries are managed by browser_use/agent/message_manager/service.py. Agent-facing state/result schemas are in browser_use/agent/views.py, separating orchestration from browser and provider implementations.
Browser Session and Execution Boundary
The browser layer owns Chrome/CDP lifecycle, profiles, tabs, navigation, events, recording, and remote/cloud connections. browser_use/browser/session.py and browser_use/browser/session_manager.py form the session boundary used by the agent; browser_use/browser/chrome.py handles browser startup/connection. Watchdogs under browser_use/browser/watchdogs/ enforce runtime policy and collect artifacts for events such as downloads, popups, permissions, captchas, screenshots, HAR, and crashes.
Web State Perception and Interaction
The DOM subsystem converts live pages into agent-readable structured state: snapshotting, visibility/clickability analysis, serialization, and markdown extraction. Its primary boundary is browser_use/dom/service.py, with serialized element representations in browser_use/dom/serializer/serializer.py and enhanced page state in browser_use/dom/enhanced_snapshot.py. Low-level interaction abstractions in browser_use/actor/page.py and browser_use/actor/mouse.py execute page and coordinate-level actions selected by the agent.
Tools, Actions, and Local Resources
The tools layer provides the action registry and typed action contracts that connect LLM tool calls to browser operations, extraction, and custom user actions. Core registry behavior is in browser_use/tools/registry/service.py; aggregate tool setup is in browser_use/tools/service.py. File operations are isolated behind browser_use/filesystem/file_system.py, while browser_use/sandbox/sandbox.py provides a controlled execution boundary for sandboxed workflows. This enables custom actions without coupling them to agent planning.
LLM Provider Abstraction
A shared chat/model interface normalizes messages, structured output, serialization, retries, and provider-specific APIs. Core contracts are in browser_use/llm/base.py, browser_use/llm/messages.py, and browser_use/llm/models.py. Provider adapters support Browser Use hosted models plus OpenAI, Anthropic, Google, AWS Bedrock, Azure, Ollama, OpenRouter, and others under browser_use/llm/. Provider credentials and API behavior remain outside agent/browser control logic.
External Services and Deployment Modes
The package can call Browser Use Cloud for hosted agents and remote browsers through browser_use/browser/cloud/cloud.py, and exposes cloud-specific event handling in browser_use/agent/cloud_events.py. It also integrates with Gmail via browser_use/integrations/gmail/service.py, supports MCP clients/servers through browser_use/mcp/client.py and browser_use/mcp/server.py, and emits telemetry via browser_use/telemetry/service.py. Docker packaging (Dockerfile, docker/base-images/chromium/Dockerfile) supplies a reproducible Python/Chromium runtime for containerized execution.
Main entry points: agent/service.py Agent orchestration · session.py Browser session · registry/service.py Action registry · message_manager/service.py Message manager
Components 22
Entry points
- Python API
browser_use/__init__.py - CLI
browser_use/cli.py - Install bootstrap
browser_use/init_cmd.py - MCP server
browser_use/mcp/server.py
Agent runtime
- Agent orchestration · Plans, executes actions, observes results, and stops on completion.
browser_use/agent/service.py - System prompts
- Message manager · Maintains conversation state and compacts model context.
browser_use/agent/message_manager/service.py - Agent schemas
browser_use/agent/views.py - Tool setup
browser_use/tools/service.py - Action registry · Dispatches model tool calls to browser, extraction, and custom actions.
browser_use/tools/registry/service.py
Browser execution
- Browser session · Owns tabs, navigation, profiles, events, and remote connections.
browser_use/browser/session.py - Session manager
browser_use/browser/session_manager.py - Chrome / CDP
browser_use/browser/chrome.py - Runtime watchdogs · Handles downloads, popups, permissions, captures, HAR, and crashes.
- DOM perception · Builds agent-readable page snapshots and extracted content.
browser_use/dom/service.py - Page interaction
browser_use/actor/page.py
Providers & integrations
- LLM abstraction · Normalizes chat, structured output, retries, and provider APIs.
browser_use/llm/base.py - Cloud browser
browser_use/browser/cloud/cloud.py - File system
browser_use/filesystem/file_system.py - Sandbox
browser_use/sandbox/sandbox.py - Telemetry
browser_use/telemetry/service.py - Container runtime
Dockerfile
Connections 24
- Python API → Agent orchestration: creates agent
- CLI → Agent orchestration: runs tasks
- MCP server → Agent orchestration: serves agent tools
- Install bootstrap → Container runtime: supports setup
- Agent orchestration → System prompts: selects prompt
- Agent orchestration → Message manager: manages context
- Message manager → LLM abstraction: model requests
- LLM abstraction → Agent orchestration: decisions
- Agent orchestration → Agent schemas: reads/writes state
- Agent orchestration → Tool setup: executes decisions
- Tool setup → Action registry: registers actions
- Action registry → Browser session: browser actions
- Action registry → File system: file actions
- Action registry → Sandbox: sandboxed workflows
- Browser session → Session manager: lifecycle
- Session manager → Chrome / CDP: starts/connects
- Browser session → Runtime watchdogs: runtime events
- Browser session → DOM perception: live page state
- DOM perception → Agent orchestration: observations
- Action registry → Page interaction: interaction actions
- Page interaction → Browser session: page commands
- Browser session → Cloud browser: remote/cloud mode
- Agent orchestration → Telemetry: emits events
- Container runtime → Chrome / CDP: bundles Chromium