--- title: QA Agent LangGraph emoji: "🧪" colorFrom: blue colorTo: indigo sdk: streamlit app_file: app.py pinned: false --- # LangGraph QA Compare LangGraph-based QA test generation workflow that orchestrates calls to `qa-agent-service`. This project owns sequencing, shared workflow state, backtracking, runtime traces, and exports. The actual QA agents are invoked through the service. ## Setup ```bash python -m venv .venv source .venv/bin/activate pip install -r requirements.txt streamlit run app.py ``` By default the app calls the hosted Hugging Face Space REST API: ```text https://helmfridsson-qa-agent-service.hf.space/api/v1 ``` The app accepts any of these inputs and normalizes them to the REST base automatically: - `https://helmfridsson-qa-agent-service.hf.space` - `https://helmfridsson-qa-agent-service.hf.space/docs` - `https://helmfridsson-qa-agent-service.hf.space/api/v1/health` - `https://huggingface.co/spaces/helmfridsson/qa-agent-service` You can also override the default at runtime with `QA_AGENT_SERVICE_URL`. For local development, start `qa-agent-service` separately and override the REST API URL in the sidebar: ```bash cd ../qa-agent-service PYTHONPATH=src uvicorn api:app --reload --port 8009 ``` The local service URL is `http://127.0.0.1:8009`. MCP may run on `http://127.0.0.1:8008/mcp`, but that endpoint is not a REST API and does not expose `/docs` or `/openapi.json`. ## Workflow The application runs a LangGraph `StateGraph`: ```text START -> requirements_analyst(service) -> test_designer(service) -> reviewer(service) -> orchestrator(local) ``` The orchestrator conditionally routes to `END`, `test_designer`, `requirements_analyst`, `reviewer`, or failure. The first supported selective backtracking path is reviewer feedback back to `test_designer`. `run_controls.max_rounds` prevents endless loops. ## Agents The three QA worker agents are provided by `qa-agent-service`: - `requirements_analyst` - `test_designer` - `reviewer` Each worker node can run in `Service-backed`, `Deterministic`, or `Disabled` mode. `Service-backed` calls the REST endpoint `POST /agents/{agent_key}/invoke` and validates the returned contract with this app's Pydantic schemas. Deterministic mode remains as a local smoke-test fallback. The orchestrator is local and deterministic because `qa-agent-service` intentionally does not own workflow sequencing, retries, memory commits, backtracking, or stopping conditions. ## Service Validation Before graph execution, the app can call: ```text GET https://helmfridsson-qa-agent-service.hf.space/api/v1/health ``` If the service is not reachable, execution stops before the graph starts. ## Sample Scenarios The Scenario Input tab includes predefined sample scenarios for login/registration, checkout, password reset, support tickets, inventory management, and course enrollment. Select one and click `Load selected scenario` to populate the title and requirement text. ## Outputs Each run writes files under `runs//`: - `run_export.json`: complete export with partial results preserved - `stage_traces.jsonl`: append-only stage trace log, one trace per line The Streamlit UI also exposes download buttons for both files. ## Known Limitations - Runtime status updates appear after each Streamlit-triggered graph run, not as token streaming. - Deterministic mode is intentionally basic and mainly supports smoke testing. - Only the first MVP backtracking path is fully supported: reviewer to test designer. - There is no database, authentication, RAG, hosted deployment, or Docker setup in this version. - GitHub Actions can deploy this app repo to the Hugging Face Space `helmfridsson/qa-agent-langgraph` once the GitHub secret `HF_TOKEN` is configured.