ProductLens — Interactive Demo
ProductLens is a lightweight Gradio demo that helps you compare consumer products/services based on your priorities (privacy, price, ease of setup, etc.). It runs a simple agent pipeline:
- Planner → identifies products + evaluation criteria + search queries
- Research → performs web searches and summarizes findings
- Comparator → ranks options and produces a recommendation + comparison table
Architecture
User query → Planner Agent → Search Agent(s) (parallel) → Comparator Agent → UI
planner_agent.py: turns your query into a structured plan (ProductPlan)search_agent.py: calls aweb_searchtool and summarizes resultscomparator_agent.py: synthesizes a decision + markdown tablecomparison_manager.py: orchestrates the workflowload_vars.py: centralized provider/model configuration
+----------------------------------------------------------------------------------+
| Hugging Face Space / Docker |
| |
| +---------------------------+ |
| | Gradio UI (7860) | |
| | - Textbox + Examples | |
| | - Streams status output | |
| +-------------+-------------+ |
| | user query |
| v |
| +---------------------------+ +---------------------------------------+ |
| | COMPARISON MANAGER | | Env Config | |
| | - trace_id + orchestration|<------| PROVIDER + MODEL + KEYS + N settings | |
| | - async generator output | +---------------------------------------+ |
| +-------------+-------------+ |
| | |
| | (1) PLAN: ProductPlan (JSON schema) |
| v |
| +---------------------------+ |
| | PLANNER AGENT | |
| | - pick N products | |
| | - derive criteria | |
| | - generate searches | |
| +-------------+-------------+ |
| | Runner.run() |
| v |
| +---------------------------+ |
| | LLM PROVIDER ROUTER | |
| | OpenAI / OpenRouter / | |
| | Ollama (ChatCompletions) | |
| +---------------------------+ |
| | |
| | (2) RESEARCH: parallel per-product |
| v |
| +-----------------------------------------+ |
| | Async Task Fan-out (asyncio.gather) | |
| | - one task per product | |
| +-------------------+---------------------+ |
| | |
| +-----------+---------------+-----------------------+---- ... |
| | | | |
| v v v |
| +--------------------+ +--------------------+ |
| | SEARCH AGENT | | SEARCH AGENT | ... |
| | tool_choice=req'd | | tool_choice=req'd | |
| +---------+----------+ +---------+----------+ |
| | tool call | tool call |
| v v |
| +-------------+ +-------------+ |
| | web_search | | web_search | (function_tool) |
| | (Ollama API)| | (Ollama API)| |
| +------+------+ +------+------+ |
| | | |
| v v |
| +-------------+ +-------------+ |
| | Web results | | Web results | |
| +------+------+ +------+------+ |
| | summary | summary |
| +-----------+----------+ |
| v |
| +---------------------------+ |
| | research_results[] | |
| | "product: summary" | |
| +-------------+-------------+ |
| | |
| | (3) COMPARE: decision + table |
| v |
| +---------------------------+ |
| | COMPARATOR AGENT | |
| | - normalize differences | |
| | - rank options | |
| | - output markdown table | |
| +-------------+-------------+ |
| | Runner.run() |
| v |
| +---------------------------+ |
| | Final Output -> Gradio UI | |
| | - Recommendation | |
| | - Comparison Table | |
| +---------------------------+ |
| |
+----------------------------------------------------------------------------------+
Notes
- Providers/models are selected via PROVIDER and *_MODEL env vars.
- If you use free-tier OpenRouter models, you may hit rate limits or temporary throttling.
- Increasing
NUM_OF_PRODUCTS(default=2) andNUM_OF_SEARCHES(default=1) increases cost/latency and may exceed small context windows.
Usage
Try prompts like:
- “Best noise-canceling headphones for travel and calls”
- “Privacy-focused smart doorbells”
- “Robot vacuum for pet hair, quiet, easy maintenance”
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support