Other Supported Agents
Relevant source files
The following files were used as context for generating this wiki page:
React Grab extends its core functionality of context gathering by directly integrating with various AI coding agents. This allows developers to select a UI element, describe a change, and have an agent execute the code modification directly, all without leaving the browser. This is accomplished through a system of "agent providers," which are small, open-source adapters that connect React Grab to an agent's CLI or API.
This system transforms React Grab from a context-copying utility into an interactive development tool. It streamlines the frontend development workflow by eliminating the need to manually switch between the browser and the editor, copy-paste context, and describe the target location to the agent. Instead, the agent receives precise context and can begin work immediately.
Sources: packages/website/app/blog/agent/page.tsx:201-204, packages/website/app/blog/agent/page.tsx:714-722
Agent Integration Architecture
The integration architecture is based on a three-part system: the React Grab client running in the browser, a local server specific to the agent provider, and the agent's own CLI or SDK.
The general workflow is as follows:
- The user activates React Grab and selects an element on the page.
- The client script captures the React component tree, source file locations, and surrounding HTML, presenting a prompt input to the user.
- The user types a request (e.g., "make this button bigger") and submits it.
- The client sends the captured context and the user's prompt to a local server run by the agent provider.
- The local server formats the request and passes it to the corresponding agent's CLI or SDK (e.g.,
cursor-agent, Claude Agent SDK). - The agent processes the request, edits the codebase files directly, and streams status updates back to the local server.
- The local server forwards these status updates to the client, which displays them in the UI. Once complete, the app reloads to show the changes.
Sources: packages/website/app/blog/agent/page.tsx:227-236, packages/website/app/blog/agent/page.tsx:724-740
This diagram illustrates the sequence of interactions between the user, the React Grab client, the provider server, and the agent's backend.
Supported Agents Overview
React Grab supports a variety of coding agents through dedicated provider packages. Each provider runs a local server on a specific port to interface with the agent's tooling.
| Agent | Provider Package | Local Port | Interfaces With |
|---|---|---|---|
| Claude Code | @react-grab/claude-code | 4567 | Claude Agent SDK |
| Cursor | @react-grab/cursor | 5567 | cursor-agent CLI |
| OpenCode | @react-grab/opencode | 6567 | opencode CLI |
| Codex | @react-grab/codex | 7567 | OpenAI Codex SDK |
| Gemini | @react-grab/gemini | 8567 | Gemini CLI |
| Amp | @react-grab/amp | 9567 | Amp SDK |
| Factory Droid | @react-grab/droid | 10567 | Factory CLI |
| Visual Edit | visual-edit (via init) | N/A | OpenCode Zen (Grok) |
Sources: CONTRIBUTING.md:25-33, packages/website/app/blog/agent/page.tsx:313-695, packages/cli/src/commands/add.ts:25-33, packages/website/app/blog/visual-edit/page.tsx:210-218, README.md:104-298
Agent Configuration and Setup
Integration involves a server-side setup to run the agent provider and a client-side setup to load the necessary scripts in the browser during development.
Command-Line Installation
The recommended way to install and configure React Grab and its agent providers is through the CLI.
# At project root, this command detects the framework and injects the necessary scripts.
npx grab@latest init
During the init process, you can select which agent integration to add. You can also add or switch agents later.
# Add an agent to an existing React Grab installation
npx grab@latest add <agent_name>
The available agent names for the CLI are claude-code, cursor, opencode, codex, gemini, amp, and visual-edit.
Sources: packages/website/app/blog/agent/page.tsx:297-304, packages/cli/src/commands/init.ts:100-103, packages/cli/src/commands/add.ts:19-23
Manual Setup Examples
If manual setup is preferred, you must configure both the server and client.
Server Setup
Modify the dev script in your package.json to launch the agent provider's server alongside your application's development server.
Example for Cursor:
{
"scripts": {
"dev": "npx @react-grab/cursor@latest && next dev"
}
}
Sources: packages/website/app/blog/agent/page.tsx:411-417, README.md:161-167
Client Setup
Add the core react-grab script and the agent-specific client script to the <head> of your application's main HTML file. This should only be done in development mode.
Example for Cursor in a Next.js App Router project (app/layout.tsx):
import Script from "next/script";
export default function RootLayout({ children }) {
return (
<html>
<head>
{process.env.NODE_ENV === "development" && (
<>
<Script
src="//unpkg.com/react-grab/dist/index.global.js"
strategy="beforeInteractive"
/>
<Script
src="//unpkg.com/@react-grab/cursor/dist/client.global.js"
strategy="lazyOnload"
/>
</>
)}
</head>
<body>{children}</body>
</html>
);
}
Sources: packages/website/app/blog/agent/page.tsx:438-459, README.md:177-198
Command-Line Management
The grab CLI provides commands to manage agent integrations. The add command allows for adding new agents or replacing existing ones.
The logic for adding an agent is as follows:
- Check if
react-grabis already installed. If not, exit. - Check if the specified agent is already installed.
- If other agents are present, prompt the user to either replace the existing agent(s) or add the new one alongside them.
- If replacing, uninstall the old agent's package and remove its configuration from
package.jsonand the layout file. - Install the new agent's package.
- Apply transformations to
package.jsonto add thedevscript and to the layout file to add the client script.
Sources: packages/cli/src/commands/add.ts:40-202
This flowchart shows the decision process within the grab add command.
Future and Custom Agents
The agent provider system is designed to be extensible. All official providers are open-source and can be used as a template for integrating other tools that have a CLI or API. The project structure explicitly separates each provider into its own package, such as provider-cursor or provider-claude-code.
Additionally, a first-party agent named Ami is in development. It is being designed specifically for UI work and to integrate seamlessly with the context provided by React Grab, aiming to create a more specialized and efficient workflow.
Sources: packages/website/app/blog/agent/page.tsx:742-759, packages/website/app/blog/agent/page.tsx:772-784, CONTRIBUTING.md:25-33