AutoCart is an intelligent automation system that navigates e-commerce websites and automatically adds products to your shopping cart based on your specifications. Using advanced AI reasoning and browser automation, AutoCart can understand shopping intent, plan execution strategies, and safely interact with various e-commerce platforms.
- ๐ค Intelligent Shopping Agent: Multi-stage AI reasoning pipeline for optimal shopping strategies
- ๐ Universal Site Support: Works with any e-commerce website without hardcoded site-specific logic
- ๐ฏ Smart Product Search: Automatically finds products based on name, price, quantity, and rating constraints
- ๐ก๏ธ Safety-First Design: Built-in safeguards prevent unintended checkout or payment actions
- ๐ฑ Modern Web Interface: Clean, responsive UI built with Next.js and Tailwind CSS
- โก Real-time Execution: Live status updates and task monitoring
- ๐ Secure Credentials: Vault system for storing login credentials when needed
AutoCart.mp4
- Modern React application with TypeScript
- Tailwind CSS for responsive styling
- Real-time task execution monitoring
- Intuitive product specification interface
- RESTful API with asyncio support
- LangGraph for AI workflow orchestration
- Browser automation using Playwright
- Multi-model LLM support (GPT-4, custom models)
The core AI agent operates through a sophisticated pipeline:
- Intent Analysis - Understands shopping goals and constraints
- Strategy Building - Plans navigation approach for the target website
- Product Planning - Creates specific action plans for each product
- Safety Evaluation - Identifies potential risks and failure modes
- Task Synthesis - Generates executable browser automation instructions
- Python 3.11+
- Node.js 18+
- Google Chrome browser
- OpenAI API key
-
Clone the repository
git clone <repository-url> cd AutoCart
-
Backend Setup
cd backend pip install -e .
-
Frontend Setup
cd frontend npm install -
Environment Configuration
Create a
.envfile in the backend directory:OPENAI_API_KEY=your_openai_api_key_here
-
Install Playwright Browsers
playwright install chromium
-
Start the Backend
cd backend uvicorn main:app --reloadBackend will be available at
http://localhost:8000 -
Start the Frontend
cd frontend npm run devFrontend will be available at
http://localhost:3000
-
Open the application in your browser at
http://localhost:3000 -
Enter your shopping request:
- Website: The e-commerce site you want to shop on (e.g.,
amazon.com) - Products: Add products with specifications:
- Product name (required)
- Maximum price (optional)
- Quantity (default: 1)
- Minimum rating (optional)
- Website: The e-commerce site you want to shop on (e.g.,
-
Execute the task and monitor real-time progress
-
Review results - The AI agent will add qualifying products to your cart and stop before checkout
{
"website": "amazon.com",
"products": [
{
"name": "Wireless Bluetooth Headphones",
"max_price": 100,
"quantity": 1,
"rating": "4+"
},
{
"name": "USB-C Cable",
"max_price": 15,
"quantity": 2
}
]
}The system supports multiple LLM providers:
# LangChain models for planning
llm_graph = LangChainChatOpenAI(model="gpt-4o-mini", temperature=0)
# Browser automation models
llm_browser = ChatBrowserUse(model="bu-2-0") # Custom browser-optimized model
# llm_browser = BrowserChatOpenAI(model="gpt-4o-mini") # AlternativeUpdate vault.py to add site-specific credentials:
VAULT = {
"amazon.com": {
"username": "your_username",
"password": "your_password"
},
"target.com": {
"username": "another_username",
"password": "another_password"
}
}Customize browser behavior in graph.py:
browser = Browser(
executable_path="/path/to/chrome", # Chrome executable path
user_data_dir="./chrome-profile", # Profile directory
headless=False, # Set to True for headless mode
keep_alive=True # Keep browser open after tasks
)AutoCart includes several built-in safety mechanisms:
- Checkout Prevention: Never proceeds to checkout or payment pages
- Price Verification: Double-checks prices before adding items
- Quantity Limits: Respects specified quantity constraints
- CAPTCHA Detection: Gracefully handles anti-bot measures
- Session Management: Maintains secure browsing sessions
- Error Recovery: Robust error handling and recovery mechanisms
AutoCart/
โโโ backend/
โ โโโ main.py # FastAPI application entry point
โ โโโ vault.py # Credential storage
โ โโโ pyproject.toml # Python dependencies
โ โโโ agent/
โ โโโ graph.py # AI agent workflow and browser automation
โ โโโ schema.py # Pydantic models and data structures
โโโ frontend/
โ โโโ app/
โ โ โโโ page.tsx # Main shopping interface
โ โ โโโ layout.tsx # App layout and styling
โ โ โโโ globals.css # Global styles
โ โโโ services/
โ โ โโโ api.ts # API client and types
โ โโโ package.json # Node.js dependencies
โ โโโ next.config.ts # Next.js configuration
โโโ README.md
Execute a shopping task with the AI agent.
Request Body:
{
"website": "string",
"products": [
{
"name": "string",
"max_price": "number (optional)",
"quantity": "number",
"rating": "string (optional)"
}
]
}Response:
{
"task_prompt": "string",
"execution_status": "started"
}# Backend tests
cd backend
python -m pytest
# Frontend tests
cd frontend
npm test# Python linting
cd backend
black . && isort . && flake8
# TypeScript/React linting
cd frontend
npm run lintAutoCart is designed for educational and personal use. Please:
- Use responsibly and respect website terms of service
- Do not use for unauthorized or malicious activities
- Test thoroughly before relying on automated purchases
- Keep credentials secure and use at your own risk
- LangChain for AI workflow orchestration
- Browser-Use for intelligent browser automation
- FastAPI for the robust backend framework
- Next.js for the modern frontend framework
- Playwright for reliable browser automation