๐ŸŒ Playwright Browser Automation

SLM Web Agent

Autonomous browser navigation agent powered by Playwright and local small language models for headless form filling and data extraction.

๐Ÿš€ Overview & Capabilities

Autonomous browser navigation agent powered by Playwright and local small language models for headless form filling and data extraction.

Key Features

  • Headless browser interaction via Playwright
  • Automated form navigation and locator selection
  • DOM snapshot reduction for small model context windows
  • Zero external API calls

๐Ÿ’ป Installation

Install the local package using pip:

Terminal
$pip install slm-web-agent

๐Ÿ™ Checkout from GitHub

Clone only this agent's folder from the monorepo using Git sparse-checkout โ€” no need to download the full repository:

Option 1 โ€” Sparse Checkout (Recommended)

Terminal โ€” Git Sparse Checkout
# 1. Create and enter a new directory
$ mkdir slm_web_agent && cd slm_web_agent

# 2. Initialise empty git repo and add remote
$ git init
$ git remote add origin https://github.com/t00114218-stack/SLMAgents.git

# 3. Enable sparse-checkout and set target folder
$ git sparse-checkout init --cone
$ git sparse-checkout set slm_web_agent

# 4. Pull only that agent's source
$ git pull origin main

Option 2 โ€” Full Repository Clone

Terminal โ€” Full Clone
$ git clone https://github.com/t00114218-stack/SLMAgents.git
$ cd SLMAgents/slm_web_agent

๐Ÿ’ก Tip: After checkout, install the package locally with pip install -e ./slm_web_agent to run in editable mode without publishing to PyPI.

โš™๏ธ Configuration API

Constructor Parameters

Instantiate SLMWebAgent with performance and runtime options:

ParameterType / DefaultDescription
headlessbool | TrueRun browser in headless background mode. Default: True.
temperaturefloat | 0.0Action planning temperature. Default: 0.0.
top_pfloat | 0.9Nucleus sampling cutoff. Default: 0.9.
max_tokensint | 256Max token output limit. Default: 256.
n_threadsint | 4CPU threads for model execution. Default: 4.

Methods

Method SignatureReturn TypeDescription
browse(goal, start_url, ...)dictExecutes multi-step Playwright web browsing tasks autonomously.

Execution Parameters

Complete list of execution parameters accepted by the primary agent method:

ParameterType / DefaultDescription
goalstrTarget browser automation goal description.
start_urlstrInitial Web URL to navigate to.
system_promptstr | NoneCustom system instruction prompt override. Default: None.
user_inputstr | NoneOptional additional user form fill values. Default: None.
temperaturefloat | 0.0Sampling temperature. Default: 0.0.
top_pfloat | 0.9Nucleus sampling probability. Default: 0.9.
max_tokensint | 256Maximum token limit. Default: 256.

Quick Start

Python Example
from slm_web_agent import SLMWebAgent

web = SLMWebAgent(headless=True, n_threads=4)
res = web.browse(
    goal="Navigate to portal signup and enter test email",
    start_url="https://portal.slmagents.ai/signup",
    system_prompt="Wait 2 seconds after submit",
    user_input="Email: dev@slmagents.ai",
    temperature=0.0,
    top_p=0.9,
    max_tokens=256
)
print(res)

๐Ÿ” Verified Output Logs

Diagnostic execution console output running locally on CPU:

Output Console
โ†’ INPUT:
Goal: Navigate to portal signup and enter test email
URL: https://portal.slmagents.ai/signup

โ† OUTPUT:
{
  'status': '200 OK',
  'goal': 'Navigate to portal signup and enter test email',
  'success': True,
  'steps_taken': 3
}