Project | AI & LLM
Bounded Testing Agent (MCP)
A testing agent that checks a small ticket-booking app against written requirements, one tool call at a time: browser, API, database, existing tests and an issue tracker. The app has four switchable defects and a decoy; real local-model runs are recorded and replayed in CI, which fails if the agent stops doing what the model did.
On 29 Nov 2026 all three required jobs passed on main: 57 unit tests (every guardrail with a scripted model), 8 browser tests, and the 6 recorded real-model runs replayed, each ending exactly as the model's run did.
Evidence checked 29 Nov 2026 | CI run on main
On this page
Problem and purpose
An LLM agent that tests software is easy to demo and hard to trust: it can call the wrong tool, change data it should not touch, loop, or report a bug it never saw. Here the model only decides; the code allows. Every limit sits where the model cannot talk its way past it, and every limit has a test in which a scripted model tries.
The app, Ticket Desk, has four switchable defects (overbooking, cancelled seats never returned, a stale price on the events page, any user reading any booking) and a decoy: a page that is slow but within its limit. A good agent finds exactly the four on the defects build, reports nothing on the hardened build, and leaves the decoy alone.
Architecture
goal ─► context ─► model ─► one decision ─┬─ tool call ─► MCP tool server: allowed? arguments? read-only SQL? write limit? approval?
├─ finding / "it holds" ─► evidence check: 2 executed steps, 2 kinds of tool
└─ finish / ask a person
budget and loop guards before every step · trace.jsonl · report.md · scorecard against an answer key the agent never seesTechnology and tools
| Area | Tools |
|---|---|
| Agent | Java 21: context, run memory, typed decisions, an evidence check, limits and loop guards, a trace and a report per run |
| Tools | An MCP server (MCP Java SDK 2.2.0, stdio): browser (Playwright), HTTP API, read-only SQLite, the existing smoke tests, an issue tracker |
| App under test | Ticket Desk on Javalin 7 and SQLite: JSON API and server-rendered pages with data-testid attributes |
| Model | qwen2.5:14b in Ollama, structured output, temperature 0; 7b tried first |
| CI | GitHub Actions: unit, browser and replayed-agent jobs required on every pull request; the real model weekly and on demand |
Engineering decisions and approach
- Permissions live in the tool server, so any MCP client gets the same refusals, not only this agent
- Every API call acts as the test user; the database tool is read-only three ways; data-changing calls count against a write limit
- A finding or a "requirement holds" needs evidence from two kinds of tool in the same run
- Real-model runs are recorded and replayed in CI, tied to a hash of the prompt and the answer format
- The replay must end exactly as the model's run did, so CI catches any guardrail change that would have treated the model differently
Test scope and execution approach
Project-specific checks and execution details documented in the repository:
- Guardrail tests with a misbehaving model: unknown tools, acting as another customer, writing SQL, endless loops, unsupported claims, nameless approvals
- A hand-written reference tester that finds every seeded defect through the same loop
- Human approval: a queued bug is filed once, by a named person, through the CLI
- Secrets masked in the trace by name and by shape
- What the model runs exposed: a browser download on the MCP channel, an answer format that changed per JVM, no way to say "it holds"
Results with dated evidence
Historical repository or workflow evidence
CI run on main
On 29 Nov 2026 all three required jobs passed on main: 57 unit tests (every guardrail with a scripted model), 8 browser tests, and the 6 recorded real-model runs replayed, each ending exactly as the model's run did.
Evidence checked: | Open dated evidence
Evidence explorer
Static screenshots are labelled as images; dated workflow links identify the execution evidence and its check date.
The recorded qwen2.5:14b runs pass the quality gate on 2 of 6: privacy on both builds. On booking it saw seats left go to -1 and kept booking until the loop guard stopped it; on prices it saw 4500 cents against 5200 and called them matching. No run reported a false finding, and every run that went in circles was stopped by a guard.
Static material from the public repository. The linked verification record was checked 2026-11-29; that date is not a screenshot capture date.
Dated workflow record
Evidence checked 2026-11-29. Open CI run on main
Local setup and execution
./mvnw test # 57 tests, no browser, no model
./mvnw test -Dsuite=agent # the recorded model runs replayed
./agent.sh run booking-privacy --build defects --model ollama
./agent.sh approve target/agent-runs/defects/booking-rules A-1 --by "<your name>"Workflow and reports
Known limitations
- Ticket Desk is small and written for the project
- The recorded 14b model on a CPU runner passes 2 of 6 runs: the replays show the guardrails, not a capable agent
- The evidence check is structural; whether the model understood what it saw is for the person approving the bug
- The app under test is small and written for the project; the recorded model is a 14b model on a CPU runner that passes 2 of 6 runs, so the replays show the guardrails, not a capable agent.