Black-box, five-stage validation of conversation-to-action AI assistants: intent, orchestration, MCP tool calls, backend state and user response
pip install qe-harness==0.5.0 Copy PIP instructions
A chat-only test sees the final reply. qe-harness tests every turn at five stages, from the outside:
intent → orchestration → MCP tool calls → backend state → user response
It never imports the application under test, and it doesn't intercept anything. It signs in as test users and chats over the app's API, reads the app's per-turn traces, gets an independent record of every tool call from a recording proxy the sandbox routes its tool traffic through (stdio or HTTP), and compares read-only snapshots of the business data before and after each turn (see "How the evidence is collected" below). So it catches what a polite reply hides: a write the customer never approved, an amount no tool returned, a reply that says "done" when nothing was saved.
pip install qe-harness # core pip install "qe-harness[judge]" # plus the optional LLM grader (Azure OpenAI or Anthropic) Python 3.11 or newer.
qe init # writes qe.yaml (sandbox connection) and qe_catalog.yaml (test cases) in this folder # edit both files, then provide the two secrets the config names: # QE_SANDBOX_TOKEN sandbox control token # QE_TEST_PASSWORD test users' password # (environment variables, or a .env file next to qe.yaml) qe doctor # connection checks: all green means testing can start qe run --open # run every suite, evaluate each turn, open the HTML report qe finds its configuration from --config PATH, then $QE_CONFIG, then qe.yaml in the working directory. Relative paths in it start from the folder holding the file (or from base_dir: if set).
The harness doesn't sniff network traffic, decrypt TLS or hook into the app. Each source of evidence is something the client switches on in their sandbox:
the client's sandbox (each source is switched on by the client) +------------+ +-------------+ MCP +-------------+ MCP +-------------+ | | (1) chat as test | | -------> | qe proxy | ------> | | | | users | app under | | relays | | tool server | | | -----------------> | test | -- HTTP (MCP streamable HTTP) the tool-server URL the app connects to, to the proxy's address python -m qe_harness.mcp_proxy --http --listen 0.0.0.0:9100 --upstream http://tools:9000/mcp --log-dir stdio: one proxy process per tool-server process; the customer comes from COPILOT_CUSTOMER_ID in its environment. HTTP: a reverse proxy. Requests keep their path, headers (Mcp-Session-Id, Authorization, …) and body; event-stream responses are streamed through as they arrive. The customer comes from a request header the app sends (--customer-header, default X-Customer-Id) or a fixed --customer. Each request/response exchange is logged with its own id, so concurrent conversations can't be mixed up. Both modes write the same log format to , which must match tools.proxy_log_dir in the harness config. The proxy logs only tool calls and their results. It changes nothing, and if it's removed the app works exactly as before. Other ways to get an independent record If routing tool traffic through the proxy isn't possible, these give similar evidence, roughly from most to least recommended:
Each failure records its first failing stage, so developers know where to look. With --repeats N, every case gets a pass rate with a 95% Wilson range and unstable cases are reported as flaky.
A case can list variants:: paraphrases that keep its intent and every detail (ids, amounts, dates, names) and its reliance on earlier turns. The catalog's defaults.variant_styles names their positions (this catalog: casual, formal, indirect, noisy).
qe run --variants all --judge --parallel 3 # the original prompts plus every variant, each a full pass qe run --variants 0,4 # only the original and the 4th (noisy) phrasing Every phrasing is a full pass over the suites, in the same conversation context as the original, checked at all five stages, so a paraphrase that is understood but then handled differently also fails. The variants of a case count as its runs (a case that fails only in some phrasings is FLAKY). The console, the report and summary.json (intent_robustness) add per phrasing style: intent accuracy and end-to-end pass rate with the change from the original wording; paraphrase invariance (cases where every phrasing got an accepted intent); consistency (same intent for every phrasing); the most confused intent pairs; and every misread phrasing, linked to its evidence. The defect list quotes the phrasing that failed.
The recording proxy can answer chosen tool calls itself, so the call never reaches the tool server and nothing changes in the backend. A catalog step lists them under faults:; the harness writes them to /faults.json just before that step and removes the file right after (and at the start of every run).
faults: [{tool: make_payment, mode: error}] # every make_payment call gets an MCP tool error (503) faults: [{tool: list_claims, mode: error, times: 1}] # only the first call fails: a retry would work faults: [{tool: add_rider, mode: timeout, delay_s: 3}] # waits, then a "timed out" tool error faults: [{tool: list_drivers, mode: empty}] # a successful but empty result Injected results copy the envelope of the tool server's real results (e.g. resultType, _meta), so the app's MCP client accepts them whatever protocol version it speaks. The proxy log marks them ("injected": " "), the case view shows "fault injected by the proxy", and trace and proxy still have to agree. Works over stdio and MCP HTTP. The FAULTS suites probe false success (claiming a payment or change that failed), invented figures after a failed lookup, recovery after a one-off error, and empty results.
qe scorecard [RUN] [--all] [--open] and a report panel map a run onto the catalogue's 12 categories and 71 test types. Each type is measured (metrics from this run), not in this run (supported, but e.g. no --variants or no fault steps), planned, or not applicable (listed with a reason under scorecard.not_applicable in the config). Metrics come from two places:
The report puts the six seam rates at the top (the category the catalogue notes most eval tools can't run).
Every run resets its sandbox, so one sandbox runs one test at a time (a lock enforces it). To go faster, give the harness several identical sandboxes: list the extra ones under workers: in the config, each with its own URL, read-only data path and proxy log folder.
workers: - {base_url: http://127.0.0.1:8101, sor_path: data/sandbox-2.db, proxy_log_dir: qe_runs/proxy-2} - {base_url: http://127.0.0.1:8102, sor_path: data/sandbox-3.db, proxy_log_dir: qe_runs/proxy-3} qe doctor --workers # check every sandbox qe run --judge --parallel 3 # the main sandbox plus two workers Work is split into (repeat, suite) units; each runs on the next free worker from a fresh reset of that sandbox, and the results merge into one run and one report. Suites must be independent for this: each is one test user's conversation, and its data checks should be scoped to that user's records. The sandboxes must report the same versions and clock, or the run refuses to start.
List the app's intent families under intents: in qe.yaml. Each report shows, per family, the cases that test it, their pass rate and a status (covered, thin, failing, not tested), plus a families × runs grid of how coverage changes over time. In the terminal, qe coverage --trend gives one line per family that stays the same width however many runs there are:
Every report comes with a defect list next to it (defects.html and defects.csv, linked from the report header); qe defects [RUN] --open rebuilds and opens it. One entry per case that failed, cases that fail every time first, then flaky ones. Each entry has:
Severity comes from what went wrong: critical when the app did or tried to do something it shouldn't (a declined stray approval, a forbidden call, an unexpected data change, a trace that disagrees with the proxy); major when it didn't do what was asked, or the grader found the reply contradicts the tools; minor when the action was right but the reply missed something, or the request was misclassified. A catalog case can override it with severity: critical | major | minor. The CSV imports into Jira, Azure Boards or a spreadsheet.
qe run --repeats 3 --judge --junit qe-results.xml --flaky skip --baseline qe-baseline.json --junit FILE writes JUnit XML: one test suite per catalog suite, one test case per case, the failure message is the first thing that went wrong, with a link to the evidence. --flaky fail|skip|pass decides how a case that failed only some tries counts (default fail). --baseline RUN|latest|summary.json fails the build only on regressions: cases that passed every try in the accepted baseline (or are new) and don't now. Cases that already failed there are reported as skipped ("known failure"), so they stay visible without turning every build red. Accept a baseline by committing a run's summary.json. The exit code is 0 when nothing counts as failed, 1 when something does, 2 when the run couldn't start. qe junit [RUN] --out FILE does the same for a run that has already finished. qe init --ci github writes a nightly GitHub Actions workflow (.github/workflows/qe-nightly.yml) and qe init --ci azure an Azure DevOps pipeline (azure-pipelines-qe.yml). Both install qe-harness, wait for the sandbox with qe doctor, run the suites with a baseline, publish the JUnit results and keep the report and defect list as build artifacts. Add the secrets listed at the top of the file; use a self-hosted runner or agent if the sandbox is only reachable inside your network.
claude mcp add qe-harness -- qe mcp serve For Cursor or VS Code, add a stdio server with command qe and args ["mcp", "serve"].
Prompt: triage_run. qe init (writes project files) has no tool on purpose.
qe run --judge asks a model whether each reply is consistent with what the tools actually did. It uses its own settings, separate from the app's: QE_JUDGE_PROVIDER = AZURE (with QE_JUDGE_AZURE_API_KEY, QE_JUDGE_AZURE_ENDPOINT, QE_JUDGE_AZURE_DEPLOYMENT) or ANTHROPIC (with ANTHROPIC_API_KEY, optional QE_JUDGE_MODEL).
If the grader can't give a verdict (missing key, provider down), the turn is not counted as passed: it fails at the user-response stage as "not evaluated", and the defect list shows those cases separately rather than as app defects. qe run --judge also makes one small grading call before it starts, so a broken grader stops the run straight away.
Alpha. Fault injection and hand-written paraphrase variants are in (0.5.0). Not yet included: load and soak testing, simulated customers and automatic variant generation. The CI baseline is a regression gate; a gate on absolute thresholds (for example "no critical defects") is not built in yet.
Both files in this release have provenance metadata.
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.
Both files in this release have been uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




