# javed0211/webpilot architecture

> Architecture diagram of the GitHub repository javed0211/webpilot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/javed0211/webpilot
- Repository: https://github.com/javed0211/webpilot

## Overview

1. **Repository shape**
   - This is a **monorepo** centered on a TypeScript orchestration layer (`src/`) with two major adjuncts: a **vendored Python browser-agent runtime** (`packages/browser-use/`) and a **generated/fixture TypeScript Playwright framework** (`packages/test-framework/`).
   - It also contains a **static report UI** asset set (`packages/report-ui/`, `resources/report-ui/`) and a large set of docs, prompts, templates, and sample scenarios.

2. **Primary control plane: the WebPilot CLI and engine**
   - The user-facing entry point is the `webpilot` CLI in `src/cli/`.
   - `src/core/Engine.ts` and related core services coordinate the run lifecycle: parse scenario inputs, load config, choose the execution mode, invoke agents, manage browser sessions, and emit reports/artifacts.
   - This is the main architectural boundary: everything else hangs off the engine.

3. **Scenario inputs and authoring model**
   - Test intent is stored as **plain-text scenarios** under `tests/web/` and `tests/api/`, plus templates in `resources/templates/tests/`.
   - The repo also includes generated examples (`tests/generated/`, `src/test/java/webpilot/generated/`, `cypress/e2e/generated/`) showing that WebPilot can turn one scenario model into multiple framework outputs.
   - The scenario file is the root artifact that flows into execution, codegen, reporting, and regression tracking.

4. **Execution pipeline for browser tasks**
   - The execution path is split across agents in `src/agents/` such as `PlannerAgent`, `ExecutionAgent`, `HealingAgent`, `ValidationAgent`, and `CodegenAgent`.
   - These agents are driven by LLM prompts from `resources/prompts/` and `src/core/PromptLoader.ts`, and use model/provider abstractions in `src/core/LLMClient.ts`.
   - In practice, the flow is: intent → plan → browser actions → validate outcomes → optionally heal or regenerate code.

5. **Browser automation boundary**
   - Browser control is abstracted by `src/core/BrowserManager.ts`, `src/core/browserProviders/`, and browser/session/watchdog services under `src/core` and `packages/browser-use/browser_use/browser/`.
   - The repo supports multiple browser engines/frameworks, but the architecture treats them as **pluggable providers** rather than hard-coded dependencies.
   - Playwright is the dominant deterministic execution engine; Browser Use is used for agentic discovery/live navigation.

6. **Python Browser Use runtime as a separate execution subsystem**
   - `packages/browser-use/` is a full Python package with its own agent, browser, DOM, LLM, MCP, sandbox, telemetry, screenshots, and skills modules.
   - `src/integrations/browser_use/PythonRuntime.ts` and related files bridge the TypeScript orchestration layer to this Python runtime.
   - This creates a clear cross-language boundary: **TypeScript owns product orchestration**, while **Python owns autonomous browser-agent behavior**.

7. **Deterministic code generation subsystem**
   - `src/core/codegen/` implements the deterministic pipeline: trace collection, planning, normalization, validation, and writers for specs/page objects.
   - Profile-specific outputs are handled by `src/core/codegen/profiles/`, covering TypeScript Playwright, Python Playwright, Java Selenium, Cypress, WebdriverIO, and C# Selenium/Playwright.
   - Generated code lands in framework-specific destinations, with `packages/test-framework/` serving as the canonical TypeScript Playwright framework example.

8. **API automation path**
   - Browser workflows are not the only target; `src/core/api/` contains a separate API execution/codegen path via `ApiRunner`, `ApiCodegenService`, and `OpenApiLoader`.
   - API scenarios in `tests/api/` are parsed and run with their own logic, but still feed the same reporting and CI artifact pipeline.
   - This is a parallel subsystem, not just a browser feature.

9. **Knowledge, healing, and reuse**
   - WebPilot persists learning in several forms: `src/core/knowledge/RepoKnowledgeGraph.ts`, `runtime/site-knowledge/`, `runtime/healing-cache/`, and requirement mapping services under `src/core/requirements/`.
   - Selector intelligence and healing live in `src/core/selectors/` and `src/core/flake/`, which classify failures, rank candidate selectors, and recommend recoveries.
   - The architectural goal is to move from “discover each time” toward “replay known-good behavior with fallback healing.”

10. **Reporting and evidence**
   - Execution artifacts are produced by `src/core/execution_report/` and `src/core/ExecutionReportService.ts`, then written under `runtime/reports/`.
   - Reports are static HTML dashboards with screenshots, traces, videos, token usage, cost, and historical/AI analysis; sample outputs are checked into `docs/sample-reports/`.
   - `packages/report-ui/` and `resources/report-ui/` provide the report shell/style layer, while artifacts and manifests support CI publishing.

11. **Configuration, runtime state, and boundaries**
   - The repo separates immutable project assets from mutable runtime state: configs live in `resources/config/`, prompts in `resources/prompts/`, and generated runtime data in `runtime/`.
   - Environment and provider setup are driven by `.env.example`, `resources/config/llm.json`, and `resources/config/webpilot.yaml`.
   - This distinction matters for diagramming: config/prompt assets are input dependencies; `runtime/` is the output/state boundary.

12. **Supporting ecosystems**
   - `packages/test-framework/` is a real test project with page objects, APIs, fixtures, and runnable specs used to validate generated output and framework behavior.
   - `packages/browser-use/skill_cli/` and `src/integrations/browser_use/` show that WebPilot also ships command-line tooling and skills around the agent runtime.
   - GitHub Actions workflows and Dockerfiles provide packaging/CI, but the core runtime architecture is still the CLI-engine → agent/browser → report/artifact pipeline.

13. **If you draw one diagram, use these nodes**
   - Start with: **Scenario files / templates**.
   - Then: **WebPilot CLI / Engine**.
   - Branch into: **LLM-driven agents**, **Browser execution providers**, **API runner**, and **Deterministic codegen**.
   - Feed outputs into: **Runtime knowledge/healing stores** and **Static reports / generated framework code**.
   - Keep the **Python Browser Use runtime** as a separate box connected to the TypeScript engine through an integration boundary.

Main entry points: [`src/core/Engine.ts`](https://github.com/javed0211/webpilot/blob/main/src/core/Engine.ts) (Engine), [`src/agents`](https://github.com/javed0211/webpilot/tree/main/src/agents) (Agents), [`src/cli`](https://github.com/javed0211/webpilot/tree/main/src/cli) (WebPilot CLI), [`src/core/execution_report`](https://github.com/javed0211/webpilot/tree/main/src/core/execution_report) (Execution reports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_inputs["Inputs & assets"]
  node_tests_web["Web scenarios<br/>scenario specs"]
  node_tests_api["API scenarios<br/>api specs"]
  node_resources_templates["Test templates<br/>scenario templates"]
  node_resources_prompts["Prompt assets<br/>prompt library"]
  node_resources_config["Config assets<br/>runtime config"]
  node_runtime_state[("Runtime state<br/>mutable state")]
end

subgraph group_group_control["TypeScript control plane"]
  node_webpilot_cli["WebPilot CLI<br/>entrypoint"]
  node_engine["Engine<br/>orchestrator<br/>[Engine.ts]"]
  node_agents["Agents<br/>llm pipeline"]
  node_llm_client["LLM client<br/>model adapter<br/>[LLMClient.ts]"]
  node_browser_mgr["Browser manager<br/>browser boundary<br/>[BrowserManager.ts]"]
  node_browser_providers["Browser providers<br/>pluggable adapters"]
  node_api_runner["API runner<br/>api subsystem"]
  node_codegen["Deterministic codegen<br/>generation pipeline"]
  node_reporting["Execution reports<br/>artifact pipeline"]
  node_knowledge["Knowledge & healing<br/>learning stores"]
end

subgraph group_group_python["Python browser runtime"]
  node_python_bridge["Python bridge<br/>cross-language bridge<br/>[PythonRuntime.ts]"]
  node_browser_use_runtime["Browser Use runtime<br/>python agent runtime"]
  node_skill_cli["Skill CLI<br/>python cli"]
end

subgraph group_group_outputs["Generated outputs"]
  node_report_ui["Report UI<br/>static ui"]
  node_test_framework["Test framework<br/>generated framework"]
end

node_tests_web -->|"scenario input"| node_webpilot_cli
node_tests_api -->|"scenario input"| node_webpilot_cli
node_resources_templates -->|"authoring aid"| node_webpilot_cli
node_resources_prompts -->|"prompt source"| node_agents
node_resources_config -->|"runtime config"| node_engine
node_webpilot_cli -->|"invokes"| node_engine
node_engine -->|"coordinates"| node_agents
node_agents -->|"LLM calls"| node_llm_client
node_engine -->|"browser control"| node_browser_mgr
node_browser_mgr -->|"provider selection"| node_browser_providers
node_engine -->|"api path"| node_api_runner
node_engine -->|"codegen path"| node_codegen
node_agents -->|"regen/heal"| node_codegen
node_engine -->|"learns from runs"| node_knowledge
node_knowledge -->|"selector reuse"| node_browser_mgr
node_engine -->|"artifacts"| node_reporting
node_reporting -->|"writes"| node_runtime_state
node_codegen -->|"generated output"| node_test_framework
node_reporting -->|"renders with"| node_report_ui
node_python_bridge -->|"bridges to"| node_browser_use_runtime
node_skill_cli -->|"operates"| node_browser_use_runtime
node_agents -->|"agentic mode"| node_python_bridge

click node_tests_web "https://github.com/javed0211/webpilot/tree/main/tests/web"
click node_tests_api "https://github.com/javed0211/webpilot/tree/main/tests/api"
click node_resources_templates "https://github.com/javed0211/webpilot/tree/main/resources/templates/tests"
click node_resources_prompts "https://github.com/javed0211/webpilot/tree/main/resources/prompts"
click node_resources_config "https://github.com/javed0211/webpilot/tree/main/resources/config"
click node_runtime_state "https://github.com/javed0211/webpilot/tree/main/runtime"
click node_webpilot_cli "https://github.com/javed0211/webpilot/tree/main/src/cli"
click node_engine "https://github.com/javed0211/webpilot/blob/main/src/core/Engine.ts"
click node_agents "https://github.com/javed0211/webpilot/tree/main/src/agents"
click node_llm_client "https://github.com/javed0211/webpilot/blob/main/src/core/LLMClient.ts"
click node_browser_mgr "https://github.com/javed0211/webpilot/blob/main/src/core/BrowserManager.ts"
click node_browser_providers "https://github.com/javed0211/webpilot/tree/main/src/core/browserProviders"
click node_api_runner "https://github.com/javed0211/webpilot/tree/main/src/core/api"
click node_codegen "https://github.com/javed0211/webpilot/tree/main/src/core/codegen"
click node_reporting "https://github.com/javed0211/webpilot/tree/main/src/core/execution_report"
click node_knowledge "https://github.com/javed0211/webpilot/tree/main/src/core/knowledge"
click node_python_bridge "https://github.com/javed0211/webpilot/blob/main/src/integrations/browser_use/PythonRuntime.ts"
click node_browser_use_runtime "https://github.com/javed0211/webpilot/tree/main/packages/browser-use/browser_use"
click node_skill_cli "https://github.com/javed0211/webpilot/tree/main/packages/browser-use/browser_use/skill_cli"
click node_report_ui "https://github.com/javed0211/webpilot/tree/main/resources/report-ui"
click node_test_framework "https://github.com/javed0211/webpilot/tree/main/packages/test-framework"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_tests_web,node_tests_api,node_resources_templates,node_resources_prompts,node_resources_config,node_runtime_state toneBlue
class node_webpilot_cli,node_engine,node_agents,node_llm_client,node_browser_mgr,node_browser_providers,node_api_runner,node_codegen,node_reporting,node_knowledge toneAmber
class node_python_bridge,node_browser_use_runtime,node_skill_cli toneMint
class node_report_ui,node_test_framework toneRose
```

## Components

### Inputs & assets

Scenario authoring, prompts, config, and runtime state

- [Web scenarios](https://github.com/javed0211/webpilot/tree/main/tests/web): scenario specs · Plain-text browser test scenarios and authoring inputs · `tests/web`
- [API scenarios](https://github.com/javed0211/webpilot/tree/main/tests/api): api specs · Plain-text API scenarios · `tests/api`
- [Test templates](https://github.com/javed0211/webpilot/tree/main/resources/templates/tests): scenario templates · Reusable scenario templates for generation · `resources/templates/tests`
- [Prompt assets](https://github.com/javed0211/webpilot/tree/main/resources/prompts): prompt library · LLM prompts and shared instruction sets · `resources/prompts`
- [Config assets](https://github.com/javed0211/webpilot/tree/main/resources/config): runtime config · Environment and provider configuration · `resources/config`
- [Runtime state](https://github.com/javed0211/webpilot/tree/main/runtime): mutable state · Reports, knowledge, healing cache, and artifacts · `runtime`

### TypeScript control plane

CLI, engine, agents, execution, codegen, and reporting

- [WebPilot CLI](https://github.com/javed0211/webpilot/tree/main/src/cli): entrypoint · User-facing command line entrypoint · `src/cli`
- [Engine](https://github.com/javed0211/webpilot/blob/main/src/core/Engine.ts): orchestrator · Main run lifecycle coordinator · `src/core/Engine.ts`
- [Agents](https://github.com/javed0211/webpilot/tree/main/src/agents): llm pipeline · Planner, execution, healing, validation, and codegen agents · `src/agents`
- [LLM client](https://github.com/javed0211/webpilot/blob/main/src/core/LLMClient.ts): model adapter · Provider abstractions for model calls · `src/core/LLMClient.ts`
- [Browser manager](https://github.com/javed0211/webpilot/blob/main/src/core/BrowserManager.ts): browser boundary · Browser/session/provider coordination · `src/core/BrowserManager.ts`
- [Browser providers](https://github.com/javed0211/webpilot/tree/main/src/core/browserProviders): pluggable adapters · Execution backends and provider registry · `src/core/browserProviders`
- [API runner](https://github.com/javed0211/webpilot/tree/main/src/core/api): api subsystem · Parallel API execution and codegen path · `src/core/api`
- [Deterministic codegen](https://github.com/javed0211/webpilot/tree/main/src/core/codegen): generation pipeline · Trace, plan, normalize, validate, and write outputs · `src/core/codegen`
- [Execution reports](https://github.com/javed0211/webpilot/tree/main/src/core/execution_report): artifact pipeline · Report generation and evidence packaging · `src/core/execution_report`
- [Knowledge & healing](https://github.com/javed0211/webpilot/tree/main/src/core/knowledge): learning stores · Site knowledge, regression memory, selector intelligence, and flake analysis · `src/core/knowledge`

### Python browser runtime

Vendored Browser Use subsystem and CLI bridge

- [Python bridge](https://github.com/javed0211/webpilot/blob/main/src/integrations/browser_use/PythonRuntime.ts): cross-language bridge · TypeScript integration layer to the vendored Python runtime · `src/integrations/browser_use/PythonRuntime.ts`
- [Browser Use runtime](https://github.com/javed0211/webpilot/tree/main/packages/browser-use/browser_use): python agent runtime · Autonomous browser-agent subsystem · `packages/browser-use/browser_use`
- [Skill CLI](https://github.com/javed0211/webpilot/tree/main/packages/browser-use/browser_use/skill_cli): python cli · Runtime CLI and operational tooling · `packages/browser-use/browser_use/skill_cli`

### Generated outputs

Framework examples, reports, and artifacts

- [Report UI](https://github.com/javed0211/webpilot/tree/main/resources/report-ui): static ui · Static shell and styling for reports · `resources/report-ui`
- [Test framework](https://github.com/javed0211/webpilot/tree/main/packages/test-framework): generated framework · Canonical Playwright framework and generated examples · `packages/test-framework`

## Connections

- Web scenarios → WebPilot CLI: scenario input · Browser scenarios are loaded into the CLI
- API scenarios → WebPilot CLI: scenario input · API scenarios are loaded into the CLI
- Test templates → WebPilot CLI: authoring aid · Templates help create and normalize scenarios
- Prompt assets → Agents: prompt source · Agents consume shared and task-specific prompts
- Config assets → Engine: runtime config · Engine reads provider and environment configuration
- WebPilot CLI → Engine: invokes · CLI hands control to the orchestration engine
- Engine → Agents: coordinates · Engine dispatches planning, execution, validation, and healing
- Agents → LLM client: LLM calls · Agents use model/provider abstractions
- Engine → Browser manager: browser control · Engine manages browser sessions and execution lifecycle
- Browser manager → Browser providers: provider selection · Browser provider registry supplies pluggable execution backends
- Engine → API runner: api path · API scenarios bypass browser-only execution
- Engine → Deterministic codegen: codegen path · Engine can trigger deterministic code generation
- Agents → Deterministic codegen: regen/heal · Codegen agent and validators feed deterministic writers
- Engine → Knowledge & healing: learns from runs · Execution updates knowledge, healing, and regression memory
- Knowledge & healing → Browser manager: selector reuse · Knowledge and healing inform future browser interaction
- Engine → Execution reports: artifacts · Execution results are turned into reports and evidence
- Execution reports → Runtime state: writes · Reports and artifacts are stored under runtime state
- Deterministic codegen → Test framework: generated output · Generated framework code lands in the TypeScript test framework
- Execution reports → Report UI: renders with · Static UI shell provides report presentation layer
- Python bridge → Browser Use runtime: bridges to · TypeScript orchestration launches and controls Python runtime
- Skill CLI → Browser Use runtime: operates · Python CLI tooling wraps runtime capabilities
- Agents → Python bridge: agentic mode · Browser-use-enabled runs cross the language boundary
