@raghav095/synapse-agent
v1.0.0
Published
Synapse Agent - Advanced Multi-LLM Web Automation CLI
Readme
Assignment 04 - Website Automation Agent
This project implements a small intelligent website automation agent with Playwright. It opens the shadcn React Hook Form docs page, detects the Name and Description form fields, and fills them automatically.
Features
- Modular browser tools:
open_browser,navigate_to_url,take_screenshot,click_on_screen,send_keys,scroll, anddouble_click - Intelligent field detection using labels, placeholders, and XPath fallbacks
- Page inspection logs that show what controls the agent considered
- Coordinate-based interaction for clicks, matching the assignment requirement
- Logging for every major action and decision
- Environment-based configuration
- Screenshots before and after automation
Setup
Install dependencies:
npm install
npx playwright install chromiumOptional configuration:
cp .env.example .envEdit .env if you want to change the target URL, browser mode, or form values.
Run
Run the agent using the default URL (configured in .env or defaulting to Shadcn):
npm startOr pass a custom URL directly through the terminal:
# Via npm (requires '--' before arguments)
npm start -- https://example.com
# Via node directly
node src/index.js https://example.comBy default the browser opens visibly (HEADLESS=false) so it can be demonstrated during viva. Screenshots are saved in the screenshots/ directory.
The visible demo intentionally runs slower than a pure automation script. It types with a delay and keeps the completed browser open for inspection, so the examiner can see the agent's work.
Scripts
npm start- run the automation agentnpm run demo- same as start, useful for viva demosnpm run check- validate JavaScript syntax
Configuration
The agent reads these environment variables:
TARGET_URL- page to automateFORM_NAME- text for the Name fieldFORM_DESCRIPTION- text for the Description fieldHEADLESS-trueorfalseBROWSER-chromium,firefox, orwebkitSLOW_MO- delay in milliseconds between Playwright actionsTYPE_DELAY_MS- delay between typed charactersDEMO_PAUSE_MS- how long to keep the completed visible browser openACTION_TIMEOUT_MS- action timeoutSCREENSHOT_DIR- screenshot output directory
Project Structure
src/
agent/
WebsiteAutomationAgent.js
tools/
BrowserTools.js
utils/
config.js
logger.js
index.js