Skip to content

Shreshthaaa/trendyy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trendyy - Skincare Trend Spotter Agent

An agentic AI system that autonomously researches trending skincare ingredients and generates structured product briefs using the ReAct (Reasoning + Acting) pattern.

Built to explore agentic AI concepts: tool use, multi-step reasoning, and LLM-powered autonomous decision making.


What it does

Takes a skincare category as input (e.g. "sunscreen", "facewash") and:

  1. Autonomously decides what to search for
  2. Runs multiple Google searches with different queries
  3. Reasons over the results
  4. Outputs a structured product brief with trending ingredients, consumer insights, and a product concept

Architecture

User Request → FastAPI → LangChain ReAct Agent → SerpAPI (Google Search)
                                ↓
                        Groq (llama-3.1-8b-instant)
                                ↓
                    Structured Product Brief

Agent Reasoning (ReAct Pattern)

The agent thinks out loud before every action. Here's a real example for the "facewash" category:

Thought: To understand the current trends in the facewash category in India, I need to search for popular facewash ingredients, products, and consumer behavior.

Action: SearchTrends
Action Input: "best facewash ingredients in India"

['Key ingredients includes: Neem, Tulsi, Aloe, and Other Herbal Extracts. Why do you love this? - They help in removing the dirt and oily ...', '1. Soulflower Kumkumadi Face Wash: · Made with Kumkumadi, Aloe Vera, Turmeric, Mulethi, Saffron. Reduces acne scars, blemishes, and pigmentation.', "The Dermaco- AHA BHA facewash. The basic cetaphil one (gentle cleanser). Soap & Glory vitamin c facewash (the only vitamin c product that didn't ...", '1. Forest Essentials Delicate Facial Cleanser - Mashobra Honey & Vanilla · Ingredients: Honey, Vanilla extract, and natural preservatives; Skin ...', '1. Minimalist 6% Oat Extract Gentle Cleanser 2. Cetaphil Gentle Skin Cleanser 3. Bioderma Sensibio Gel Moussant 4. Nourish Mantra Green Tea Face Wash', 'Top products · Himalaya. Purifying Neem Face Wash · Minimalist. Oat Extract 06% Gentle Cleanser · Minimalist. Salicylic Acid + LHA 02% ...', 'Himalaya Purifying Neem Face Wash ingredients explained: Water (Aqua), Ammonium Lauryl Sulfate, Melia Azadirachta(Neem) Leaf Extract, ...', '○ Look for foam texture and ingredients like niacinamide or salicylic acid Cetaphil Gentle exfoliating SA cleanser ... best ingredients for dry skin. Derived from ...']

Thought: I now have enough data to form a brief.

Final Answer:

TOP TRENDING INGREDIENTS/ACTIVES:
1. Neem - trending due to its antibacterial and anti-inflammatory properties, which help in removing dirt and oily impurities from the skin.
2. Tulsi - trending due to its antioxidant and anti-inflammatory properties, which help in reducing acne scars, blemishes, and pigmentation.
3. Niacinamide - trending due to its ability to improve skin elasticity, reduce inflammation, and enhance skin brightness.

CONSUMER INSIGHT:
Indian consumers are increasingly looking for facewashes that are gentle, non-irritating, and effective in addressing specific skin concerns such as acne, dryness, and hyperpigmentation. They are also seeking products that are made with natural and herbal ingredients.

SUGGESTED PRODUCT CONCEPT:
A gentle, non-foaming facewash that combines the benefits of Neem and Tulsi with the skin-brightening properties of Niacinamide. The product should be free from harsh chemicals, artificial fragrances, and dyes, and should be suitable for all skin types.

CONFIDENCE LEVEL:
High

ReAct = Reasoning + Acting. Instead of answering immediately, the agent plans, searches, observes, and iterates — just like a human researcher would.


API Endpoints

POST /analyze-trend

Runs the agent for a given skincare category.

Request:

{
  "category": "sunscreen"
}

Response:

{
  "category": "sunscreen",
  "brief": "TOP TRENDING INGREDIENTS...",
  "latency_seconds": 4.93
}

GET /health

{
  "status": "ok",
  "service": "trend-spotter-agent"
}

How to Run

Without Docker

# Clone the repo
git clone https://github.com/Shreshthaaa/Trendyy
cd Trendyy

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Add your API keys
cp .env.example .env
# Edit .env with your keys

# Run
cd app
uvicorn main:app --reload

Open http://localhost:8000/docs to use the interactive API UI.

With Docker

docker build -t trend-spotter .
docker run -p 8000:8000 --env-file .env trend-spotter

Environment Variables

Create a .env file in the root folder:

GROQ_API_KEY=your_groq_key_here
SERPAPI_API_KEY=your_serpapi_key_here

Get your free keys:


Tech Stack

Tool Purpose
Python Core language
LangChain Agent framework (ReAct pattern)
Groq (llama-3.1-8b-instant) LLM for reasoning
SerpAPI Google search tool for the agent
FastAPI API layer
Docker Containerization

Project Structure

trendyy/
├── app/
│   ├── main.py          # FastAPI app + endpoints
│   ├── agent.py         # LangChain ReAct agent
│   ├── tools.py         # Agent tools (Google search)
│   └── schemas.py       # Pydantic request/response models
├── Dockerfile
├── requirements.txt
├── .env.example
└── README.md

Production Considerations

This is a prototype. In a production system I would:

  • Scale LLM calls : move to Vertex AI or a managed LLM endpoint with rate limiting and fallback models
  • Add evaluation logging : track output quality over time, flag low-confidence briefs for human review
  • Authentication : API key auth on FastAPI endpoints
  • Persistent storage : log all agent runs to a database for auditability and fine-tuning data
  • Async agent execution : for long-running searches, return a job ID immediately and poll for results
  • Monitoring : latency tracking, token usage, error rates via something like LangSmith or Prometheus

About

Agentic AI system that autonomously researches skincare trends using LangChain ReAct + Groq + FastAPI

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors