In four weeks, two of us and an AI coding agent built a test console, ran 52 benchmark runs on two Kubernetes clusters, and turned an unexplained agent OOM loop into a list of root causes with evidence.
The question sounded simple: why does the Uptycs osquery agent on our OpenShift lab cluster keep hitting its memory limit? The agent scans every container on a node for vulnerabilities. A scan parses hundreds of thousands of CVE templates, uploads results to the cloud, and shares one pod memory limit with everything else the agent does.
Answering that by hand means watching memory second by second, matching it to agent log lines, and repeating under different loads and limits. That is slow and error-prone for people, and easy to get subtly wrong. So we made AI do the repetitive engineering, and kept people on the decisions.
Design: one console around the clusters
vulnbench is a single web console that runs a test, records everything the agent and the node do, and builds the report. It is one FastAPI process with SQLite and a plain-JavaScript UI, running on a lab VM.
- Clusters under test. A 5-node OpenShift cluster on x86 (3 masters, 2 workers, about 85 containers per worker). Later, a single-node kubeadm cluster on IBM Power (ppc64le).
- Agent under test. The Uptycs k8sosquery DaemonSet: osqueryd plus uptycs-protect in one pod, enrolled to the Uptycs cloud.
- Scan targets. A lab fleet of about 30 real images (CentOS 7, RHEL 7.9, Ubuntu 20.04/24.04, Alpine, Debian, Keycloak, MySQL, Kafka-style brokers) plus 4 dedicated targets.
- Load. Our own fdload tool, built multi-arch, applies file-descriptor, socket, process, environment-variable and CPU load per node.
- Adapters. kubectl/helm, SSH to nodes, and the Uptycs API (reads only; any write is gated behind a confirmation).
A run is one test definition: which clusters and nodes, how long, which load, which Uptycs queries to fire, and the agent's memory limit. The console enforces one run at a time and refuses a second with the running test's details.
The console talks to both clusters through kubectl and SSH, to the Uptycs cloud through read-only queries, and to the LLM through an AI gateway.
How we used AI: three roles
AI worked at three levels. It built the tool, it ran and read the tests, and it sits inside the console for anyone who uses it.
- AI as the test engineer (Claude Code). We wrote requirements in plain language, about 170 of them, logged with the discussion in a requirements file. Claude Code wrote the console, the load tool and the parsers, and wrote the tests for each change. It deployed through the same gate a person would, and kept the design document current in the same commit. It also ran the experiments: starting runs, watching agent logs live, and writing up findings with evidence.
- AI inside the console (chat agent). The console has a chat panel backed by an LLM through our AI gateway. It has about two dozen tools: read run results, compare runs, explain an alert, open the flow of queries around an error. Anything that changes the cluster asks for confirmation first. Each answer shows the tokens it cost.
- AI as reviewer of every run. After each run the AI reviews the alert bell, both waiting and acknowledged alerts, and writes a short note per run: what was real, what was noise, and what to check next.
People kept the decisions. Changing a test's conditions, swapping an agent binary, or firing a query at the cloud needed an explicit OK each time.
Tools and features we added
The console went from v0.1 on 2026-11-06 to v0.106.17 on 2026-11-30: 179 logged releases, each through a test gate.
| Tool or feature | What it does | Why we needed it |
|---|---|---|
| Test config + runner | Versioned test definitions; one run slot; live log, ETA and ticker | Repeatable runs that anyone can start and compare |
| fdload | Multi-arch load generator: file descriptors, sockets, processes, env vars, CPU, per node | Real nodes are busy; an idle-node benchmark hides costs |
| Memory-limit sweep and soak | Holds or steps the agent's memory limit for hours, then restores it | Find the smallest limit that survives a full scan |
| qbench | Runs query variants side by side | Prove a cheaper SQL returns the same rows |
| Query monitor | Every scheduled and live query: start, end, CPU, memory before, peak, kept | Tie each memory jump to the query that caused it |
| Vulnerability report | Per scan: type (full, high, incremental), phases, download, scan and upload time, CVE counts | See where a scan spends time and memory |
| Flow | The queries and log lines around any error, on one timeline | Answer "what was the agent doing when this broke?" |
| Processes and Environment pages | Per-node process and env-var load, and what the agent saw | process_envs turned out to be an OOM trigger |
| Agent-pod config | Memory and CPU limits and requests per test, restored after the run | Test 350Mi, 512Mi and 1000Mi without hand edits |
| Upgrade | Lists agent versions from the Uptycs API, downloads and applies them | Retest each new build the same way |
| Multi-cluster | One test across clusters and nodes, one combined report, per-cluster tabs | Compare x86 OpenShift with ppc64le |
| Reports | Test report, classic report, vulnerability report, resource trends; doc export | Share results without opening the console |
| Chat agent | LLM with console tools, confirm-before-change, token count per answer | Ask questions of the data in plain language |
Telemetry: everything on one timeline
Every signal carries a UTC timestamp and a node, so a memory spike, a query and a log line can be laid on the same axis. That alignment is what made root causes visible.
| Source | Recorded | Interval |
|---|---|---|
| Probe | osqueryd worker and uptycs-protect memory (RSS, anon) and CPU, worker PID | 1 s |
| Pod stats | Pod memory total vs anon vs page cache, restarts, OOM kills, osquery.db size | 5 min and per event |
| Query monitor | Each query's run time, CPU, memory before, peak and kept; overlap with live queries | Per query run |
| Agent log | Scan phases per OS, template downloads, result batches, upload errors, watchdog kills | Continuous |
| Watcher | Worker restarts with old and new PID | Continuous |
| Node and load | Node CPU, load average, file opens, TCP connects, process starts from fdload | Per run |
| Kubernetes events | Pod replaced, OOMKilled, node not ready | Per event |
| Uptycs cloud | Scan results: rows, CVE counts per system, scan type; read-only queries | Per scan |
At run end the console captures every node's agent logs and diagnostics into the run folder. The reports, alerts and AI notes are built from that folder, so a run can be re-analysed after the cluster has moved on.
Issues we found
The biggest single cost is a full vulnerability scan: one CentOS 7 container took the agent's worker from 125 MB to 418 MB in 36 seconds. Below are the issues we raised, each with the evidence the telemetry gave us.
In the agent
| Issue | Evidence | Impact |
|---|---|---|
| Scan filtered to one container also scans the host | Reported 684 packages; the container has 148, the host 496; host OS templates were downloaded too | Per-container scans cost a host scan each |
| Agent's own memory figure understates the peak | Agent "max watermark" +144 MB vs measured +293 MB | Internal metrics can't be trusted for sizing |
| Scan phases peak high | CentOS 9 phase +235 MiB; CentOS template set is 35.7 MB of JSON, about 495,000 templates | OOM at 512Mi during full scans |
| process_envs under process load | A worker OOM-killed every 15 min with 50 load processes | Busy nodes OOM on a routine query |
| Result batches exceed the cloud's body limit | 4 × "body limit exceeded" in the RHEL 7.9 phase, 8,192 vulns in batches of 2,048 | Some scan results may never reach the cloud |
| Watchdog never acts | Auto-sized to 1,440 MB, above the 1000Mi pod limit; the memory-limit flag ignored | The kernel kills the pod before the agent protects itself |
| Full scan on ppc64le under CPU load | Unloaded: 542 s, 8,286 packages, 66,329 vulns. At 50% CPU it passed 30 min and the watchdog killed it | No full scan completes on a busy Power node |
| ppc chart default too small | 500Mi / 1 CPU was OOM-killed hourly; raised to 1000Mi / 4 CPU | Default install fails on Power |
In the cluster and the cloud
| Issue | Evidence | Impact |
|---|---|---|
| serial-getty restarting every ~10 s on every node | wtmp 36 MB, 93k rows, +8.4k rows a day; hourly last query averages 44 MB | Agent cost grows every day with no change |
| Incremental scans refused before a full scan | "Issued an incremental scan prior to a complete scan" until one full scan completes | A node can go hours with no vulnerability data |
| Cloud sync query times out during a full scan | Times out while the agent keeps scanning | The cloud's view lags the agent's |
| Silent death after OOM | Container "Running" with no osqueryd for 3 days | No alert; looks healthy |
In our own tool
The AI found and fixed most of these, but several reached a run before they were caught.
- Reports never opened for a 24 h run. Eight concurrent builds of the same report starved each other. Fixed with one build per report at a time, and reports pre-built at run end.
- ppc logs never captured, for four runs. At run end the console looked up the ppc node live, got the wrong cluster, and crashed. Fixed by recording each node's cluster when the run starts.
- Thread pools dropped the cluster context. Multi-cluster work ran against the wrong cluster until a pool wrapper carried it.
- False "memory not released" alerts. Small queries were blamed for memory grown by something else. Fixed with a 5-minute confirmation; it would have dropped 4 of 5 false alerts.
- Template downloads counted as failed uploads. The parser now separates download errors from upload errors.
How AI helped our cause
AI turned a months-long investigation into a four-week one, mainly by removing the wait between asking a question and having the tool to answer it.
Where it made the difference
- A requirement became a tested feature the same day. "Show me the flow for a specific error" or "the test setup picture has only one cluster" went from a sentence in chat to a deployed release, with tests and an updated design doc, in hours. We shipped 179 releases in 25 days.
- It read logs no person would read end to end. Agent logs from a 24 h run on six nodes run to tens of MB. The AI parsed scan phases, template downloads, batch uploads and watchdog kills out of them, and lined them up with the 1-second memory probe.
- It found causes, not just symptoms. The OOM loop led to the getty restart loop bloating wtmp, which led to the
lastquery growing every day. Not one of those steps was in the original question. - It checked its own alerts. The AI separated real memory retention (the vulnerability scan) from noise (sub-second queries), and changed the monitor so the noise stopped.
- It ported the whole tool to a second architecture. Making every page, load tool and parser cluster-aware for ppc64le took about three days, including a multi-arch build of the load tool.
- It wrote the evidence down. Every finding went into a findings file or report with the timestamps, numbers and log lines behind it, so the agent team could act on it.
Where it fell short
AI is fast and thorough, but it checks what it is told to check.
- It judged one 24 h run by the run log alone and never opened the reports or the Logs page, so it missed that both were broken. Our tests used a fake kubectl that always succeeds, small data and no concurrency. The fix is a post-run check that opens every report and fails on any "Not captured".
- Shell commands it wrote once put a secret fragment into a system log. Since then, secrets never go on a command line.
- Without stated limits it would also tune things it should not. We had to state limits explicitly: no change to data sent to the cloud, no cloud-side changes.
Guardrails that made it safe
- The cloud is read-only by default; even a read-only query POST needs an OK.
- Any change to the cluster (agent binary, flags, memory limits, test conditions) needs a person's OK each time.
- Code reaches the VM only through the deploy script, which runs the full test gate; no skipping hooks.
- Every change adds a test, and the design document changes in the same commit.
- The AI gateway key is an encrypted systemd credential with an audit log on reads.
Adding agentic AI to the tool: what helped
The agent built into the console earned its place when it stopped waiting to be asked. It watches the cluster, investigates incidents on its own, and reports what it finds.
The AI works only from evidence cut to the incident window. Its result is an alert, and any change it suggests waits for a person.
| Capability | How it works | What it gave us |
|---|---|---|
| Incident investigation | A watcher checks for agent OOM kills, restarts and NotReady nodes; on each it collects pod status, agent logs from 15 min before, events, memory history and the node journal, then asks the AI for cause and next step | An OOM at 3 a.m. arrives with its evidence and a likely cause, not just a restart count |
| Findings as alerts | Each AI finding becomes an alert on the ticker and Alerts page; a failed AI call retries 3 times and raises its own alert | Nothing the AI found is lost silently. We added this after an OOM had been investigated but nobody was told |
| Read-only tools | About two dozen tools: runs, compare, query monitor, agent log, flow, threat-indicator downloads and scans | Answers cite real rows and log lines instead of guesses |
| Confirm before change | Any write (config, test, kubectl, helm) stops at a Confirm / Decline card | Anyone can use the chat on a shared lab without risk |
| Run comparison | The AI explains the difference between two runs: memory, scan times, alerts | Faster "did this build help?" answers |
| UI sweep and self-fix | A sweep finds browser errors, failed API calls and server tracebacks; a fixer works in a separate git worktree, runs the tests, and proposes the change | Small UI bugs got fixed without a person opening the code |
| Token frugality | Plain commands bypass the LLM; answer and tool caches; prompt caching; rolling history; per-chat budget; tokens shown on every message | Cost stays visible and low; repeated questions cost 0 tokens |
What made it work
- Give it evidence, not access. The investigator gets a bundle of files cut to the incident window. Small, relevant input gave better answers than letting it roam.
- Tools over prompts. Each new kind of question got a read-only tool. Adding the threat-indicator tool, and telling the AI to use it before the agent log, made its scan analysis specific.
- Make failure loud. An AI call that fails is retried, then raised as an alert, exactly like a cluster problem.
- Write gates in code. The confirmation step is in the tool router, not in the prompt, so no wording can skip it.
- Show the cost. Showing tokens on every message kept us honest about when the LLM was worth calling.
By the numbers
| Measure | Value |
|---|---|
| Calendar time | 2026-11-03 to 2026-11-30 |
| Benchmark runs | 52, up to 24 h each |
| Clusters | 2: OpenShift on x86 (5 nodes), kubeadm on ppc64le (1 node) |
| Console releases | 179, v0.1 to v0.106.17 |
| Requirements logged | About 170 |
| Automated tests per change | 444 API, 62 browser, plus Go tests for the load tool |
| Agent issues raised | 8 in the agent, 4 in the cluster and cloud |
Takeaways
- Let AI build the instruments, not only answer questions. The biggest wins came from the tools it built, such as the 1-second probe, the query monitor and the flow view, more than from any single answer.
- Put every signal on one timeline. Root causes appeared once memory, queries and log lines were aligned to the second.
- Test the tool like a product. Our worst misses were in our own console, under real data and real concurrency that the unit tests never saw.
- People decide, AI does the work. Explicit OKs for every change to the cluster or cloud let us move fast on a shared lab without breaking it.
