Agentic React ·
How we halved the tokens an agent needs to find React source
Agents usually start a UI change from a screenshot, then spend tokens reading pixels and searching the repository. React already knows which component rendered each element and where that component lives. Our idea was to hand that knowledge to the agent directly. Agentic React lets you select an element in the browser and copy its component, stable selector, source file and line, owner trace and nearby code, so the agent starts at the right line.

Working principle
On three source-location tasks, Agentic React context used 180,302 tokens where screenshots used 388,694. That is 53.6% fewer tokens, 21.8% less runtime and 66.1% lower API-equivalent cost, with the correct source found every time.
The pain: a screenshot shows what, never where
A screenshot shows how the page looks. It does not say which component rendered it or which file holds that component. The agent spends tokens describing the image, then more tokens searching the repository for the text it saw, and it needs a model that reads images.
How Agentic React works
Agentic React has a bundler-agnostic core with adapters for Vite, Webpack and Next.js. In local dev you select one element or many, and Agentic React copies text or JSON for each. The dev server also serves the same context to agents as local MCP tools at /mcp. The context is plain text, so any model can use it.
The tuning modal turns choices such as a new text color or font into written instructions, each placed next to the file and line the agent should edit.
Copied context for one element
<web_context type="react_component_location">
component: ProfileField
tuning prompts:
- Change <ProfileField> in src/components/UserProfile/ProfileField.jsx:19 text color to rgb(15, 118, 110).
selector: #profile-field-email
source: src/components/UserProfile/ProfileField.jsx:19
source trace:
-> <ProfileField> at src/components/UserProfile/ProfileField.jsx:19
-> <ProfileContent> at src/components/UserProfile/ProfileContent.jsx:54
</web_context>Vite setup
pnpm install @agentic-react/vite -D
// vite.config.ts
import { defineConfig } from 'vite'
import AgenticReact from '@agentic-react/vite'
export default defineConfig({ plugins: [AgenticReact()] })The benchmark
We gave a coding agent the same read-only task six times: find the smallest source region that renders a given UI target and return compact JSON. Three UI areas each ran once with a cropped screenshot and once with pasted Agentic React context. The agent was gpt-5.4 at low reasoning effort in codex-cli 0.143.0, recorded on 2026-07-28.
Cost is API-equivalent at $2.50 per million uncached input tokens, $0.25 per million cached input tokens and $15.00 per million output tokens. The raw manifest and full method are public.
| UI area | Input | Input tokens | Cached input | Output | Total | Tokens saved | Cost | Cost saved |
|---|---|---|---|---|---|---|---|---|
| Issue row | Screenshot | 138,501 | 96,256 | 830 | 139,331 | baseline | $0.1421265 | baseline |
| Issue row | Agentic React context | 56,429 | 38,016 | 560 | 56,989 | 59.0981% | $0.0639365 | 55.0144% |
| Issue detail | Screenshot | 128,166 | 96,128 | 970 | 129,136 | baseline | $0.1186770 | baseline |
| Issue detail | Agentic React context | 50,852 | 48,768 | 521 | 51,373 | 60.2179% | $0.0252170 | 78.7516% |
| Live analytics | Screenshot | 119,162 | 91,008 | 1,065 | 120,227 | baseline | $0.1091120 | baseline |
| Live analytics | Agentic React context | 71,174 | 68,096 | 766 | 71,940 | 40.1632% | $0.0362090 | 66.8148% |
| Aggregate | Screenshot | 385,829 | 283,392 | 2,865 | 388,694 | baseline | $0.3699155 | baseline |
| Aggregate | Agentic React context | 178,455 | 154,880 | 1,847 | 180,302 | 53.6134% | $0.1253625 | 66.1105% |
Where it stands
The packages are on npm under @agentic-react: core, vite, webpack and next. vertile.ai uses @agentic-react/next in its own development.
We built a larger benchmark on eight open-source React apps pinned to fixed commits, covering the major bundlers and React frameworks: Vite with TanStack Router, webpack 5, Rsbuild, Next.js on Turbopack and on webpack, TanStack Start, Astro with React islands, and React Router v7 with Express. The tasks run on Harbor.
Agentic React and agentic-node split the work. agentic-node folds what Node prints: builds, dev servers and test runs. Agentic React owns what the browser shows: the UI itself, hydration errors and console output. Together they cover what an agent reads while it works on a React app.
What's next
Next, Agentic React will digest browser output, such as hydration errors and console floods, into the few lines an agent needs, next to the component and source line that caused them.
Then we run agents on the eight-app benchmark with and without Agentic React and report task success, output tokens and rounds.
Add @agentic-react/vite, @agentic-react/webpack or @agentic-react/next to your dev dependencies, select an element, and paste its context into your agent.