# How to Add AI to LabWare LIMS On-Prem Without Moving Data

> Source: https://netray.co/erp-help/private-ai-layer-labware-lims-on-prem-architecture
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: ERP Help

## Short answer

You can put a private AI assistant on top of LabWare LIMS by reading from a reporting replica of the LIMS database, indexing SOPs and certificates of analysis separately, and serving an open-weight model on local GPUs. The assistant calls a small set of approved read-only tools, mirrors LabWare security groups, and never writes back without a human approval step. Nothing needs to leave the lab network.

## Kind

advanced

## System

on-prem-apps

## Erp

LabWare LIMS

## Module

Samples, Tests, Results / Private AI layer

## Query

how to add AI to LabWare LIMS on-prem

## Alternate Queries

- LabWare LIMS AI integration without cloud
- ask questions of LabWare LIMS data with a local LLM
- LabWare LIMS chatbot on-premise

## Applies To

LabWare LIMS 7 and later on Oracle or SQL Server, on-prem or private cloud. Table and field names are configurable per site, so confirm against your own data dictionary.

## Steps

### Build the private AI layer in seven steps

**Items:**

Inventory the data you actually want to ask about: sample status and backlog, test and result history, specifications and limits, instrument and batch links, and the documents (SOPs, methods, COAs, deviations) that live outside the database.

Stand up a read-only reporting copy of the LIMS database: a physical standby, an Oracle or SQL Server read replica, or a nightly restore. Give the AI service a database login with SELECT on named views only.

Define approved read tools as SQL views or parameterized queries, for example open samples by product and age, results out of specification by analysis, and test turnaround by lab. The model never writes free SQL against base tables in the first phase.

Build a separate retrieval index over SOPs, test methods, COAs and attachments from the document store or file share, with each chunk tagged with its source, version and the group allowed to read it.

Serve an open-weight model with vLLM or Ollama on local GPUs, and expose the tools to it through an MCP or function-calling server that runs inside the lab network.

Map LabWare users and security groups to the assistant: the user signs in with the same identity, and the tool server applies the equivalent lab, product and group filters to every query.

Log every question, tool call, query text and answer to an append-only audit store, then roll out in phases: read-only Q and A first, drafts second, approved actions last.

## Sections

### Where the data lives and how to reach it

**Body:**

LabWare stores its operational data in a relational database, typically Oracle or SQL Server. The core entities are samples, tests assigned to a sample, and results entered for each test, alongside configuration tables for products, analyses, specifications, lists and users. Because LabWare is highly configurable, the exact columns differ between sites, so treat any table name in a blog post as a starting point and confirm it in your own data dictionary.

LabWare also exposes business logic through LIMS Basic, its scripting language, and through the integration interfaces licensed with your version, including web services in current releases. Use those when you need the application to apply its own rules, for example to create a sample. For analytics-style questions, a direct read from a replica is faster, cheaper on the production system and easier to audit.

Documents are the other half. SOPs, methods, COAs, deviation reports and instrument printouts are usually attached to records or stored on a document system. They need their own retrieval index, because a language model cannot answer 'what does the method say about hold times' from result tables.

**Code:**

-- Illustrative only: confirm table and column names in your LabWare data dictionary
SELECT s.ID_NUMERIC, s.ID_TEXT, s.PRODUCT, s.STATUS, s.LOGIN_DATE
FROM   SAMPLE s
WHERE  s.STATUS IN ('U', 'A')        -- unreceived / in progress, per your status codes
  AND  s.LOGIN_DATE < SYSDATE - 5    -- Oracle syntax; use DATEADD on SQL Server
ORDER  BY s.LOGIN_DATE;

-- Results outside limits for a product, via a view you create on the replica
SELECT * FROM AI_V_RESULTS_OOS
WHERE  PRODUCT = :product AND ENTERED_ON >= :from_date;

### Reference architecture for an on-prem or air-gapped lab

**Body:**

The pieces are few. A reporting replica feeds a set of curated views. A change data capture job or a scheduled sync keeps a text index of the records and documents you want searchable. A tool server, speaking MCP or plain function calling, offers the model a short menu of read actions. The model itself is an open-weight model served by vLLM or Ollama on the lab's own GPUs. An audit store records everything.

For an air-gapped site, ship model weights, container images and Python wheels through a controlled transfer process, run an internal package mirror, and keep telemetry off. Embedding and reranking models run locally too. There is no outbound dependency at query time.

Keep the assistant in a separate network segment from the LIMS application servers. The only path from the assistant to LabWare data should be the replica and, for approved write-back, the supported application interfaces.

### Permissions: never show what the user cannot see

**Body:**

A lab assistant that ignores security is worse than none. LabWare restricts users by security group and by what they may see or edit, and many sites segment by lab, product or customer. The tool server must carry the end user's identity into every query and add the equivalent filter, rather than running as one all-powerful service account and trusting the model to hold back.

In practice that means a mapping table from LabWare groups to row filters (lab, product family, project), applied inside the views or the query builder, plus per-chunk access tags on the document index. Test it the way an auditor would: sign in as a restricted user and try to extract another lab's results by rephrasing the question.

Regulated labs should also keep the assistant out of any decision path. Its answers are navigation and summary, not a reportable result.

### Write-back and GxP boundaries

**Body:**

Phase one writes nothing. Later phases can draft items, such as a deviation description, a sample login request or a retest justification, and show them to the analyst. Only the analyst's click submits it, and submission goes through the supported LabWare interface so that audit trail, electronic signature and validation rules still apply.

Do not let a model enter, change or approve results. In a regulated lab, computer system validation expects documented intended use, risk assessment and testing of the system. An advisory, read-only assistant with human review is much easier to place in that framework than an autonomous writer. Involve your quality unit early.

### Sizing, rollout and honest limits

**Body:**

A lab with 50 to 300 named users asking a few questions each per day usually fits on one or two data-center GPUs with a 14B to 70B class open-weight model, plus a small embedding model on CPU or a slice of GPU. A document index of 20,000 to 200,000 pages is a few gigabytes. Use the sizing calculator to turn your numbers into ranges.

Roll out in three phases over roughly 8 to 16 weeks: read-only questions on curated views, then summaries and drafts with human review, then a small set of approved actions. Pick five to ten real questions from supervisors first and measure accuracy against them.

Limits are real. The model is weak at long numeric reasoning, so push calculations into SQL or code. Heavily customized schemas need more mapping work. If your only need is a canned dashboard or a LabWare report, the built-in reporting is enough.

## Pitfalls

- Pointing the model at base tables with free SQL. Use curated views and parameterized tools, or you will get slow queries and wrong joins.
- Running everything under one service account, which silently bypasses lab and product restrictions.
- Indexing SOPs without version and effective-date metadata, so the assistant quotes a superseded method.
- Letting the model do arithmetic on results instead of computing statistics in SQL or code.
- Treating the assistant as part of the reportable-result workflow without involving quality and validation.

## Ai Angle

Netray builds this layer for sites that cannot send LIMS data to a cloud service: a read-only replica, curated views, a retrieval index over SOPs and COAs, a tool server, and a local open-weight model, with the assistant's permissions mirrored from LabWare groups. For general question answering across ERP and operational data, ERPray follows the same pattern, and a custom build covers LIMS-specific tools.

## Faq

### Do we need LabWare's permission to build this?

**Answer:** Reading your own database replica is within your control, but check your license and support agreement. Using documented application interfaces for any write-back is the safer path. Ask your LabWare account contact which interfaces your version includes before designing anything that writes.

### Can the assistant run fully offline?

**Answer:** Yes. The model, embeddings, vector index, tool server and audit store can all live inside the lab network with no outbound access. Updates arrive through a controlled transfer process. The tradeoff is that you own patching and model refreshes.

### Will it work with Oracle and SQL Server both?

**Answer:** Yes, the tool server abstracts the database. Views and date functions differ, so each query is written and tested per engine. CDC options also differ: Oracle sites often use a standby or GoldenGate, SQL Server sites use replicas or change tracking.

### Is this validated for GxP use?

**Answer:** The architecture supports validation by keeping the assistant read-only and fully logged, but validation itself is your quality unit's job: intended use, risk assessment, test evidence. Keep the assistant advisory and out of result entry and approval.

## Search terms

labware lims ai, labware lims on-prem ai, lims chatbot on premise, ask questions lims data local llm, labware lims integration architecture, private ai for lims, air-gapped lims ai, lims retrieval augmented generation

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
