# Building Local AI Agents for Web Test Automation

**Format:** Hands-on workshop · **Duration:** 3 hours (including a 20-minute break) ·
**Level:** Intermediate

## Abstract

Can an AI model you run yourself do useful test automation work? In this workshop,
participants build a working web-testing assistant one step at a time. It explores a live
website, writes a test plan, turns that plan into a runnable Playwright test suite, runs
it, and repairs its own broken selectors. Every AI call goes to an open-weights model on a
self-hosted server, never to a paid hosted service. Participants leave with the complete,
working code and a clear sense of which parts of test automation to hand to a model and
which to keep exact.

## Who it is for

QA engineers, SDETs and developers who write automated tests and want to understand AI
agents at the code level, not just as a product feature. Working knowledge of Python and
basic familiarity with Playwright is assumed. No prior experience with AI agents or
LangChain is needed.

## What participants will learn

- What an "agent" is, by writing one from scratch: a model, a tool, a loop and a stop
  condition.
- How LangChain and LangGraph package the same ideas, and when a plain workflow beats an
  agent.
- How to get reliable, schema-checked output from a self-hosted open-weights model.
- How to generate stable, verified Playwright locators from a live page, rather than
  trusting a model to write selectors.
- How a self-healing test suite repairs its own selectors, and how it avoids hiding real
  bugs while doing so.
- What running AI-assisted testing on your own infrastructure actually costs.

## Agenda

| Time | Session | What happens |
| --- | --- | --- |
| 0:00 – 0:15 | **Introduction & framing** | Why agent literacy matters for QA. What a self-hosted model can and cannot do. A tour of what we will build. |
| 0:15 – 0:35 | **Setting up the harness** | Connecting to the model server (Ollama or llama.cpp) and the cloud browser (Lightpanda). Everyone confirms both work before moving on. |
| 0:35 – 0:55 | **An agent from scratch** | Writing a complete agent by hand in one short file, to demystify what agent frameworks do. |
| 0:55 – 1:15 | **Moving to LangChain & LangGraph** | Rebuilding the same agent with a framework, including memory, streaming and guardrails. Then when not to use an agent at all. |
| 1:15 – 1:35 | *Break* | |
| 1:35 – 1:55 | **Agent 1 — the explorer** | The agent crawls a real website and writes a test plan: the critical user flows, each with concrete, checkable assertions. |
| 1:55 – 2:20 | **Agent 2 — locators & test cases** | Reading each page efficiently, deriving robust Playwright locators that are verified against the live page, and turning the plan into test cases. |
| 2:20 – 2:40 | **Agent 3 — the test builder** | Generating a Playwright + TypeScript suite in a Page Object Model layout, then running it. |
| 2:40 – 2:55 | **The self-healing loop** | We break a selector on purpose and watch the suite repair it, and see why real product bugs are reported instead of "fixed". |
| 2:55 – 3:00 | **The full run & wrap-up** | The whole pipeline in one command with its final report, what it costs, and where to take it next. |

## What participants need to bring

- A laptop with **Python 3.11+**, **Node.js 20+** and the **uv** package manager installed.
- The workshop repository, cloned and set up before the session.
- A free **Lightpanda Cloud** API token, from console.lightpanda.io. The token is shown
  only once, so generate and save it in advance.
- Access to a model server (Ollama or llama.cpp): its address, a model name and an API
  key. (Optional - If you don't have one ready, we'll help you set it up on the day.)

## For the Browserstack

- A short pre-workshop email with the setup instructions above. Setup problems are the
  most common cause of lost time, so ask participants to complete setup before the day.
