Katballe Studio Writing Projects About

LabAgent

active
ReactWebLLMWebGPUsql.jsGxPLocal AI

A portfolio LIMS assistant built around one constraint: in a regulated (GxP) lab, an AI that occasionally hallucinates a citation or writes to a database isn't a demo bug, it's an audit finding. LabAgent runs a real open-weights model 100% on-device — in-browser via WebGPU (WebLLM), or against a local Ollama server — so nothing typed ever reaches a server, and the app keeps answering after the network is unplugged.

The interesting part is where the safety properties actually live: not in the model, but in the code around it. Document Q&A is TF-IDF retrieval that refuses below a confidence threshold rather than guessing; natural-language data queries are compiled to SQL and run against a real in-browser SQLite (sql.js) only after a guard proves the statement is SELECT-only; and an 8-step Out-of-Spec investigation follows a sequence that's a fixed array in code, not something the model can reorder, ending at a human approval gate. Every interaction is hashed into an append-only audit trail with real SHA-256 (Web Crypto), and a live 6-case eval suite scores whichever model is currently loaded.

All documents, samples, and instrument records are synthetic — authored for this project, not sourced from any employer.