AI ERP Manager

About this project
AI ERP Manager: a supply-chain risk radar with a person in charge
Problem. In manufacturing, supply risks show up in the data weeks before they stop a line: vendors drifting late, prices creeping up, safety stock set too low. The signals are split across purchasing, logistics and production, and nobody can check every vendor and material by hand. Comparing vendor PDFs with orders, writing chase e-mails and preparing reports are also manual work.
Who it's for. Buyers, planners, production managers and their managers, in small and mid-sized manufacturers that run an ERP such as SAP but have no data team.
What it does. It monitors ERP-shaped factory data daily, raises alerts with the likely cause and drafts the next step. A person approves every e-mail, note and upload, and every decision goes to an audit log.
Architecture: code checks, AI explains, a person decides.
Detection: 5 rule-based detectors in Python over DuckDB (read-only).
Root cause: a LangGraph StateGraph with parallel nodes and no LLM calls. It's deterministic, testable and costs $0.
Q&A: a LangChain agent with 30 tools, filtered per department. The tools call the same functions the UI uses, so every number matches.
Document AI: vendor PDFs (order confirmations and price lists) are parsed with pypdf and extracted with an LLM as structured output. Every value is grounded: it must appear in the source document. A prompt-injection guard runs first, and personal data is masked before the model sees it.
Human in the loop: a LangGraph interrupt and a SQLite checkpointer pause the run for approval, and an atomic claim makes sure an e-mail is sent exactly once.
Observability: each answer shows its steps, tokens and cost, and LangSmith traces are tagged by role.
Stack: Python, Streamlit, LangChain, LangGraph, OpenRouter (gpt-6-luna), DuckDB, SQLite, ChromaDB, DeepEval, LangSmith, Playwright, pytest and GitHub Actions.
Evaluation (pass marks written before each run, failures kept on record):
Root cause: the LangGraph pipeline was right 100% of the time, a free-form agent 33–67%.
Tool selection: 45 of 47.
Red team: 0 of 28 attacks succeeded.
Order confirmations: 99.4% field accuracy.
Price lists: 69 of 69 after the evaluation exposed a number-format bug (the first run failed 7 of 10 marks).
Model choice: gpt-6-luna was about 39× cheaper than the alternative at equal quality.
Testing: about 2,000 automated tests in CI, plus Playwright bots and LLM personas that use the app like people.
Users. A supply chain manager and a planner rated it 3.5 and 4 out of 5. They valued the document checks, table mapping, plain-language questions and ready-to-send e-mails. Next steps they asked for: company-specific KPIs and a direct ERP connection.
Limits. All data is synthetic. The results validate the method, not production use.