How browser-use/workflow-use works
Project type and purpose
• This is a hybrid tool consisting of:
• A browser extension (built with TypeScript/React/Tailwind, bundled via Vite) that records user interactions and generates “workflow” JSON files.
• A Python‐based CLI & library (workflow_use) that loads those JSON workflows, executes them deterministically (with automatic LLM fallback/self-healing), and interacts with a browser automation engine (Browser Use/Playwright).
• Purpose: Record once, replay reliably, with structured variables and self-healing.
File structure
• Top-level:
• extension/ – all code for the browser extension: entrypoints (background.ts, content.ts, sidepanel UI), shared lib & types, assets, components.json, config (vite.config.ts, wxt.config.ts).
• workflows/ – Python code & CLI: cli.py, pyproject.toml, modules under workflow_use (builder, controller, recorder, schema, workflow), example workflows, tests, .env for OpenAI key.
• static/, LICENSE, README.md, workflows/.env.example.
• Patterns:
• Extension uses a message-bus type system for content⇄background⇄sidepanel communication.
• Python package structured by domain: builder (construct workflows), recorder (capture execution), controller (runtime orchestration), workflow (core execution logic), schema (validation).
README for additional insights
• The README details the two phases:
a. Build the extension → bundle for Chrome/Edge etc.
b. Setup Python env → run CLI commands (run-as-tool, run-workflow, create-workflow).
• Dependencies: Node/NPM, Playwright (Chromium), Python3, OpenAI API.
Important: be very detailed
• Message-bus types and entrypoints in the extension.
• Self-healing loop: Controller → LLM → update workflow → retry step.