Skip to main content
ahad.works

Agentic RAG for Manufacturing

Three-agent RAG pipeline (Router → Retriever → Generator) for manufacturing equipment manuals and safety SOPs, running offline via Milvus Lite and Ollama with mandatory page-level source citations.

PythonFastAPIMilvusOllamaLangChain

Problem Statement

Manufacturing environments rely on vast libraries of equipment manuals, safety SOPs, and maintenance logs. Engineers waste hours searching through PDFs for a single specification or procedure. Traditional keyword search fails because queries like "What's the LOTO procedure for the hydraulic press?" require semantic understanding.

Architecture

The system uses a three-agent agentic pipeline:

  1. Router Agent — Classifies intent as retrieval, direct answer, or multi-part query
  2. Retriever Agent — Searches ingested documents using semantic similarity via Milvus Lite
  3. Generator Agent — Creates responses with mandatory source citations including page numbers

Key Design Decisions

  • On-Premise First: Runs completely offline with Ollama + Milvus Lite → no cloud dependency for air-gapped factory floors
  • Multi-Format Ingestion: Handles PDF, DOCX, Excel, PowerPoint, and plain text
  • Smart Query Decomposition: Breaks complex questions into sub-queries for higher accuracy
  • Audit-Ready Citations: Every answer references the source document and page number

Tech Stack

LayerTechnology
LLMOllama (local) or Azure OpenAI
Vector DBMilvus Lite
BackendFastAPI
OrchestrationLangChain

Results

The system achieves high retrieval accuracy on manufacturing-specific terminology (LOTO, PPE, equipment IDs) and provides traceable answers suitable for compliance audits.