# π‘οΈ 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.







---
> π¬ *"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.*