video-demo.mp4
A transparent, explainable AI system for supplier consolidation, compliance reasoning, and sourcing optimization in the CPG industry.
Agnes transforms fragmented supply chain data into structured, explainable sourcing decisions.
It answers:
- Which ingredients are functionally identical across companies?
- Which suppliers can be consolidated safely?
- What compliance risks exist in substitutions?
- How confident is each recommendation β and why?
Unlike typical ML systems, Agnes is built as a full decision pipeline with traceable reasoning, evidence, and scoring.
flowchart TD
A[(SQLite Database)] --> B[Data Extraction Layer]
B --> C["Ingredient Normalization & Semantic Matching"]
C --> D[Cross-Company Substitution Groups]
D --> E[External Intelligence Layer]
E --> F[iHerb / Supplier Scraping APIs]
E --> G["Supplier Websites: Certifications, Specs, Geography"]
E --> H[LLM-assisted Compliance Inference]
F & G & H --> I[(Enriched Knowledge Base)]
I --> R[Embedding Index + RAG Retrieval System]
R --> Q["Contextual Grounding over Proposals & Evidence"]
Q --> J[Substitution Validator]
J --> K[Compliance & Risk Checker]
K --> L[Multi-Objective Sourcing Optimizer]
L --> M1[Cost Savings Objective]
L --> M2[Compliance Probability Objective]
L --> M3[Supplier Concentration Risk Objective]
L --> M4[Data Quality / Uncertainty Objective]
M1 & M2 & M3 & M4 --> N[Pareto Frontier Selection Engine]
N --> O[Confidence Scoring Module]
O --> P[Verification & Hallucination Guardrails]
P --> U[Uncertainty & Evidence Attribution Layer]
U --> V[Evidence Trail Builder]
V --> W["Agnes Dashboard & Chat UI (RAG-powered)"]
%% Correcting the feedback loop with a Human-in-the-Loop gate
W -.-> HITL[Human Verification Gate]
HITL -.-> C
style C fill:#ff6b6b,color:white
style E fill:#ff6b6b,color:white
style R fill:#9c27b0,color:white
style L fill:#ff9800,color:white
style N fill:#4caf50,color:white
style O fill:#4caf50,color:white
style W fill:#2196f3,color:white
style HITL fill:#f1c40f,color:black
Agnes is not just prediction β it is:
It balances:
- π° Cost savings (consolidation efficiency)
- β Compliance safety (certifications, regulatory risk)
- π Data quality (scraped vs missing vs inferred)
- π Supplier coverage (market fragmentation reduction)
Recommendations are not single-optimum:
- Some suppliers maximize savings
- Others maximize compliance safety
- Others maximize data certainty
Agnes surfaces trade-offs instead of hiding them
- Extracts raw materials (SKUs)
- Maps companies β ingredients β suppliers
- Builds structured relational dataset
- Scrapes supplier websites + product pages
- Extracts certifications (organic, halal, GMP, etc.)
- Builds compliance evidence database
- Assigns confidence scores to scraped data
This is the external intelligence layer
- Groups functionally identical ingredients
- Detects substitution opportunities
- Evaluates supplier consolidation potential
- Runs compliance validation (PASS / FAIL / UNKNOWN)
- Computes:
- π° estimated savings
- β risk factors
- π¦ coverage across companies
- Sourcing proposals
- Verification results
- Risk analysis
- Structured reasoning artifacts
- FastAPI backend
- Retrieval system over:
- proposals
- evidence (scraped + enriched data)
- Evidence Trail Builder (explainability engine)
- Chat agent (RAG-based optional LLM interface)
This phase turns raw reasoning into a queryable intelligence system
Every decision includes:
- Supplier identity proof
- Compliance verification status
- Risk factors
- Evidence citations (scraped sources)
- Confidence score breakdown
Each recommendation is computed using explicit signals:
- Functional equivalence (ingredient matching)
- Compliance coverage
- Supplier reach across companies
- Data completeness (real vs missing vs inferred)
The system explicitly tracks:
- scraped supplier pages
- certifications
- compliance requirements
- product-level evidence
Every recommendation is traceable to real sources
Agnes combines:
- deterministic rule-based reasoning (core engine)
- retrieval system (vector + fallback hashing)
- optional LLM layer (chat interface)
β Fully functional even WITHOUT API keys
Instead of guessing, Agnes explicitly outputs:
- UNKNOWN when data is missing
- REVIEW_NEEDED when partial compliance exists
- confidence penalties for low-quality data
No hallucinated certifications allowed
The system is a working prototype. Due to time and data constraints, several components have been simplified:
- Heuristic Confidence Scoring: Reliability scores are currently based on fixed rules rather than being learned from historical labeled data.
- Data Consistency: External supplier data gathered via scraping or APIs may be incomplete or inconsistent depending on source availability.
- Inference Precision: Compliance checking utilizes a hybrid of rule-based logic and LLM assistance; as a result, precision levels may vary.
- System Integration: There is currently no integration with enterprise procurement systems (e.g., SAP or ERP platforms).
- Ranking Model: The system lacks a trained machine learning ranking model due to a lack of labeled historical sourcing decisions.
- Python 3.10+
- Node.js & npm (for the Next.js frontend)
- OpenAI API Key (required for semantic matching, enrichment, and the RAG chat)
- SQLite (pre-installed with Python)
git clone https://github.com/<your-github-username>/Makeathon-TUM.ai-2026-Spherecast-Challenge-Agnes.git
cd Makeathon-TUM.ai-2026-Spherecast-Challenge-Agnes/agnespython -m venv venv
source venv/bin/activate # Mac/Linux
# venv\Scripts\activate # Windows
pip install -r requirements.txtCreate a .env file in the agnes/ directory (or set environment variables):
OPENAI_API_KEY=your_api_key_here
OPENAI_CHAT_MODEL=gpt-4oAgnes processes data in phases. You must run these to populate the enrichment data and build the search index.
Groups raw materials across 61 companies into substitution groups.
python -m backend.run_phase1This generates the sourcing proposals and builds the embedding index for the Chat AI.
python -m backend.run_phase4 --rebuild-indexuvicorn backend.main:app --reload --port 8000The API will be live at http://localhost:8000. You can view the automated docs at http://localhost:8000/docs.
cd frontend
npm install
npm run devThe Dashboard will be live at http://localhost:3000.
curl -X POST http://localhost:8000/api/chat \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "user", "content": "Which supplier should we consolidate Vitamin D3 for?"}
]
}'- Phase 1 (Extraction): Parses SKUs and clusters 876 raw materials using OpenAI embeddings.
- Phase 2 (Enrichment): Scrapes iHerb and uses LLM agents to infer compliance requirements for finished goods.
- Phase 3 (Reasoning): Validates substitutions against compliance constraints and calculates savings.
- Phase 4 (Output): Builds the evidence-backed proposals and the retrieval index.
You now have a working supply chain intelligence engine capable of finding millions in potential savings with full compliance verification and a RAG-powered chat interface.