# AccessLens 5.0A — Experimental reasoning browser agent

## Install

```bash
cd ~/Desktop/accesslens-5a
python3 -m pip install pypdf python-docx playwright
python3 -m playwright install chromium
export OPENAI_API_KEY='YOUR_KEY' # use your existing configured key instead when available
python3 server.py
```

Open http://127.0.0.1:8780/queue.html?v=5a . Select your resume and launch an eligible company website job.

## What is new

When `OPENAI_API_KEY` is set, the application queue launches a bounded model-guided Playwright agent. On each step it observes visible text and controls, asks the model for one action, validates the action against a restrictive policy, performs it, and re-observes the page. It handles consecutive Apply/Apply Now buttons, simple fields, resume uploads, new tabs, and cookie-consent pauses. It never submits an application, accepts cookie consent, signs in, or bypasses CAPTCHA/MFA. The candidate approves sensitive or unknown answers manually. When no API key is configured, the earlier rule-based worker remains available.

## Limitations and privacy

- This is a prototype, not a guarantee of autonomous completion on any employer portal. The model receives page text/control metadata and approved candidate profile through the OpenAI API. Avoid using it on pages containing sensitive secrets.
- The agent may pause early for review. It does not yet handle arbitrary dynamic dropdowns, complex multi-page validation, login, or third-party ATS domains not explicitly allowed by the existing domain policy.
- Job portals including LinkedIn and Naukri remain manual handoff.
- The model is constrained to click a small allowlist of Apply/Continue/Next labels, fill only exact approved profile values, or attach the approved resume. No submit action is available.
- API usage is billed by your OpenAI API account. Maximum 24 model decisions per run.
- This release uses page DOM text and controls for reasoning, **not screenshot vision**; visual reasoning can be added after the DOM-first workflow is validated.
- The existing server is for localhost use only; do not expose it to the internet.

## Test

Start with Applied Materials. The agent should handle the first Apply, then Apply Now, then reach the resume step. It may stop at a blocker and leave the browser open for review. The agent should not mark the job as submitted.
