---
name: qad-verify
description: "Step 4 of Quick Agent Deployer: automated health checks, inference benchmarks, and tool dry-runs."
---

# QAD Step 4: VERIFY

## What This Step Does

Runs an automated health check sequence across all deployed components. Every failure includes the exact fix command. Benchmarks inference speed. Validates tools. Reports a clear pass/fail summary.

## Pre-Conditions

- `state/detect-report.json` exists with `status: success`
- `state/install-report.json` exists with `status: success`
- `state/scaffold-complete.json` exists with `status: success`
- Validate: confirm agent script exists at the expected path
- If any prior report is missing or failed → route back to the failed step

## Instructions

### 1. Health Check Sequence

Run each check. Record results. Every failure gets an exact fix command.

| Check | How | Pass | Fail Action |
|---|---|---|---|
| Ollama responding | `curl localhost:11434/api/tags` | ✅ | `ollama serve` or `systemctl start ollama` |
| Primary model loaded | `ollama list` includes tag | ✅ | `ollama pull [tag]` |
| Secondary model loaded | `ollama list` includes tag | ✅ | `ollama pull [tag]` |
| llama-server responding (if deployed) | `curl localhost:8080/health` | ✅ | `bash launch-stretch-model.sh` |
| OpenWebUI at configured port | `curl localhost:[port]` | ✅ | Docker run command |
| Agent script runs | `python agent.py --health` | ✅ | Specific error + fix |
| Memory hub read/write cycle | Read → write → read → verify | ✅ | Permission fix command |
| Tool dry-run (each tool) | Execute with test input | ✅ per tool | Specific fix per tool |
| Port conflicts | Probe all reserved ports | ✅ | Kill conflicting process or remap |

### 2. Inference Benchmark

Quick generation test for each deployed model:

```
🧪 INFERENCE BENCHMARK
   Primary ([model] via Ollama):
     Generation: [N] tok/s    Prefill: [N] tok/s    [✅ Ready / ⚠️ Slow]
   Secondary ([model] via Ollama):
     Generation: [N] tok/s    Prefill: [N] tok/s    [✅ Ready / ⚠️ Slow]
   Stretch ([model] via llama-server):
     Generation: [N] tok/s    Prefill: [N] tok/s    [✅ Ready / ⚠️ Check flags]
```

**Thresholds:**
- < 3 tok/s generation: suggest lighter model
- < 5 tok/s for stretch: check optimization flags in quick-agent-deployer/references/optimization-playbook.md

### 3. Tools Check

Dry-run every tool with a safe test input:

```
🔧 TOOLS CHECK
   ✅ read_file      ✅ write_file     ✅ run_python
   ✅ shell_command   ✅ fetch_url      ✅ memory_read
   ✅ memory_write    ⏭️ web_search (SearXNG not installed — optional)
   ⏭️ search_documents (ChromaDB not installed — optional)
   ⏭️ ask_gemini (no API key — optional)
```

Optional tools that aren't available get ⏭️ (skipped), not ❌ (failed).

### 4. Memory Verification

```
🧠 MEMORY
   ✅ Hub read/write: working
   ✅ Progress file: working
```

### 5. Final Summary

```
Your agent is ready. Open http://localhost:[port] to chat, or run: python agent.py
```

If any critical check fails, do NOT print the "ready" message. Instead, list the failures with fix commands and offer to re-run verify after the user applies fixes.

## Output

Write results to: `[agent-folder]/state/verify-report.json`

```json
{
  "timestamp": "ISO8601",
  "status": "success | partial | failed",
  "checks": {
    "ollama": {"pass": true},
    "primary_model": {"pass": true, "tok_s": 14.2},
    "secondary_model": {"pass": true, "tok_s": 22.1},
    "llama_server": {"pass": true, "tok_s": 11.8},
    "openwebui": {"pass": true, "port": 3000},
    "agent_script": {"pass": true},
    "memory": {"pass": true},
    "tools": {
      "read_file": "pass",
      "write_file": "pass",
      "web_search": "skipped",
      "ask_gemini": "skipped"
    }
  },
  "critical_failures": [],
  "warnings": [],
  "agent_ready": true
}
```

## References Needed

None for standard verification. If stretch model benchmark is slow, consult `quick-agent-deployer/references/optimization-playbook.md` (relative to `.claude/skills/`) for flag adjustments.
