# πŸ›‘οΈ Aegis-Agent ### *Browse with a privacy firewall.* **A browser assistant that never lets your sensitive data leave your computer** β€” faces are blurred, passwords and personal info are blacked out *before* anything is sent to the AI, and the AI (Qwen3-VL) runs on your own server. ![Chrome](https://img.shields.io/badge/Chrome-MV3%20Extension-4285F4?logo=googlechrome&logoColor=white) ![React](https://img.shields.io/badge/React-18-61DAFB?logo=react&logoColor=black) ![TypeScript](https://img.shields.io/badge/TypeScript-strict-3178C6?logo=typescript&logoColor=white) ![FastAPI](https://img.shields.io/badge/FastAPI-0.115-009688?logo=fastapi&logoColor=white) ![Ollama](https://img.shields.io/badge/Ollama-Qwen3--VL-white?logo=ollama&logoColor=black) ![ONNX](https://img.shields.io/badge/ONNX%20Runtime-BlazeFace-7C3AED) ![License](https://img.shields.io/badge/license-Apache--2.0-green)
--- > πŸ’¬ *"Find the contact email on this page."* > > The agent looks at the page β€” but every face is already blurred, every password field and email is already a black box. The AI only ever sees the sanitized version, plans the next click, and your browser performs it locally. **Your pixels never leave your device unredacted.** Built for **Smart India Hackathon 2026 β€” Problem Statement 26171** *(On-device Visual Perception for Light-weight Browser Agents, ISRO / Smart Automation)*. --- ## 🧠 How it works ```mermaid flowchart TB U([πŸ§‘ You]) -->|"a task, e.g. find the email"| SP subgraph A["πŸ’» Laptop A β€” the extension (this folder: client/)"] SP[πŸͺŸ Side Panel
React UI] --> SW[βš™οΈ Service Worker
agent loop] SW --> PF[πŸ›‘οΈ Privacy Firewall] PF --> M1[1️⃣ DOM masks
passwords Β· cards Β· PII text] PF --> M2[2️⃣ Screenshot] PF --> M3[3️⃣ BlazeFace face blur
ONNX Runtime Β· runs in the worker] M3 -->|sanitized only| GW SW -->|actions: click Β· type Β· scroll| PAGE[🌐 the web page] end subgraph B["πŸ–₯️ Laptop B β€” the brain (this folder: server/)"] GW[πŸšͺ FastAPI Gateway
:8000] --> OL[πŸ¦™ Ollama] OL --> Q[Qwen3-VL 2B / 4B
the single brain] end GW -->|"plan / next action (JSON)"| SW ``` **The flow, in plain words:** 1. You type a task in the side panel. 2. Before *anything* is sent anywhere, the privacy firewall runs **on your laptop**: it covers password/payment fields and personal info (emails, phone numbers) with black boxes in the page, takes the screenshot, then **blurs every detected face** with an on-device AI model (BlazeFace). 3. Only the sanitized screenshot + a stripped-down text map of the page go to your FastAPI server over the LAN. 4. **Qwen3-VL** (the only AI model in the system) looks at the sanitized page and replies with the next action β€” "click element 12", "scroll down", "done". 5. Your browser performs the action locally, re-observes the page (sanitized again), and the loop continues until the task is done. If the face model can't load, visual tasks **refuse to run** rather than sending an unredacted screenshot β€” privacy fails closed, never open. ## ✨ Highlights | | Feature | What it means | |---|---|---| | πŸ›‘οΈ | **Privacy firewall before every request** | DOM-level masks (passwords, cards, emails, phones) + on-device face detection with 18px blur β€” applied to *every* screenshot, not just the preview | | 🧠 | **One brain** | Qwen3-VL is the only planning/reasoning model. Planner / Navigator / Validator are prompt roles of that one model β€” no model zoo, no confusion | | πŸ”’ | **Fail-closed egress** | Missing face model? Visual data is refused, never sent raw. Text is scrubbed (`[REDACTED_EMAIL]`, `[REDACTED_PHONE]`, `[REDACTED_PAYMENT]`) | | ⚑ | **Inference inside the service worker** | ONNX Runtime Web runs BlazeFace directly in the Chrome MV3 service worker (WASM backend) β€” no extra processes, no server round-trip for privacy | | πŸ” | **Model test matrix** | Qwen3-VL 2B/4B (local, primary) plus qwen3.5 2B/4B and Ollama-cloud models for A/B testing β€” switch with one env var | | πŸ–₯️ | **Two-laptop demo** | Everything sensitive stays on Laptop A; the heavy model runs on Laptop B over LAN/Ethernet/hotspot | | πŸŽ›οΈ | **Firewall master switch** | One click on the `firewall: active` chip toggles sanitization off for trusted work (raw context to the gateway) and back on β€” persisted, live-synced, off-state is loud and obvious | | 🎨 | **Two-mood UI** | Terminal-dark theme with a WebGL FaultyTerminal hero, or a paper/sticker light theme β€” same panel, two personalities | ## πŸ“ Project structure ``` Aegis-Agent/ β”‚ β”œβ”€β”€ πŸ–₯️ client/ # the Chrome extension (Laptop A) β”‚ β”œβ”€β”€ chrome-extension/ # MV3 service worker β€” agents + privacy firewall β”‚ β”‚ └── src/background/ β”‚ β”‚ β”œβ”€β”€ agent/ # Planner Β· Navigator Β· Validator (one model, three roles) β”‚ β”‚ β”œβ”€β”€ browser/ # puppeteer/CDP action execution β”‚ β”‚ └── sih/ # πŸ›‘οΈ privacy: DOM masks, BlazeFace, sanitizer, gateway client β”‚ β”œβ”€β”€ pages/ β”‚ β”‚ β”œβ”€β”€ side-panel/ # the chat UI (React + Tailwind) β”‚ β”‚ └── options/ # settings UI β”‚ └── packages/ # shared storage, UI, i18n (pnpm monorepo) β”‚ └── βš™οΈ server/ # the brain (Laptop B) β”œβ”€β”€ backend/ β”‚ β”œβ”€β”€ app.py # FastAPI gateway β€” OpenAI-compatible API over Ollama β”‚ β”œβ”€β”€ smoke_test.py # health/models/chat checks β”‚ └── requirements.txt β”œβ”€β”€ client_context.md # πŸ“œ the full client↔server contract (read this!) └── project_context.md # πŸ“œ problem statement, architecture, decisions ``` ## πŸš€ Quick start You need **two machines on the same network** (or run both on one machine for testing β€” then use `127.0.0.1` everywhere). ### Prerequisites - **Laptop A (client):** Node 18+, pnpm, Google Chrome - **Laptop B (server):** Python 3.11+, [Ollama](https://ollama.com) ### 1 Β· Server (Laptop B) β€” the brain ```bash git clone https://github.com/lukan-lawslaf/Aegis-Agent.git cd Aegis-Agent/server # get the models ollama pull qwen3-vl:4b # the default brain ollama pull qwen3-vl:2b # faster option # optional test models: # ollama signin # ollama pull qwen3-vl:235b-cloud # ollama pull gemma4:31b-cloud # start the gateway cd backend python -m venv .venv .venv\Scripts\activate # Windows (macOS/Linux: source .venv/bin/activate) pip install -r requirements.txt copy ..\.env.example .env # macOS/Linux: cp python -m uvicorn app:app --host 0.0.0.0 --port 8000 # verify python smoke_test.py ``` > 🌐 Allow **TCP port 8000** through the server's firewall, and note the server's > LAN IP (`ipconfig`). Cloud models (`*-cloud`) need `ollama signin` and bill > through your Ollama account β€” they're for testing only. ### 2 Β· Client (Laptop A) β€” the extension ```bash cd Aegis-Agent/client # point it at your server (edit .env after copying the example) copy .env.sih.example .env # then edit: VITE_SIH_FASTAPI_URL=http://:8000/v1 pnpm install pnpm build ``` Then load it in Chrome: 1. Open `chrome://extensions` 2. Turn on **Developer mode** (top right) 3. **Load unpacked** β†’ select the `client/dist` folder ### 3 Β· Use it 1. Click the Aegis-Agent icon β†’ the side panel opens 2. Open βš™οΈ settings β†’ **ping** β†’ should say *gateway responding* 3. Open any webpage with faces or a login form β†’ **Privacy Preview β†’ capture active tab** β†’ see faces blurred and sensitive fields blacked out β€” this is exactly what the AI will see 4. Type a task: *"find the contact email on this page"* and watch the plan β†’ act β†’ validate loop ### πŸ” Useful endpoints (server) | Endpoint | What it does | |---|---| | `GET /health` | Liveness + which models are allowed + is Ollama up | | `GET /v1/models` | OpenAI-style model list | | `POST /v1/chat/completions` | The agent's chat endpoint (streaming + images + JSON output) | ## πŸ€– Models | Model | Where | Role | |---|---|---| | `qwen3-vl:4b` | local (default) | the brain β€” vision + planning | | `qwen3-vl:2b` | local | faster brain | | `qwen3.5:2b` / `qwen3.5:4b` | local | test only β€” text-only, can't see screenshots | | `qwen3-vl:235b-cloud` | Ollama cloud | test only β€” quality reference | | `gemma4:31b-cloud` | Ollama cloud | test only | Switch the brain: set `VITE_SIH_QWEN_MODEL=` in `client/.env`, rebuild, reload the extension. The gateway's allow-list (`server/backend/.env`) decides which tags are accepted; set `ALLOW_ANY_MODEL=true` there for free-for-all testing. ## πŸ§ͺ Tests ```bash cd client pnpm -F chrome-extension test # privacy sanitizer + guardrail unit tests ``` ## πŸ“œ Docs - [`server/client_context.md`](server/client_context.md) β€” the full client↔server contract (API, payloads, privacy rules) - [`server/project_context.md`](server/project_context.md) β€” problem statement, architecture decisions, research - [`client/SIH_CLIENT.md`](client/SIH_CLIENT.md) β€” client-side implementation notes ---
**Built with React Β· Chrome MV3 Β· ONNX Runtime Web Β· FastAPI Β· Ollama β€” and a firm belief that privacy comes first** πŸ›‘οΈ *Your data stays on your device. The agent borrows only what you'd show a stranger.*