Live Demo: pricewise-ai-shop.vercel.app
An AI-powered shopping assistant that searches for products, compares prices across retailers, analyzes reviews, and calculates totals — all through a conversational interface with human-in-the-loop approval.
- Product Search — Finds products matching your criteria using real-time web search via Tavily
- Price Comparison — Compares prices across multiple retailers to surface the best deals
- Review Analysis — Fetches and summarizes product reviews and ratings
- Budget Calculator — Computes totals with tax and checks against your budget
- Human-in-the-Loop — Every tool call requires your approval before execution, keeping you in control
- Structured Output — Returns a clean receipt with product name, price, rating, price range, and purchase reasoning
- Conversation Summarization — Automatically compresses long conversations to maintain context without hitting token limits
- Web Interface — Chat-based UI built with Next.js for an accessible, real-time experience
┌─────────────┐ SSE ┌──────────────┐ LangGraph ┌────────────┐
│ Next.js │◄────────────►│ FastAPI │◄──────────────►│ AI Agent │
│ Frontend │ │ Backend │ │ (gpt-4o) │
└─────────────┘ └──────────────┘ └──────┬─────┘
│
┌─────────────────┼─────────────────┐
│ │ │
┌──────▼───┐ ┌───────▼──┐ ┌─────────▼──┐
│ Tavily │ │ Budget │ │ Summarize │
│ Search │ │ Calc │ │ Middleware │
└──────────┘ └──────────┘ └────────────┘
The agent is built with LangGraph's create_react_agent and orchestrates ten tools:
| Tool | Description | Approval |
|---|---|---|
search_product |
Searches for products via Tavily web search | Required |
compare_prices |
Compares prices across multiple retailers | Required |
get_reviews |
Fetches product reviews and ratings | Required |
scrape_url |
Extracts content from a specific product URL | Required |
find_coupons |
Searches for coupons and deals | Required |
check_availability |
Checks stock availability across retailers | Required |
delegate_research |
Fans out parallel searches across product categories | Required |
calculate_budget |
Computes totals with tax and validates against budget | Auto |
add_to_wishlist |
Saves a product to the session wishlist | Auto |
get_wishlist |
Retrieves the current wishlist | Auto |
A pre-model summarization hook compresses conversation history when it exceeds a configurable threshold. Tools making external API calls require human-in-the-loop approval; pure-computation tools auto-execute.
Backend: Python 3.12+, LangGraph, LangChain, OpenAI (gpt-4o), Tavily, Pydantic v2, FastAPI, SSE, PostgreSQL Frontend: Next.js 16, TypeScript, React 19, Tailwind CSS Infrastructure: Railway (backend + Postgres), Vercel (frontend), Docker Tooling: uv (package manager), pytest
- Python 3.12+
- Node.js 18+
- uv package manager
- OpenAI API key
- Tavily API key
-
Clone the repository
git clone https://github.com/kimyungju/Pricewise.git cd Pricewise -
Set up environment variables
cp .env.example .env
Edit
.envand add your API keys:OPENAI_API_KEY=sk-your-key-here TAVILY_API_KEY=tvly-your-key-here -
Install backend dependencies
uv sync
-
Install frontend dependencies
cd web && npm install
Start both servers in separate terminals:
# Terminal 1 — Backend
uv run uvicorn pricewise.api.app:create_app --factory --reload --port 8000
# Terminal 2 — Frontend
cd web && npm run devOpen http://localhost:3000 and start chatting.
uv run python main.pyThe CLI runs a demo query and prompts for tool approval at each step.
uv run pytest -v| Service | Platform | URL |
|---|---|---|
| Frontend | Vercel | pricewise-ai-shop.vercel.app |
| Backend | Railway | pricewise-production-5bc0.up.railway.app |
The frontend calls the backend directly via NEXT_PUBLIC_API_URL. In local dev, Next.js rewrites proxy /api/* to localhost:8000. CORS origins are configured per environment via ALLOWED_ORIGINS on Railway.