agentvision 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. agentvision-0.1.0/.github/workflows/ci.yml +45 -0
  2. agentvision-0.1.0/.gitignore +36 -0
  3. agentvision-0.1.0/CHANGELOG.md +27 -0
  4. agentvision-0.1.0/Dockerfile +21 -0
  5. agentvision-0.1.0/LICENSE +21 -0
  6. agentvision-0.1.0/PKG-INFO +199 -0
  7. agentvision-0.1.0/README.md +137 -0
  8. agentvision-0.1.0/docs/VISION.md +264 -0
  9. agentvision-0.1.0/docs/adapters.md +62 -0
  10. agentvision-0.1.0/docs/backends.md +54 -0
  11. agentvision-0.1.0/docs/integrations.md +32 -0
  12. agentvision-0.1.0/docs/quickstart.md +69 -0
  13. agentvision-0.1.0/docs/the-loop.md +61 -0
  14. agentvision-0.1.0/examples/broken_layout.fixed.html +34 -0
  15. agentvision-0.1.0/examples/broken_layout.html +34 -0
  16. agentvision-0.1.0/examples/contact_sheet.py +27 -0
  17. agentvision-0.1.0/examples/fix_loop.py +37 -0
  18. agentvision-0.1.0/integrations/agent-contract.md +23 -0
  19. agentvision-0.1.0/integrations/aider.md +28 -0
  20. agentvision-0.1.0/integrations/cursor.rules.md +38 -0
  21. agentvision-0.1.0/pyproject.toml +77 -0
  22. agentvision-0.1.0/skill/SKILL.md +63 -0
  23. agentvision-0.1.0/skill/scripts/see.sh +15 -0
  24. agentvision-0.1.0/src/agentvision/__init__.py +61 -0
  25. agentvision-0.1.0/src/agentvision/adapters/__init__.py +1 -0
  26. agentvision-0.1.0/src/agentvision/adapters/_demo_assets.py +35 -0
  27. agentvision-0.1.0/src/agentvision/adapters/cli.py +361 -0
  28. agentvision-0.1.0/src/agentvision/adapters/doctor.py +123 -0
  29. agentvision-0.1.0/src/agentvision/adapters/mcp_server.py +156 -0
  30. agentvision-0.1.0/src/agentvision/adapters/rest.py +174 -0
  31. agentvision-0.1.0/src/agentvision/backends/__init__.py +9 -0
  32. agentvision-0.1.0/src/agentvision/backends/_image.py +21 -0
  33. agentvision-0.1.0/src/agentvision/backends/anthropic_backend.py +94 -0
  34. agentvision-0.1.0/src/agentvision/backends/base.py +39 -0
  35. agentvision-0.1.0/src/agentvision/backends/gemini_backend.py +79 -0
  36. agentvision-0.1.0/src/agentvision/backends/local_backend.py +41 -0
  37. agentvision-0.1.0/src/agentvision/backends/openai_backend.py +78 -0
  38. agentvision-0.1.0/src/agentvision/backends/prompt.py +121 -0
  39. agentvision-0.1.0/src/agentvision/backends/registry.py +68 -0
  40. agentvision-0.1.0/src/agentvision/backends/schema_adapters.py +96 -0
  41. agentvision-0.1.0/src/agentvision/config.py +93 -0
  42. agentvision-0.1.0/src/agentvision/core/__init__.py +15 -0
  43. agentvision-0.1.0/src/agentvision/core/analyze.py +129 -0
  44. agentvision-0.1.0/src/agentvision/core/baseline.py +69 -0
  45. agentvision-0.1.0/src/agentvision/core/capture.py +62 -0
  46. agentvision-0.1.0/src/agentvision/core/checks/__init__.py +37 -0
  47. agentvision-0.1.0/src/agentvision/core/checks/contrast.py +37 -0
  48. agentvision-0.1.0/src/agentvision/core/checks/layout.py +96 -0
  49. agentvision-0.1.0/src/agentvision/core/diff.py +115 -0
  50. agentvision-0.1.0/src/agentvision/core/loop.py +132 -0
  51. agentvision-0.1.0/src/agentvision/core/render.py +49 -0
  52. agentvision-0.1.0/src/agentvision/errors.py +52 -0
  53. agentvision-0.1.0/src/agentvision/logging.py +47 -0
  54. agentvision-0.1.0/src/agentvision/models/__init__.py +19 -0
  55. agentvision-0.1.0/src/agentvision/models/diff.py +26 -0
  56. agentvision-0.1.0/src/agentvision/models/geometry.py +42 -0
  57. agentvision-0.1.0/src/agentvision/models/report.py +140 -0
  58. agentvision-0.1.0/src/agentvision/ocr/__init__.py +12 -0
  59. agentvision-0.1.0/src/agentvision/ocr/base.py +27 -0
  60. agentvision-0.1.0/src/agentvision/ocr/tesseract.py +60 -0
  61. agentvision-0.1.0/src/agentvision/renderers/__init__.py +31 -0
  62. agentvision-0.1.0/src/agentvision/renderers/_extract_js.py +107 -0
  63. agentvision-0.1.0/src/agentvision/renderers/base.py +87 -0
  64. agentvision-0.1.0/src/agentvision/renderers/image_renderer.py +42 -0
  65. agentvision-0.1.0/src/agentvision/renderers/pdf_renderer.py +51 -0
  66. agentvision-0.1.0/src/agentvision/renderers/playwright_renderer.py +257 -0
  67. agentvision-0.1.0/src/agentvision/sources.py +143 -0
  68. agentvision-0.1.0/src/agentvision/workspace.py +127 -0
  69. agentvision-0.1.0/tests/integration/test_render_loop.py +71 -0
  70. agentvision-0.1.0/tests/unit/test_local_backend.py +37 -0
  71. agentvision-0.1.0/tests/unit/test_models.py +51 -0
  72. agentvision-0.1.0/tests/unit/test_schema_adapters.py +41 -0
  73. agentvision-0.1.0/tests/unit/test_sources.py +47 -0
  74. agentvision-0.1.0/tests/unit/test_workspace.py +34 -0
@@ -0,0 +1,45 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest # --with-deps works on Ubuntu runners
11
+ strategy:
12
+ matrix:
13
+ python-version: ["3.11", "3.12"]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: ${{ matrix.python-version }}
20
+
21
+ - name: Install package (extras pinned via the lockfile)
22
+ run: |
23
+ python -m pip install --upgrade pip
24
+ pip install -e ".[all,dev]"
25
+
26
+ - name: Install system deps for OCR/PDF
27
+ run: sudo apt-get update && sudo apt-get install -y tesseract-ocr tesseract-ocr-eng poppler-utils
28
+
29
+ - name: Install Chromium (browser pinned by the playwright package version)
30
+ run: python -m playwright install --with-deps chromium
31
+
32
+ - name: Lint
33
+ run: ruff check src tests
34
+
35
+ - name: Type check
36
+ run: mypy src || true # advisory in v1
37
+
38
+ - name: Test
39
+ env:
40
+ # Deterministic rendering: animations off / fixed scale handled in code.
41
+ AGENTVISION_LOG_LEVEL: ERROR
42
+ run: pytest -q
43
+
44
+ - name: Smoke (no-key demo path)
45
+ run: agentvision check examples/broken_layout.html --json || true
@@ -0,0 +1,36 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .eggs/
6
+ build/
7
+ dist/
8
+ *.so
9
+
10
+ # Virtual envs
11
+ .venv/
12
+ venv/
13
+ env/
14
+
15
+ # Tooling
16
+ .pytest_cache/
17
+ .mypy_cache/
18
+ .ruff_cache/
19
+ .coverage
20
+ htmlcov/
21
+ uv.lock
22
+
23
+ # AgentVision runtime
24
+ .agentvision/
25
+ *.agentvision-cache/
26
+
27
+ # OS / editor
28
+ .DS_Store
29
+ *.swp
30
+ .idea/
31
+ .vscode/
32
+
33
+ # Secrets
34
+ .env
35
+ .env.*
36
+ !.env.example
@@ -0,0 +1,27 @@
1
+ # Changelog
2
+
3
+ All notable changes to AgentVision are documented here.
4
+
5
+ ## [0.1.0] — 2026-06-18
6
+
7
+ Initial release — "Eyes for AI Agents".
8
+
9
+ ### Added
10
+ - **Core engine** (async): `render`, `analyze`, `check`, `diff`, `contact_sheet`,
11
+ baselines/`regress`, and the `LoopSession` visual feedback loop.
12
+ - **Trustworthy grounding**: DOM geometry, computed-style WCAG contrast (with a
13
+ `confidence` flag), broken-image + console/network/4xx capture, and a blank-render
14
+ check. Coordinates normalized to image pixels (scroll-offset aware).
15
+ - **Renderers**: async Playwright (HTML/URL/SVG) with SSRF + `file://` guards and a hard
16
+ render timeout; PDF (pdf2image) and image renderers.
17
+ - **Vision backends**: `local` (offline, no key), `anthropic` (default), `openai`,
18
+ `gemini`, behind one pluggable interface with per-provider schema adapters and explicit
19
+ fallback semantics.
20
+ - **OCR**: Tesseract backend (text + word boxes).
21
+ - **Adapters**: CLI (`agentvision`), MCP server (`agentvision-mcp`), REST service
22
+ (`agentvision-serve`), a Claude Code Skill, and integration recipes (Cursor, Aider,
23
+ generic agent contract).
24
+ - **Loop semantics**: progress/stuck detection by issue-set stability (not SSIM).
25
+ - `agentvision doctor` (real Chromium launch + `ldd` missing-lib enumeration) and a
26
+ zero-key `agentvision demo`.
27
+ - Docs, examples, Dockerfile, and CI.
@@ -0,0 +1,21 @@
1
+ # AgentVision — reliable headless rendering with Chromium deps baked in.
2
+ # Build: docker build -t agentvision .
3
+ # Run: docker run --rm -e ANTHROPIC_API_KEY -v "$PWD:/work" agentvision demo
4
+ FROM mcr.microsoft.com/playwright/python:v1.49.0-jammy
5
+
6
+ WORKDIR /app
7
+
8
+ # System deps for OCR + PDF (Chromium + its libs already ship in the base image).
9
+ RUN apt-get update && apt-get install -y --no-install-recommends \
10
+ tesseract-ocr tesseract-ocr-eng poppler-utils \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ COPY pyproject.toml README.md ./
14
+ COPY src ./src
15
+ COPY examples ./examples
16
+
17
+ RUN pip install --no-cache-dir ".[all]"
18
+
19
+ WORKDIR /work
20
+ ENTRYPOINT ["agentvision"]
21
+ CMD ["doctor"]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AMIT SAMSON PATOLE
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,199 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentvision
3
+ Version: 0.1.0
4
+ Summary: Eyes for AI Agents — a machine-graded visual feedback loop coding agents consume to self-correct before claiming done.
5
+ Project-URL: Homepage, https://github.com/amitpatole/agent-vision
6
+ Project-URL: Repository, https://github.com/amitpatole/agent-vision
7
+ Project-URL: Issues, https://github.com/amitpatole/agent-vision/issues
8
+ Author-email: Amit Patole <amit.patole@gmail.com>
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: agents,ai,llm,mcp,screenshot,ui-testing,vision,visual
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Software Development :: Quality Assurance
18
+ Classifier: Topic :: Software Development :: Testing
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: filelock>=3.13
21
+ Requires-Dist: numpy>=1.26
22
+ Requires-Dist: pillow>=10.0
23
+ Requires-Dist: platformdirs>=4.0
24
+ Requires-Dist: pydantic-settings>=2.2
25
+ Requires-Dist: pydantic>=2.6
26
+ Requires-Dist: scikit-image>=0.22
27
+ Requires-Dist: typer>=0.12
28
+ Provides-Extra: all
29
+ Requires-Dist: anthropic>=0.40; extra == 'all'
30
+ Requires-Dist: fastapi>=0.110; extra == 'all'
31
+ Requires-Dist: google-genai>=0.3; extra == 'all'
32
+ Requires-Dist: mcp>=1.2; extra == 'all'
33
+ Requires-Dist: openai>=1.40; extra == 'all'
34
+ Requires-Dist: pdf2image>=1.17; extra == 'all'
35
+ Requires-Dist: playwright>=1.44; extra == 'all'
36
+ Requires-Dist: pytesseract>=0.3.10; extra == 'all'
37
+ Requires-Dist: python-multipart>=0.0.9; extra == 'all'
38
+ Requires-Dist: uvicorn[standard]>=0.29; extra == 'all'
39
+ Provides-Extra: anthropic
40
+ Requires-Dist: anthropic>=0.40; extra == 'anthropic'
41
+ Provides-Extra: dev
42
+ Requires-Dist: mypy>=1.10; extra == 'dev'
43
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
44
+ Requires-Dist: pytest>=8.0; extra == 'dev'
45
+ Requires-Dist: ruff>=0.5; extra == 'dev'
46
+ Provides-Extra: gemini
47
+ Requires-Dist: google-genai>=0.3; extra == 'gemini'
48
+ Provides-Extra: mcp
49
+ Requires-Dist: mcp>=1.2; extra == 'mcp'
50
+ Provides-Extra: ocr
51
+ Requires-Dist: pytesseract>=0.3.10; extra == 'ocr'
52
+ Provides-Extra: openai
53
+ Requires-Dist: openai>=1.40; extra == 'openai'
54
+ Provides-Extra: render
55
+ Requires-Dist: pdf2image>=1.17; extra == 'render'
56
+ Requires-Dist: playwright>=1.44; extra == 'render'
57
+ Provides-Extra: serve
58
+ Requires-Dist: fastapi>=0.110; extra == 'serve'
59
+ Requires-Dist: python-multipart>=0.0.9; extra == 'serve'
60
+ Requires-Dist: uvicorn[standard]>=0.29; extra == 'serve'
61
+ Description-Content-Type: text/markdown
62
+
63
+ # AgentVision — Eyes for AI Agents 👁️
64
+
65
+ > Coding agents are **blind**. They write a UI, a chart, an SVG, a PDF — and never *see*
66
+ > the rendered result. They reason from source code and stdout, then declare success while
67
+ > the button overflows, the legend is clipped, the contrast fails, or an image 404s.
68
+ > **AgentVision gives agents eyes.**
69
+
70
+ AgentVision is a provider-agnostic framework that closes the visual feedback loop for AI
71
+ coding agents:
72
+
73
+ ```
74
+ render → perceive → report → (agent fixes) → re-render → diff
75
+ ```
76
+
77
+ It is **not** human-reviewed visual regression (Percy/Applitools/Argos) and **not** browser
78
+ automation (browser-use/Playwright). It is a **machine-graded visual critique loop an agent
79
+ consumes to self-correct before claiming done** — with a verdict (`pass`/`warn`/`fail`) and
80
+ actionable, coordinate-grounded issues.
81
+
82
+ ## The 60-second pitch
83
+
84
+ ```bash
85
+ pip install "agentvision[render]"
86
+ playwright install chromium # see `agentvision doctor` if Chromium won't launch
87
+ agentvision demo # no API key required
88
+ ```
89
+
90
+ `agentvision demo` renders a deliberately broken page, prints a **FAIL** report (overflow +
91
+ low-contrast + a 404 image — all DOM/CV-grounded, no LLM key needed), then loops against the
92
+ fixed version and prints *"what changed: 3 issues resolved → PASS."* That command *is* the
93
+ product.
94
+
95
+ ## What makes it trustworthy
96
+
97
+ Findings are grounded in sources we can actually trust:
98
+
99
+ - **DOM geometry** (`getBoundingClientRect` + scroll offset) — precise element boxes.
100
+ - **Computed-style contrast** (`getComputedStyle`) — real WCAG ratios, with a `confidence`
101
+ flag (it degrades honestly over gradients/images/pseudo-elements rather than lying).
102
+ - **OCR word boxes** (Tesseract) — precise text locations.
103
+ - **Console / network / 4xx capture** — the #1 "looks fine in code, broken live" cause.
104
+
105
+ A vision LLM (Claude/OpenAI/Gemini) adds semantic critique on top. Its pixel boxes are
106
+ treated as **advisory** (`bbox_precise: false`), never marketed as pixel-accurate.
107
+
108
+ ## Many faces, one core
109
+
110
+ | Surface | Who it's for |
111
+ |---|---|
112
+ | **Library** (`import agentvision`) | Python apps, custom harnesses |
113
+ | **CLI** (`agentvision …`) | Any agent that can run a shell command; CI |
114
+ | **Claude Code Skill** | Claude agents — auto-invokes the loop *before claiming done* |
115
+ | **MCP server** (`agentvision-mcp`) | Cursor, Claude, any MCP-capable host |
116
+ | **REST service** (`agentvision-serve`) | Non-MCP / networked / CI agents |
117
+ | **Integration recipes** | Cursor rules, Aider, generic "agent contract" |
118
+
119
+ > ⚠️ "Provider-agnostic" describes the **API surface**, not behavior. The framework can't
120
+ > *force* a non-Claude agent into the loop — it gives every agent the *means*. The Claude
121
+ > Code Skill is the one surface that makes an agent use it proactively; MCP is the
122
+ > first-class cross-host path; the recipes cover the rest.
123
+
124
+ ## Vision backends
125
+
126
+ Pluggable and selectable via `--backend` / `AGENTVISION_VISION_BACKEND`:
127
+
128
+ - **`anthropic`** (default model `claude-haiku-4-5`, upgradable to Sonnet/Opus)
129
+ - **`openai`**, **`gemini`**
130
+ - **`local`** — CV/OCR heuristics only, **no API key, no egress** (great for CI / air-gapped)
131
+
132
+ ## Install
133
+
134
+ ```bash
135
+ pip install "agentvision[all]" # everything
136
+ pip install "agentvision[render]" # just rendering + the no-key local loop
137
+ pip install "agentvision[render,anthropic]" # + Claude analysis
138
+ ```
139
+
140
+ System dependencies (Chromium, Tesseract, poppler) and a `doctor` that checks them:
141
+
142
+ ```bash
143
+ agentvision doctor # attempts a real Chromium launch; lists every missing lib
144
+ agentvision doctor --fix # installs the Chromium browser binary
145
+ ```
146
+
147
+ On a bare RHEL/CentOS box, `playwright install-deps` does **not** work (apt-only). See
148
+ [docs/quickstart.md](docs/quickstart.md) for the `dnf` line, or use the bundled
149
+ **Dockerfile** which bakes the deps in.
150
+
151
+ ## Usage
152
+
153
+ ```bash
154
+ # Analyze a file/URL/HTML string and print a structured report
155
+ agentvision analyze ./index.html --backend local --json
156
+
157
+ # Run the self-correcting loop
158
+ agentvision loop ./dashboard.html --max-iter 3
159
+
160
+ # Responsive contact sheet across breakpoints
161
+ agentvision sheet ./index.html --breakpoints 375,768,1280,1920
162
+
163
+ # Visual regression against a named baseline
164
+ agentvision baseline ./index.html --name home
165
+ agentvision regress ./index.html --name home
166
+ ```
167
+
168
+ Library:
169
+
170
+ ```python
171
+ import asyncio
172
+ from agentvision import load_settings
173
+ from agentvision.core.loop import LoopSession
174
+
175
+ async def main():
176
+ settings = load_settings(vision_backend="local")
177
+ session = LoopSession("examples/broken_layout.html", settings=settings)
178
+ result = await session.iterate()
179
+ print(result.report.verdict, [i.message for i in result.report.issues])
180
+
181
+ asyncio.run(main())
182
+ ```
183
+
184
+ ## Documentation
185
+
186
+ - [Quickstart](docs/quickstart.md) · [The Loop](docs/the-loop.md) ·
187
+ [Backends](docs/backends.md) · [Adapters](docs/adapters.md) ·
188
+ [Integrations](docs/integrations.md) · [Vision](docs/VISION.md)
189
+
190
+ ## What we do **not** claim (honesty)
191
+
192
+ - Pixel-accurate *vision-model* bounding boxes (they're advisory).
193
+ - WCAG verdicts on rasterized non-HTML (heuristic only).
194
+ - Bit-reproducible screenshots / deterministic LLM reports.
195
+ - Uniform provider-agnostic *behavior* (only the API surface is uniform).
196
+
197
+ ## License
198
+
199
+ MIT © Amit Patole
@@ -0,0 +1,137 @@
1
+ # AgentVision — Eyes for AI Agents 👁️
2
+
3
+ > Coding agents are **blind**. They write a UI, a chart, an SVG, a PDF — and never *see*
4
+ > the rendered result. They reason from source code and stdout, then declare success while
5
+ > the button overflows, the legend is clipped, the contrast fails, or an image 404s.
6
+ > **AgentVision gives agents eyes.**
7
+
8
+ AgentVision is a provider-agnostic framework that closes the visual feedback loop for AI
9
+ coding agents:
10
+
11
+ ```
12
+ render → perceive → report → (agent fixes) → re-render → diff
13
+ ```
14
+
15
+ It is **not** human-reviewed visual regression (Percy/Applitools/Argos) and **not** browser
16
+ automation (browser-use/Playwright). It is a **machine-graded visual critique loop an agent
17
+ consumes to self-correct before claiming done** — with a verdict (`pass`/`warn`/`fail`) and
18
+ actionable, coordinate-grounded issues.
19
+
20
+ ## The 60-second pitch
21
+
22
+ ```bash
23
+ pip install "agentvision[render]"
24
+ playwright install chromium # see `agentvision doctor` if Chromium won't launch
25
+ agentvision demo # no API key required
26
+ ```
27
+
28
+ `agentvision demo` renders a deliberately broken page, prints a **FAIL** report (overflow +
29
+ low-contrast + a 404 image — all DOM/CV-grounded, no LLM key needed), then loops against the
30
+ fixed version and prints *"what changed: 3 issues resolved → PASS."* That command *is* the
31
+ product.
32
+
33
+ ## What makes it trustworthy
34
+
35
+ Findings are grounded in sources we can actually trust:
36
+
37
+ - **DOM geometry** (`getBoundingClientRect` + scroll offset) — precise element boxes.
38
+ - **Computed-style contrast** (`getComputedStyle`) — real WCAG ratios, with a `confidence`
39
+ flag (it degrades honestly over gradients/images/pseudo-elements rather than lying).
40
+ - **OCR word boxes** (Tesseract) — precise text locations.
41
+ - **Console / network / 4xx capture** — the #1 "looks fine in code, broken live" cause.
42
+
43
+ A vision LLM (Claude/OpenAI/Gemini) adds semantic critique on top. Its pixel boxes are
44
+ treated as **advisory** (`bbox_precise: false`), never marketed as pixel-accurate.
45
+
46
+ ## Many faces, one core
47
+
48
+ | Surface | Who it's for |
49
+ |---|---|
50
+ | **Library** (`import agentvision`) | Python apps, custom harnesses |
51
+ | **CLI** (`agentvision …`) | Any agent that can run a shell command; CI |
52
+ | **Claude Code Skill** | Claude agents — auto-invokes the loop *before claiming done* |
53
+ | **MCP server** (`agentvision-mcp`) | Cursor, Claude, any MCP-capable host |
54
+ | **REST service** (`agentvision-serve`) | Non-MCP / networked / CI agents |
55
+ | **Integration recipes** | Cursor rules, Aider, generic "agent contract" |
56
+
57
+ > ⚠️ "Provider-agnostic" describes the **API surface**, not behavior. The framework can't
58
+ > *force* a non-Claude agent into the loop — it gives every agent the *means*. The Claude
59
+ > Code Skill is the one surface that makes an agent use it proactively; MCP is the
60
+ > first-class cross-host path; the recipes cover the rest.
61
+
62
+ ## Vision backends
63
+
64
+ Pluggable and selectable via `--backend` / `AGENTVISION_VISION_BACKEND`:
65
+
66
+ - **`anthropic`** (default model `claude-haiku-4-5`, upgradable to Sonnet/Opus)
67
+ - **`openai`**, **`gemini`**
68
+ - **`local`** — CV/OCR heuristics only, **no API key, no egress** (great for CI / air-gapped)
69
+
70
+ ## Install
71
+
72
+ ```bash
73
+ pip install "agentvision[all]" # everything
74
+ pip install "agentvision[render]" # just rendering + the no-key local loop
75
+ pip install "agentvision[render,anthropic]" # + Claude analysis
76
+ ```
77
+
78
+ System dependencies (Chromium, Tesseract, poppler) and a `doctor` that checks them:
79
+
80
+ ```bash
81
+ agentvision doctor # attempts a real Chromium launch; lists every missing lib
82
+ agentvision doctor --fix # installs the Chromium browser binary
83
+ ```
84
+
85
+ On a bare RHEL/CentOS box, `playwright install-deps` does **not** work (apt-only). See
86
+ [docs/quickstart.md](docs/quickstart.md) for the `dnf` line, or use the bundled
87
+ **Dockerfile** which bakes the deps in.
88
+
89
+ ## Usage
90
+
91
+ ```bash
92
+ # Analyze a file/URL/HTML string and print a structured report
93
+ agentvision analyze ./index.html --backend local --json
94
+
95
+ # Run the self-correcting loop
96
+ agentvision loop ./dashboard.html --max-iter 3
97
+
98
+ # Responsive contact sheet across breakpoints
99
+ agentvision sheet ./index.html --breakpoints 375,768,1280,1920
100
+
101
+ # Visual regression against a named baseline
102
+ agentvision baseline ./index.html --name home
103
+ agentvision regress ./index.html --name home
104
+ ```
105
+
106
+ Library:
107
+
108
+ ```python
109
+ import asyncio
110
+ from agentvision import load_settings
111
+ from agentvision.core.loop import LoopSession
112
+
113
+ async def main():
114
+ settings = load_settings(vision_backend="local")
115
+ session = LoopSession("examples/broken_layout.html", settings=settings)
116
+ result = await session.iterate()
117
+ print(result.report.verdict, [i.message for i in result.report.issues])
118
+
119
+ asyncio.run(main())
120
+ ```
121
+
122
+ ## Documentation
123
+
124
+ - [Quickstart](docs/quickstart.md) · [The Loop](docs/the-loop.md) ·
125
+ [Backends](docs/backends.md) · [Adapters](docs/adapters.md) ·
126
+ [Integrations](docs/integrations.md) · [Vision](docs/VISION.md)
127
+
128
+ ## What we do **not** claim (honesty)
129
+
130
+ - Pixel-accurate *vision-model* bounding boxes (they're advisory).
131
+ - WCAG verdicts on rasterized non-HTML (heuristic only).
132
+ - Bit-reproducible screenshots / deterministic LLM reports.
133
+ - Uniform provider-agnostic *behavior* (only the API surface is uniform).
134
+
135
+ ## License
136
+
137
+ MIT © Amit Patole