🚀 Socket Launch Week Day 4:Socket MCP Adds Org Alerts, Threat Feed Review, and Package Inspection.Learn more
Sign In

ai-dom-agent

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ai-dom-agent

Framework-agnostic AI DOM agent widget and SDK

latest
Source
npmnpm
Version
1.1.1
Version published
Weekly downloads
13
-7.14%
Maintainers
1
Weekly downloads
 
Created
Source

ai-dom-agent (Frontend)

Frontend package for AI DOM Agent.
Provides a floating widget that lets users control the DOM with natural language.

Why do I need the backend?

The frontend widget does not contain AI models.
When you enter a command, the widget captures the current page’s HTML and sends it to the backend (ai-dom-agent-backend).
The backend uses an AI provider (OpenAI by default, or DeepSeek/Ollama if configured) to parse the command + HTML and return structured JSON actions (click, fill, scroll, etc.).
The widget then executes these actions on the page.

👉 Without the backend running, the widget cannot generate or run commands.

Install

npm install ai-dom-agent

Usage

React

import { initAgentWidget } from 'ai-dom-agent';

useEffect(() => {
  initAgentWidget({ backendUrl: 'http://localhost:4000' });
}, []);

Vue

import { initAgentWidget } from 'ai-dom-agent';

initAgentWidget({ backendUrl: 'http://localhost:4000' });

Plain HTML

<script type="module">
  import { initAgentWidget } from 'ai-dom-agent';
  initAgentWidget({ backendUrl: 'http://localhost:4000' });
</script>

Config

initAgentWidget(options)

  • backendUrl — required (default: http://localhost:4000)
  • buttonLabel — optional, floating button text
  • defaultCommand — optional, prefill input

Backend Setup (Required)

Install the backend package:

npm install ai-dom-agent-backend

Create a .env file in the backend project:

OPENAI_API_KEY=your_api_key_here
PORT=4000

Run the backend:

npm run dev

Now the frontend widget can connect to it at http://localhost:4000.

Build

npm run build

Keywords

ai

FAQs

Package last updated on 05 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts