How migoxlab/webqa-agent works
1. Overall shape
- The repo has two main planes:
- webqa_agent/: the core autonomous testing engine and CLI.
- backend/ + frontend/: a web dashboard and management API for persistent test management, history, and scheduling.
- Around them are deployment manifests and tests that validate the agent behavior end-to-end.
2. Primary user entry points
- The agent is used in two modes: Generate and Run.
- Entry points are:
- CLI via webqa_agent/cli.py
- Backend API via backend/app/main.py
- Web UI via frontend/src/App.tsx
- The CLI is the direct path for developers; the backend/frontend path is the operational dashboard path.
3. Core agent pipeline
- The central flow in webqa_agent is:
- load configuration
- create browser session
- crawl/extract page structure and signals
- consult LLM prompts
- produce actions or test cases
- execute them through browser/tool adapters
- aggregate results into reports
- This is split into clear subsystems: browser, crawler, executor, tools, LLM, and reporting/utils.
4. Generate mode architecture
- Generate mode is the autonomous discovery path.
- It combines:
- crawler components for DOM/page feature extraction
- LLM prompts for planning and step generation
- dynamic step generation and status determination under webqa_agent/executor/gen/agents
- helpers like case recorder, case synchronizer, error classifier, and summary utilities
- Output is a structured test case set plus execution artifacts/reporting.
5. Run mode architecture
- Run mode is the deterministic execution path for prewritten cases.
- It reads YAML-defined cases from config, then drives:
- action handlers/executor for browser actions
- verification tools for assertions
- network/console monitoring for runtime validation
- This mode is designed for repeatable regression tests rather than discovery.
6. Browser automation boundary
- webqa_agent/browser/ isolates all browser/session lifecycle concerns:
- session creation
- context management
- event collection
- browser configuration
- webqa_agent/crawler/js/ shows that some page inspection is injected into the browser runtime with JavaScript helpers.
- This forms the boundary between the agent logic and the external browser/page environment.
7. Tooling layer
- Tools are treated as pluggable capability modules.
- Default capabilities cover:
- UI actions
- UI assertions
- UX checks
- Optional/custom tools extend the engine with:
- Lighthouse for performance
- Nuclei for security scanning
- link/button checks
- The registry and tools/core vs tools/custom split indicate a capability-based architecture rather than hardcoded test logic.
8. LLM integration
- webqa_agent/llm/llm_api.py, prompts/, and config_models/ form a provider-agnostic LLM integration layer.
- The README indicates support for OpenAI-compatible APIs and multiple model providers.
- The LLM is used for planning, filtering, step generation, and reasoning, but browser execution remains local and deterministic.
9. Data and artifact flow
- Test execution produces structured runtime data under webqa_agent/data/ and human-readable reports through utilities in webqa_agent/utils/.
- The README indicates HTML reports are written to a reports/ directory.
- This makes the agent a producer of both machine-usable case structures and operator-facing execution reports.
10. Backend service boundaries
- The backend is a separate API service with a conventional layered structure:
- API routes in backend/app/api/
- domain models in backend/app/models/
- schemas in backend/app/schemas/
- services in backend/app/services/
- providers for auth, storage, and notifications
- Key resources exposed by the API are businesses, environments, test cases, executions, files, and scheduled tasks.
11. Backend state and infrastructure
- backend/alembic/ and backend/app/database.py show a relational database with schema migrations.
- The deployment manifests include PostgreSQL and Redis, so the backend likely uses:
- Postgres for persisted business/test/execution records
- Redis for ephemeral state, progress cache, or scheduling support
- Scheduled task handling and job monitoring are first-class backend concerns.
12. Frontend dashboard
- frontend/ is a React/Vite application that consumes the backend API through frontend/src/api/client.ts.
- The main screens map directly to backend resources:
- business management
- test case editor
- execution history/detail
- scheduled task manager
- file/config management
- debug/gen pages
- The frontend is a presentation and control layer; it does not contain the agent logic.
13. Deployment model
- The repo supports:
- local development
- Docker Compose
- Kubernetes
- K8s manifests define backend, frontend, Postgres, Redis, ingress, RBAC, secrets, configmaps, and storage.
- This means the agent runtime can be used standalone via CLI or as part of a persistent multi-service platform.
14. Testing and validation
- tests/ covers crawler behavior, action execution, URL validation, error classification, status determination, and report generation.
- That test split mirrors the architecture: browser automation, data extraction, execution semantics, and result classification are all independently validated.
15. Architectural takeaway
- The repo is best understood as a browser-native AI testing engine with two operating surfaces:
- a local/CLI autonomous agent
- a managed web platform for teams
- The stable boundaries are: config → browser/crawler → LLM/planning → tool-backed execution → result/reporting, with the backend/frontend stack layered on top for persistence, scheduling, and human workflow management.
Main entry points: gen Generate Flow · run Run Flow · cli.py CLI · tests Tests
Components 19
WebQA Agent
Autonomous browser testing engine and CLI.
- CLI · Developer entrypoint for generate and run modes.
webqa_agent/cli.py - Config · Loads run and generate configuration models.
webqa_agent/config_models - Browser · Browser lifecycle, context, config, and event capture.
webqa_agent/browser - Crawler · DOM crawling, feature detection, and JS page inspection.
webqa_agent/crawler - LLM Layer · Provider-agnostic prompt and API integration for planning and reasoning.
webqa_agent/llm/llm_api.py - Generate Flow · Discovery pipeline that creates and refines test cases.
webqa_agent/executor/gen - Run Flow · Repeatable execution of predefined YAML test cases.
webqa_agent/executor/run - Actions · Action handlers and executors for clicks and scripted UI operations.
webqa_agent/actions - Tools · Pluggable UI checks, assertions, and external scan capabilities.
webqa_agent/tools - Reports · Aggregates execution results and produces human-readable reports.
webqa_agent/utils/reporting_utils.py - Data Models · Structured runtime objects for generate and run workflows.
webqa_agent/data
Managed Platform
Backend API and frontend dashboard for persistent test management.
- Backend API · API service for persisted cases, executions, files, and scheduling.
backend/app/main.py - Domain Layer · Routes, schemas, models, and services for business workflows.
backend/app - Scheduler · Task scheduling, progress cache, and job monitoring.
backend/app/services - Frontend App · React dashboard entrypoint and API client surface.
frontend/src/App.tsx - Dashboard Views · Business, case, execution, file, scheduled task, and debug screens.
frontend/src/components - Database · Relational persistence with migrations for managed platform state.
backend/app/database.py
Deployment
Container and Kubernetes deployment assets.
- Deploy Manifests · Docker Compose and Kubernetes manifests for local and cluster deployment.
deploy
Validation
Test suite and architectural checks.
- Tests · Behavioral tests for crawler, execution, classification, and reporting.
tests
Connections 29
- CLI → Config: loads · CLI selects generate or run configuration.
- CLI → Browser: opens · CLI starts browser sessions for automation.
- CLI → Generate Flow: generate mode · Autonomous discovery workflow.
- CLI → Run Flow: run mode · Deterministic test execution workflow.
- Generate Flow → Crawler: extracts · Generate flow inspects pages and DOM signals.
- Generate Flow → LLM Layer: plans · LLM creates and refines steps and cases.
- Generate Flow → Actions: executes · Generated steps are carried out in browser.
- Generate Flow → Data Models: produces · Writes structured generation artifacts.
- Generate Flow → Reports: summarizes · Builds execution summaries and reports.
- Run Flow → Actions: drives · Run flow applies deterministic browser actions.
- Run Flow → Tools: verifies · Assertions and checks validate outcomes.
- Run Flow → Data Models: records · Stores run structures and results.
- Run Flow → Reports: summarizes · Produces run reports and artifacts.
- Actions → Browser: controls · Actions operate through browser/session boundary.
- Crawler → Browser: inspects · Crawler reads page state through browser context.
- Crawler → LLM Layer: feeds context · Extracted structure informs planning prompts.
- Tools → Browser: checks · Tools may query UI and runtime state.
- Backend API → Domain Layer: serves · API routes are backed by domain models and services.
- Domain Layer → Database: persists · Managed entities are stored in the database.
- Scheduler → Database: tracks · Jobs and execution state are persisted.
- Backend API → Scheduler: orchestrates · API exposes scheduled task and monitoring flows.
- Frontend App → Backend API: consumes · Dashboard uses the backend API client.
- Frontend App → Dashboard Views: renders · Main app composes dashboard screens.
- Backend API → Deploy Manifests: deploys with · Service is packaged with local and cluster manifests.
- Frontend App → Deploy Manifests: deploys with · UI is packaged for container and cluster deployment.
- Tests → Crawler: validates · Crawling and DOM extraction behavior is tested.
- Tests → Actions: validates · Action execution semantics are tested.
- Tests → Generate Flow: validates · Generate-specific classifiers and synchronizers are tested.
- Tests → Reports: validates · Report generation utilities are tested.