An Agentic AI system that autonomously browses, searches, compares, and purchases products on e-commerce websites using natural language commands.
What is Agentic AI? โข Features โข Architecture โข Quick Start โข Usage โข Demo
Agentic AI represents the next evolution in artificial intelligenceโsystems that don't just respond to queries but autonomously take actions to achieve goals. Unlike traditional chatbots that only provide information, Agentic AI systems:
| Traditional AI | Agentic AI (This Project) |
|---|---|
| Answers questions | Executes tasks autonomously |
| Requires step-by-step instructions | Decomposes goals into sub-tasks |
| Single-turn interactions | Multi-step planning & execution |
| Passive responses | Active browser manipulation |
| No environmental interaction | Real-time DOM interaction & verification |
User: "Find me a gaming laptop with RTX 4060, i7 processor under 1 lakh on Amazon and add to wishlist"
The Agent Autonomously:
- ๐ Reasons about the request using LLM (Gemini/Groq)
- ๐ Plans a multi-step execution strategy
- ๐ Navigates to Amazon.in
- ๐ Searches with optimized queries ("gaming laptop RTX 4060 i7")
- ๐ฐ Filters products by price range
- ๐ Analyzes product listings using NLU
- โ Verifies specs match requirements (RTX 4060, i7, under โน1L)
- โค๏ธ Adds to wishlist with confirmation
- ๐ Reports results back to user
- Natural Language Understanding: Understands complex, multi-part shopping requests
- Dynamic Intent Extraction: Extracts product type, specs, budget, and actions from any query
- Intelligent Site Selection: Automatically chooses best e-commerce site for product category
- Adaptive Execution: Handles popups, CAPTCHAs, and dynamic page content
- Self-Verification: Confirms actions were successful before proceeding
- Typo Tolerance: Handles "gameing lapotp" โ "gaming laptop"
- Multi-Site Support: Amazon, Flipkart, Myntra, Ajio, TheSouledStore, Bewakoof
- Persistent Login: Maintains authenticated sessions across runs
- Adversarial Testing: 100% pass rate on 29+ edge case tests
- Fallback Reasoning: Works even without LLM (rule-based fallback)
| Component | Technology |
|---|---|
| Browser Automation | Playwright (async, anti-detection) |
| LLM Integration | Google Gemini (primary), Groq Llama (fallback) |
| NLU/NER | Custom intent parser + DistilBERT extraction |
| UI | Streamlit (real-time status updates) |
| API | FastAPI (REST endpoints) |
| Storage | SQLite (session logs, task history) |
| Testing | Pytest (unit + integration + adversarial) |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ USER INTERFACE โ
โ (Streamlit UI / CLI / API) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ INTELLIGENT REASONING ENGINE โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โ โ Intent โ โ Dynamic โ โ Site โ โ
โ โ Analysis โโโโ Product โโโโ Selection โ โ
โ โ (LLM) โ โ Extraction โ โ Logic โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ENHANCED UNIFIED ORCHESTRATOR โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โ โ Task โ โ Action โ โ State โ โ
โ โ Planning โโโโ Executor โโโโ Manager โ โ
โ โ โ โ โ โ โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ PLAYWRIGHT RUNNER โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โ โ Persistent โ โ Anti- โ โ Action โ โ
โ โ Context โโโโ Detection โโโโ Verificationโ โ
โ โ (Login) โ โ Scripts โ โ โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ E-COMMERCE WEBSITES โ
โ Amazon.in โ Flipkart โ Myntra โ Ajio โ + More โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
graph TD
A[User Query] --> B{Intent Analysis}
B --> C[Extract Product Type]
B --> D[Extract Specs/Budget]
B --> E[Detect Actions]
C --> F{Known Category?}
F -->|Yes| G[Use Category Rules]
F -->|No| H[Dynamic NLU Extraction]
G --> I[Select Best Sites]
H --> I
I --> J[Generate Search Query]
J --> K[Execute Browser Actions]
K --> L{Action Success?}
L -->|Yes| M[Continue to Next Step]
L -->|No| N[Retry with Fallback]
M --> O{More Actions?}
O -->|Yes| K
O -->|No| P[Return Results]
N --> L
- Python 3.10+
- Node.js 18+ (for Playwright)
- API Key: Gemini or Groq
# Clone the repository
git clone https://github.com/yourusername/subaru-ai.git
cd subaru-ai
# Create virtual environment
python -m venv .venv
.venv\Scripts\activate # Windows
# source .venv/bin/activate # Linux/Mac
# Install dependencies
pip install -r requirements.txt
# Install Playwright browsers
playwright install chromiumCreate a .env file in the project root:
# LLM API Keys (at least one required)
GEMINI_API_KEY=your_gemini_api_key_here
GROQ_API_KEY=your_groq_api_key_here
# Optional: Site Credentials for authenticated actions
AMAZON_EMAIL=your_email@example.com
AMAZON_PASSWORD=your_password# Start Streamlit UI
streamlit run src/ui/app.py
# Or run via CLI
python run_unified_agent.py "Find gaming laptop under 80000 on Amazon"The agent understands a wide variety of natural language commands:
# Simple product search
"Find me wireless headphones under 5000"
# Multi-constraint search
"Search for Samsung phone with 8GB RAM under 25000 on Flipkart"
# Action commands
"Add the first iPhone 15 to my Amazon wishlist"
# Complex queries with typos (handled automatically!)
"gameing lapotp with rtx 4060 i7 16gb under 1 lakh"
# Comparison queries
"Compare iPhone 15 vs Samsung S24"
# Fashion searches
"Anime hoodie for winter on Souled Store"| Action | Example Command |
|---|---|
| Search | "Find RTX 4070 laptops" |
| Filter by Price | "Under 50000", "Below 1 lakh" |
| Filter by Rating | "4+ stars", "Highly rated" |
| Add to Cart | "Add to cart", "Buy this" |
| Add to Wishlist | "Save for later", "Add to wishlist" |
| Login | "Login to Amazon" (uses saved credentials) |
| Compare | "Compare products" |
| Site | Categories |
|---|---|
| Amazon.in | Electronics, Everything |
| Flipkart.com | Electronics, Fashion |
| Myntra.com | Fashion |
| Ajio.com | Fashion |
| TheSouledStore.com | Anime/Fandom Merchandise |
| Bewakoof.com | Casual Wear |
| Croma.com | Electronics, Appliances |
Input:
Find me a gaming laptop with RTX 4060 and i7 processor under 1 lakh on Amazon
Agent Execution:
๐ Analyzing intent...
โโ Product: gaming laptop
โโ Specs: RTX 4060, i7
โโ Budget: โน100,000
โโ Site: amazon.in
๐ Opening Amazon.in...
โโ โ
Page loaded
๐ Searching: "gaming laptop RTX 4060 i7"...
โโ โ
Search results loaded
๐ฐ Applying price filter: โน70,000 - โน100,000...
โโ โ
Filter applied
๐ Analyzing 24 products...
โโ Filtering by specs: RTX 4060, i7
โโ Found 8 matching products
๐ Top Results:
1. ASUS TUF Gaming F15 - โน94,990 โญ 4.3
2. Acer Nitro V Gaming - โน89,990 โญ 4.1
3. HP Victus Gaming - โน87,990 โญ 4.2
โ
Task completed successfully!
# Run all tests
pytest
# Run adversarial tests (edge cases)
pytest tests/test_adversarial.py -v
# Run with coverage
pytest --cov=src --cov-report=htmlThe agent is tested against 29+ adversarial scenarios:
- โ Typo handling ("headpones" โ "headphones")
- โ Paraphrase robustness ("Show me" vs "Find" vs "Search for")
- โ Budget parsing ("50k", "1 lakh", "โน50000")
- โ Site extraction from context
- โ Non-product query detection
- โ Substring matching bugs ("watching" โ "watch")
subaru-ai/
โโโ src/
โ โโโ agents/
โ โ โโโ enhanced_unified_orchestrator.py # Main agent orchestrator
โ โ โโโ intelligent_reasoning.py # NLU & intent analysis
โ โ โโโ commands.py # Action definitions
โ โโโ executors/
โ โ โโโ playwright_runner.py # Browser automation
โ โ โโโ dynamic_action_executor.py # Action execution
โ โ โโโ chromeprofile.py # Persistent login manager
โ โโโ nlu/
โ โ โโโ enhanced_llm_client.py # Gemini/Groq clients
โ โ โโโ intent_schema.json # Intent validation schema
โ โโโ perception/
โ โ โโโ ner.py # Named entity recognition
โ โโโ ui/
โ โ โโโ app.py # Streamlit interface
โ โโโ api/
โ โโโ server.py # FastAPI backend
โโโ configs/
โ โโโ sites/ # Site-specific selectors
โโโ tests/
โ โโโ test_adversarial.py # Edge case tests
โ โโโ integration/ # Integration tests
โโโ requirements.txt
โโโ README.md
- Vision Integration: Screenshot analysis for dynamic sites
- Voice Commands: Speech-to-text input
- Multi-Agent: Parallel site searching
- Price Tracking: Historical price monitoring
- Smart Recommendations: ML-based product suggestions
Contributions are welcome! Please read our contributing guidelines and submit PRs.
MIT License - see LICENSE for details.
Built with โค๏ธ for the future of Agentic AI
โญ Star this repo if you find it useful!