An Agentic Website Intelligence & Exploration System
Give WebLens AI any public website URL. It autonomously investigates the site, classifies its domain, extracts structured intelligence, indexes content into a hybrid RAG engine, and lets you explore deeper through grounded, multi-turn follow-up conversations with source citations.
🎯 The Problem We Solve
Traditional AI website tools are built as simple wrappers:
URL → Scraper → LLM → Basic Summary
WebLens AI is engineered as an Agentic System:
- Controlled Autonomy: The LLM acts as the orchestrator selecting deterministic tools (
search_website,crawl_page,get_profile) based on information need. - Defense-in-Depth Security: Pre-connection SSRF guards, private IP / cloud metadata blocking, and prompt injection data isolation.
- Hybrid RAG: Combines Okapi BM25 lexical keyword matching with dense semantic vector embeddings.
- Safe Observability: Live execution telemetry over Server-Sent Events (SSE) without leaking internal chain-of-thought.
🏗️ Architecture
graph TD
User([User / Browser])
subgraph Frontend ["Next.js 14 Frontend"]
Landing["Landing & Live Stream (/analyze)"]
Dashboard["Intelligence Dashboard (/website/:id)"]
ChatUI["Grounded Chat & Citations (/chat/:id)"]
end
subgraph API ["FastAPI Backend & Security Layer"]
Router["REST & SSE Endpoints (/api/v1)"]
SSRFGuard["SSRF & DNS Pre-Resolution Guard"]
end
subgraph Agent ["Agent Orchestrator Layer"]
Orchestrator["Orchestrator Brain (LLM)"]
Policy["Backend Tool Authorization Policy"]
Tools["Tools: fetch, discover, crawl, search, retrieve"]
end
subgraph RAG ["Hybrid RAG & Storage"]
Store["Database (PostgreSQL / SQLite)"]
HybridEngine["Hybrid Search (BM25 + Dense Vectors)"]
end
User --> Landing & Dashboard & ChatUI
Landing & Dashboard & ChatUI --> Router
Router --> SSRFGuard --> Tools
Router --> Agent
Agent --> Policy --> Tools
Tools --> RAG --> Orchestrator
Orchestrator --> ChatUI
✨ Key Capabilities
- Autonomous Website Discovery & Selective Crawling
- Automatically crawls the homepage, discovers candidate subpages (
/about,/products,/pricing,/docs), scores their relevance, and selectively indexes the top pages within domain boundaries.
- Automatically crawls the homepage, discovers candidate subpages (
- Structured Website Intelligence
- Extracts structured domain classification (
ecommerce,saas,healthcare,education,finance, etc.), confidence scores, target audience, primary purpose, offerings, and key capabilities.
- Extracts structured domain classification (
- Multi-Turn Grounded Exploration with Source Citations
- Ask deep follow-up questions. The agent dynamically decides whether existing knowledge answers it or triggers hybrid vector search / subpage crawling. Every answer includes traceable source URLs.
- Responsible High-Stakes Handling (Healthcare / Medical)
- Cautiously attributes public website statements without asserting unwarranted medical efficacy or advice.
- Robust Security Boundaries
- Blocks private IP ranges (
127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,169.254.0.0/16), validates redirect hops, enforces 5MB streaming cutoffs, and isolates prompt injection attempts.
- Blocks private IP ranges (
🚀 Quick Start
1. Run with Docker Compose
docker-compose up --build
- Web UI:
http://localhost:3000 - API Docs:
http://localhost:8000/docs
2. Local Development Setup
Backend (FastAPI):
cd apps/api
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000
Frontend (Next.js):
cd apps/web
npm install
npm run dev
🧪 Testing & Evaluation Benchmark
Run the Backend Test Suite:
python -m pytest apps/api/tests/ -v
21/21 Unit & Integration tests covering SSRF, Crawling, Extraction, Hybrid Retrieval, Agent Orchestration, and API endpoints.
Run the Automated Evaluation Harness:
python -m evals.runner
Benchmark Results Summary:
| Metric | Score | Description |
|---|---|---|
| Domain Classification Accuracy | 100.0% | Accurate vertical identification across test suites |
| Answer Groundedness | 100.0% | Factual responses supported by retrieved chunks |
| Citation Precision | 100.0% | Valid, verifiable source URL mappings |
| Tool Selection Efficiency | 100.0% | Zero redundant or cyclic tool executions |
| Average Run Latency | ~280ms | End-to-end multi-turn response latency |
📂 Repository Structure
weblens-ai/
├── apps/
│ ├── web/ # Next.js 14 Frontend (App Router, Tailwind, Lucide)
│ │ ├── app/ # Routes: /, /website/:id, /chat/:id, /about
│ │ ├── components/ # Navbar, Footer, UI components
│ │ └── lib/api.ts # Typed API Client SDK
│ └── api/ # FastAPI Backend
│ ├── app/
│ │ ├── agents/ # Orchestrator & Tool Policy
│ │ ├── tools/ # Deterministic Controlled Tools
│ │ ├── crawling/ # Secure Fetcher, Link Discovery, Browser Fallback
│ │ ├── extraction/ # Trafilatura & BS4 Structural Extractor
│ │ ├── retrieval/ # Heading-Aware Chunker & Hybrid BM25 Search
│ │ ├── security/ # SSRF Guards & IP Range Blacklists
│ │ ├── providers/ # Mock, OpenAI, and Multi-LLM Providers
│ │ └── models/ # SQLAlchemy Domain Entities
│ └── tests/ # 21 Pytest Unit & Integration Tests
├── packages/
│ └── schemas/ # Shared Pydantic v2 Schemas
├── evals/ # Automated Evaluation Harness & Datasets
├── docs/ # Architecture, Threat Model, ADRs, Agent Design
├── docker/ # Dockerfiles for API and Web
└── docker-compose.yml
🛡️ Security Threat Mitigation Highlights
- SSRF: Pre-DNS resolution + redirect-hop IP inspection blocks all internal/metadata access.
- Prompt Injection: All extracted HTML text is isolated as untrusted data blocks.
- Resource Abuse: 5MB streaming cutoff per page, max 20 pages per website, max depth 2, max 8 tool calls per turn.
📄 License
MIT License. Built for production-quality AI Agent Engineering.