OpsPilot :factory:

Trusted answers from approved procedures, with a human always in control.


Inspiration

On a factory floor, a few minutes of downtime can cost thousands of dollars, and a wrong repair step can injure someone. Operators often flip through thick manuals, hunt for a supervisor, or rely on memory. A generic AI chatbot is not a safe fix, because it can confidently invent steps that are not in the plant's approved procedures.

So we asked: ==what if an AI could only speak from approved documents, show its proof, and never act without a human saying yes?== That idea became OpsPilot.

What it does

OpsPilot is an AI co-pilot for factory operators.

  1. Answers from approved procedures only. Ask "Machine 3 is jamming, what do I do?" and get step-by-step instructions from the right manual section.
  2. Cites every source. Clickable source chips open the exact passage from the original document.
  3. Refuses to guess. If the documents don't cover the question, it replies "I couldn't find this in the approved procedures."
  4. Drafts actions for human approval. Say "Create a high-priority ticket" and it prepares a maintenance ticket. Nothing is saved until a person clicks Approve.
  5. Keeps an audit trail. Every ticket records its status, approver, and timestamps.
  6. Highlights safety. A banner appears for lockout/tagout and emergency-stop steps.

OpsPilot never controls machines and never writes records on its own.

How we built it

Layer Technology
Frontend and API Next.js, TypeScript, Tailwind CSS, shadcn/ui
AI orchestration Vercel AI SDK (streamText, tool calling)
Models Google Gemini (chat and embeddings)
Database PostgreSQL + pgvector
Validation Zod
Deployment Vercel

Pipeline

  • [x] Ingestion: procedures are split by section heading, embedded, and stored in pgvector.
  • [x] Retrieval: the question is embedded and compared with every chunk using cosine similarity:

$$ \text{sim}(q, c) = \frac{q \cdot c}{|q| \, |c|} $$

  • [x] Threshold: only chunks with \(\text{sim}(q, c) \ge \tau\) reach the model, where \(\tau = 0.4\) in our tests. If none pass, the assistant refuses.
  • [x] Grounded generation: a strict system prompt forces answers to use only the retrieved chunks and cite them.
  • [x] Human in the loop: the draftTicket tool has no execute function, so it can only produce a draft. Only the Approve button writes to the database.
Operator question
      |
      v
Embed query --> pgvector search --> threshold filter
      |                                   |
      v                                   v
  Gemini answer with citations      "I couldn't find this"
      |
      v
Draft ticket --> [Approve / Reject] --> Audit log

Challenges we ran into

  • Hallucinations from weak matches. Without a threshold the model answered confidently from poor results. A tuned \(\tau\) plus an explicit refusal rule fixed it.
  • Chunk size. Large chunks diluted relevance and tiny ones lost context. Splitting by heading with a small overlap worked best.
  • Embedding dimension mismatch. The vector(N) column must match the embedding model exactly.
  • Serverless limits. Ingestion does not fit in a Vercel function, so we run it as a local script.
  • Safe approvals. Letting the model draft but never commit took careful tool design.

Accomplishments that we're proud of

  • A complete working loop: question, cited answer, draft ticket, human approval, audit log
  • Answers you have to trust blindly Answers you can verify in one click
  • A refusal behavior that makes the assistant trustworthy, not just impressive

What we learned

  • Retrieval quality matters more than model size for safety-related answers.
  • Trust is a product feature: citations, refusals, and approvals matter as much as the AI.
  • Giving the AI the fewest tools and permissions it needs makes the system safer.[^1]

[^1]: In OpsPilot the model can search documents and draft a ticket, and nothing else.

What's next for OpsPilot

  • [ ] PDF upload so new procedures are searchable immediately
  • [ ] Hybrid search (keyword + vector) for part numbers and error codes
  • [ ] Multi-language support for diverse shop floors
  • [ ] Voice input for hands-free use
  • [ ] Role-based approvals and integration with maintenance systems (CMMS)
  • [ ] Langfuse tracing to measure answer quality

Built with

nextjs typescript tailwindcss shadcn-ui vercel-ai-sdk google-gemini postgresql pgvector zod vercel

Built With

Share this project:

Updates

Submission history