A multi-agent AI system that analyzes cosmetic ingredients in under 10 seconds, delivering personalized safety assessments based on user allergies and skin type.
From 20 minutes of manual research to 10 seconds of validated, personalized analysis.
- Overview
- Problem Statement
- Solution
- Key Features
- Architecture
- Tech Stack
- Installation
- Usage
- Project Structure
- Development Timeline
- Capstone Requirements
- Future Improvements
- Contributing
- License
- Acknowledgments
AishIngAnalyzer is a production-ready multi-agent AI system built for the AI Agents Intensive Capstone Project. It demonstrates true agentic behavior through autonomous decision-making, self-correction, and dynamic workflow orchestration.
- Submitted the project to Google × Kaggle AI Agents Capstone Link
- Won a Top-12 spot out of 11,000 submissionsin the Google × Kaggle AI Agents Capstone Link to 12 winning projects
🎥 Watch Demo Video
🌐 Try Live Application - under production
📊 View LangSmith Traces
- Analysis Time: 10-20 seconds
- Accuracy: >95% (based on evaluation metrics)
- Dataset: 64 ingredients with embeddings
- Cost: $0 development | ~$0.02 per analysis in production
- Agents: 4 specialized Gemini-powered agents
- Concepts Demonstrated: 6 (exceeds 3 minimum requirement)
Consumers face significant challenges when evaluating cosmetic product safety:
| Challenge | Impact |
|---|---|
| Information Overload | Products contain 20-40 ingredients with complex chemical names |
| Lack of Expertise | 88% of consumers don't understand ingredient safety implications |
| Time-Consuming | Manual research takes 20+ minutes per product |
| No Personalization | Generic databases don't account for individual allergies/skin types |
| No Validation | No way to verify if analysis is complete or accurate |
Market Context:
- $200B+ global skincare industry
- 73% of consumers check ingredients before purchase
- Only 12% actually understand what they're reading
AishIngAnalyzer uses true agentic AI (not just a pipeline) to deliver personalized ingredient analysis:
This problem requires agentic AI rather than a simple LLM or sequential pipeline:
- ✅ Autonomous Decision-Making: Research Agent decides which tools to use based on ingredient type
- ✅ Dynamic Tool Selection: System chooses between vector search, web search, or both based on confidence
- ✅ Self-Correction: Critic Agent validates quality and forces re-runs if needed
- ✅ Adaptive Behavior: Analysis Agent adjusts detail based on user expertise and risk level
- ✅ Dynamic Routing: Supervisor routes between agents based on intermediate results, not fixed paths
User Input → Supervisor → Research Agent (tool selection)
↓
Analysis Agent (personalization)
↓
Critic Agent (validation)
↓
Result (or retry if rejected)
- Supervisor Agent: Strategic routing and retry management (max 2 attempts)
- Research Agent: Intelligent data gathering with autonomous tool selection
- Analysis Agent: Personalized report generation adapting to user expertise
- Critic Agent: Quality validation with authority to reject and force retries
- Allergen Detection: Cross-references ingredients with user allergies
- Skin Type Adaptation: Adjusts recommendations for sensitive/normal/oily/dry/combination skin
- Expertise Levels: Beginner (simple language) vs Expert (technical details)
- Risk Prioritization: Highlights high-risk ingredients prominently
- Vector Search: Qdrant semantic search for common ingredients
- Web Fallback: Tavily search when confidence < 0.7 or ingredient not found
- Custom Tools: ingredient_lookup, safety_scorer, allergen_matcher (FastMCP)
- Completeness Check: All input ingredients addressed
- Allergen Verification: User allergens always flagged
- Consistency Validation: Safety scores match descriptions
- Tone Appropriateness: Language matches user expertise level
- LangSmith Tracing: Complete agent decision visibility
- Debug Logs: Track routing decisions, tool selections, validation results
- Performance Metrics: Latency, cost, success rate per analysis
┌─────────────────────────────────────────────────┐
│ USER INTERFACE (Streamlit) │
│ • Profile Input • Ingredient List │
│ • Results Display • Export Options │
└────────────────┬────────────────────────────────┘
│
┌────────────────▼────────────────────────────────┐
│ SUPERVISOR AGENT (Gemini 2.0 Flash) │
│ Routing Logic • Retry Management • State │
└────┬──────────────────────────────────────┬─────┘
│ │
┌────▼────────┐ ┌──────────────┐ ┌───────▼─────┐
│ RESEARCH │ │ ANALYSIS │ │ CRITIC │
│ AGENT │ │ AGENT │ │ AGENT │
└────┬────────┘ └──────┬───────┘ └───────┬─────┘
│ │ │
┌────▼──────────────────▼──────────────────▼─────┐
│ TOOL LAYER (FastMCP) │
│ Custom + Built-in Tools │
└────────────────────┬───────────────────────────┘
│
┌────────────────────▼───────────────────────────┐
│ MEMORY LAYER (Redis + LangGraph State) │
│ User Profiles • Session State │
└────────────────────┬───────────────────────────┘
│
┌────────────────────▼───────────────────────────┐
│ DATA LAYER (Qdrant Vector DB) │
│ 400+ Ingredients • 384-dim Embeddings │
└────────────────────────────────────────────────┘
Role: Orchestrates workflow and manages agent routing
Decision Logic:
| State Condition | Next Agent | Reasoning |
|---|---|---|
| missing_ingredients | → Research | Need ingredient data |
| data_complete + no_analysis | → Analysis | Generate safety report |
| analysis_exists + not_validated | → Critic | Quality check needed |
| critic_approved | → END | Return to user |
| critic_rejected | → Analysis (retry) | Improve with feedback |
| max_retries_exceeded | → END (partial) | Return best effort |
Role: Intelligent data gathering with autonomous tool selection
Tool Selection Strategy:
- Common ingredient (e.g., Niacinamide) → Qdrant vector search only
- Scientific name (e.g., Tocopherol) → Qdrant first, Tavily fallback if confidence < 0.7
- Brand-specific/Unknown → Tavily web search immediately
Output: Ingredient data with confidence scores
Role: Personalized safety analyst
Adaptive Behavior:
- Beginner user → Simple language, explain concepts, avoid jargon
- Expert user → Technical terminology, research citations, detailed mechanisms
- High-risk ingredients → Bold warnings, detailed cautions, alternatives
- User allergies present → Prominent AVOID tags, allergen highlights
Output: Personalized safety report with recommendations
Role: Quality assurance with reject/approve authority
Validation Checks:
- ✓ Completeness: All input ingredients addressed?
- ✓ Allergen Detection: All user allergens flagged?
- ✓ Consistency: Safety scores match concern descriptions?
- ✓ Tone Appropriateness: Language matches user expertise?
Decision Authority:
- APPROVE → Workflow END, return to user
- REJECT → Send back to Analysis Agent with feedback (max 2 retries)
- ESCALATE → Supervisor returns partial results with disclaimer
| Component | Technology | Purpose | Cost |
|---|---|---|---|
| Orchestration | LangGraph | Multi-agent workflow | Free |
| LLM | Gemini 2.0 Flash | All 4 agents | Free tier (1500 req/day) |
| Vector DB | Qdrant Cloud | 400+ ingredient vectors | Free tier (1GB) |
| Web Search | Tavily API | Fallback search | Free tier (1000 searches/month) |
| Tools | FastMCP | Custom tool framework | Free |
| Memory | Redis Cloud | User sessions & profiles | Free tier (30MB) |
| Tracing | LangSmith | Observability | Free tier (5000 traces/month) |
| Evaluation | Ragas | Quality metrics | Free |
| UI | Streamlit | User interface | Free |
| Deployment | Streamlit Cloud | Public hosting | Free |
Total Development Cost: $0
Production Cost: ~$0.02 per analysis
- Python 3.11 or higher
- pip package manager
- Git
git clone https://github.com/yourusername/AishIngAnalyzer.git
cd AishIngAnalyzerpython -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activatepip install -r requirements.txtCreate a .env file in the root directory:
# Gemini API (https://aistudio.google.com/app/apikey)
GOOGLE_API_KEY=your_gemini_api_key
# Tavily API (https://app.tavily.com/)
TAVILY_API_KEY=your_tavily_api_key
# Qdrant Cloud (https://cloud.qdrant.io/)
QDRANT_URL=https://your-cluster.qdrant.io
QDRANT_API_KEY=your_qdrant_api_key
# Redis Cloud (https://redis.com/try-free/)
REDIS_URL=redis://default:password@host:port
# LangSmith (https://smith.langchain.com/)
LANGSMITH_API_KEY=your_langsmith_api_key
LANGSMITH_PROJECT=default# Scrape ingredients and upload to Qdrant
python scripts/run_day1.pyThis will:
- Scrape 400+ ingredients from 3 sources
- Generate 384-dimensional embeddings
- Upload to Qdrant vector database
- Take ~30-45 minutes
streamlit run app.pyOpen browser at http://localhost:8501
-
Create User Profile
Name: Sarah Skin Type: Sensitive Allergies: Fragrance, Parabens Expertise Level: Beginner -
Input Ingredients
Paste or type ingredient list: Water, Niacinamide, Glycerin, Parfum, Methylparaben -
Click "Analyze Ingredients"
- Watch agents work in real-time
- View routing decisions
- See tool selections
-
Review Results
- Safety scores (1-10 scale)
- Allergen warnings
- Personalized recommendations
- Safer alternatives
-
Export Report
- Download as PDF
- Save to profile history
┌──────────────────────────────────────────────────┐
│ Overall Safety Assessment: ⚠️ DO NOT USE │
├──────────────────────────────────────────────────┤
│ │
│ 🟢 SAFE (3 ingredients) │
│ • Water [1/10] Safe │
│ • Niacinamide [1/10] Safe │
│ • Glycerin [1/10] Safe │
│ │
│ 🔴 AVOID (2 ingredients) - ALLERGEN MATCH! │
│ • Parfum [7/10] ⚠️ │
│ MATCHES YOUR ALLERGY: Fragrance │
│ Alternative: Unscented formula │
│ │
│ • Methylparaben [7/10] ⚠️ │
│ MATCHES YOUR ALLERGY: Parabens │
│ Alternative: Phenoxyethanol │
│ │
│ RECOMMENDATION: DO NOT USE THIS PRODUCT │
│ Analysis Time: 8.3 seconds │
└──────────────────────────────────────────────────┘
AishIngAnalyzer/
├── .env # Environment variables (not in git)
├── .gitignore # Git ignore rules
├── requirements.txt # Python dependencies
├── README.md # This file
├── app.py # Streamlit UI application
│
├── data/ # Data storage
│ ├── raw/ # Scraped ingredient data
│ ├── processed/ # Merged & cleaned datasets
│ └── errors/ # Scraping error logs
│
├── src/ # Source code
│ ├── scrapers/ # Day 1: Web scraping
│ │ ├── base_scraper.py # Base scraper with retry logic
│ │ ├── incidecoder_scraper.py
│ │ ├── cosmeticsinfo_scraper.py
│ │ ├── ewg_scraper.py
│ │ └── merge_data.py # Data merging & deduplication
│ │
│ ├── embeddings/ # Day 1: Vector embeddings
│ │ ├── generate_embeddings.py # sentence-transformers
│ │ └── upload_to_qdrant.py # Batch upload to Qdrant
│ │
│ ├── agents/ # Day 2-3: Agent implementations
│ │ ├── supervisor_agent.py # Strategic router
│ │ ├── research_agent.py # Data gatherer
│ │ ├── analysis_agent.py # Report generator
│ │ └── critic_agent.py # Quality validator
│ │
│ ├── tools/ # Day 2-3: Custom tools (FastMCP)
│ │ ├── ingredient_lookup.py # Qdrant vector search
│ │ ├── safety_scorer.py # Personalized scoring
│ │ └── allergen_matcher.py # Allergy cross-reference
│ │
│ ├── graph/ # Day 2: LangGraph workflow
│ │ ├── workflow.py # Graph definition
│ │ └── state.py # State schema
│ │
│ ├── memory/ # Day 3: Session management
│ │ └── session_service.py # Redis-backed sessions
│ │
│ └── evals/ # Day 4: Evaluation metrics
│ ├── ragas_eval.py # Ragas metrics
│ └── test_cases.py # Test scenarios
│
├── scripts/ # Utility scripts
│ ├── setup_project.py # One-time setup
│ ├── run_day1.py # Day 1 pipeline runner
│ ├── test_qdrant.py # Test Qdrant connection
│ ├── test_redis.py # Test Redis connection
│ └── test_langsmith.py # Test LangSmith tracing
│
└── tests/ # Unit & integration tests
├── test_agents.py
├── test_tools.py
└── test_workflow.py
Total Duration: 6 days (Nov 26 - Dec 1, 2025) | 88 hours
| Day | Date | Focus | Deliverable | Hours |
|---|---|---|---|---|
| 1 | Nov 26 | Data Foundation | 400+ ingredients in Qdrant | 16 |
| 2 | Nov 27 | Agent Architecture | Supervisor + Research agents | 16 |
| 3 | Nov 28 | Analysis + Critic | 4 agents with full workflow | 16 |
| 4 | Nov 29 | Memory + Observability | Sessions + tracing + UI | 16 |
| 5 | Nov 30 | Deploy + Documentation | Live app + video + docs | 16 |
| 6 | Dec 1 | Polish + Submit | Final submission | 8 |
Requirement: Demonstrate minimum 3 concepts from AI Agents Intensive
Our Implementation: 6 concepts (exceeds requirement)
| # | Concept | Implementation | Evidence |
|---|---|---|---|
| 1 | Multi-Agent Orchestration | Supervisor + 3 specialists with conditional routing | src/agents/ |
| 2 | Tool Use (MCP) | FastMCP server with 3 custom tools + Tavily | src/tools/ |
| 3 | Context & Memory | SessionService stores user profiles in Redis | src/memory/ |
| 4 | Agent Evaluation | Ragas metrics + Critic agent validation | src/evals/ |
| 5 | Observability | LangSmith tracing of all agent decisions | LangGraph integration |
| 6 | Gemini Usage | Gemini 2.0 Flash powers all 4 agents | All agent files |
Scoring Target: 100/100 points
- The Pitch (30 pts): Core concept + writeup
- Implementation (70 pts): Technical (50) + Documentation (20)
- Bonus (20 pts): Gemini (5) + Deployment (5) + Video (10)
-
Limited Dataset: Only 64 ingredients successfully scraped; target is 400+
- Need better anti-blocking measures (rotating user agents, request delays)
- Implement more robust error handling and retry logic
-
EWG Rating Extraction Issue: Cannot extract safety scores from ewg.org
- Dynamic JavaScript rendering blocks current scraper
- Plan: Implement Selenium WebDriver or explore EWG API access
1. Comprehensive Guardrails
- Input validation (sanitize ingredient names, rate limiting)
- Output validation (hallucination detection, score bounds checking)
- Agent behavior controls (timeout limits, cost caps)
2. Expanded Dataset
- Target: 2,000+ ingredients from 10+ sources
- Add: CIR, Paula's Choice, FDA, CosDNA, SkinCarisma
- Enhanced metadata: ingredient interactions, contraindications, pregnancy safety
3. Improved User Experience
- Visual dashboard with color-coded safety scores
- Interactive ingredient cards with "why this score?" explanations
- Comparison mode for multiple products
- Mobile app with barcode scanning
4. Advanced Features
- Mem0 Integration: Intelligent contextual memory to learn user preferences
- Interaction Warnings: Flag dangerous ingredient combinations
- Batch Analysis: Analyze entire skincare routines
- Recommendation Engine: Suggest products based on history
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
# Install development dependencies
pip install -r requirements-dev.txt
# Run tests
pytest tests/
# Run linter
flake8 src/
# Format code
black src/This project is licensed under the MIT License - see the LICENSE file for details.
- AI Agents Intensive - Capstone project framework and guidance
- Google Gemini Team - Gemini 2.0 Flash API access
- LangChain/LangGraph - Multi-agent orchestration framework
- Qdrant Team - Vector database for semantic search
- Data Sources:
- incidecoder.com - Ingredient purposes and descriptions
- cosmeticsinfo.org - Safety information
- EWG Skin Deep - Safety scores and ratings
Documentation: Full Capstone Document
Built with ❤️ for the AI Agents Intensive Capstone Project
Transforming 20 minutes of confusion into 10 seconds of clarity.