How javed0211/webpilot works
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: Engine.ts Engine · agents Agents · cli WebPilot CLI · execution_report Execution reports
Components 21
Inputs & assets
Scenario authoring, prompts, config, and runtime state
- Web scenarios · Plain-text browser test scenarios and authoring inputs
tests/web - API scenarios · Plain-text API scenarios
tests/api - Test templates · Reusable scenario templates for generation
resources/templates/tests - Prompt assets · LLM prompts and shared instruction sets
resources/prompts - Config assets · Environment and provider configuration
resources/config - Runtime state · Reports, knowledge, healing cache, and artifacts
runtime
TypeScript control plane
CLI, engine, agents, execution, codegen, and reporting
- WebPilot CLI · User-facing command line entrypoint
src/cli - Engine · Main run lifecycle coordinator
src/core/Engine.ts - Agents · Planner, execution, healing, validation, and codegen agents
src/agents - LLM client · Provider abstractions for model calls
src/core/LLMClient.ts - Browser manager · Browser/session/provider coordination
src/core/BrowserManager.ts - Browser providers · Execution backends and provider registry
src/core/browserProviders - API runner · Parallel API execution and codegen path
src/core/api - Deterministic codegen · Trace, plan, normalize, validate, and write outputs
src/core/codegen - Execution reports · Report generation and evidence packaging
src/core/execution_report - Knowledge & healing · Site knowledge, regression memory, selector intelligence, and flake analysis
src/core/knowledge
Python browser runtime
Vendored Browser Use subsystem and CLI bridge
- Python bridge · TypeScript integration layer to the vendored Python runtime
src/integrations/browser_use/PythonRuntime.ts - Browser Use runtime · Autonomous browser-agent subsystem
packages/browser-use/browser_use - Skill CLI · Runtime CLI and operational tooling
packages/browser-use/browser_use/skill_cli
Generated outputs
Framework examples, reports, and artifacts
- Report UI · Static shell and styling for reports
resources/report-ui - Test framework · Canonical Playwright framework and generated examples
packages/test-framework
Connections 22
- 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