Views
No views yet
| Capability | Description |
|---|---|
| HTML Reading | Understands page structure — tables, nested divs, lists, forms, data attributes, malformed HTML |
| Action Sequencing | Decides what tools to call and in what order to get the data |
| Authentication | Handles login pages via cookie replay, form submission, token injection, or browser profiles |
| Error Recovery | When something breaks (403, timeout, CAPTCHA, rate limit), switches approach instead of failing |
User: "Extract product listings from example.com/shop"
↓
Model: <thought>Let me navigate there first.</thought>
ACTION: NAVIGATE {"url": "example.com/shop"}
↓
System: HTTP 200 OK. <html>...</html>
↓
Model: <thought>I see product cards. Let me extract the data.</thought>
ACTION: RETURN_RESULT {"status": "success", "data": [...]}success, partial, or failed — so the caller always knows where things stand.1from webscrape_agent import WebScrapeAgent
2
3agent = WebScrapeAgent("sukritvemula/WebScrapeAgent-7B-v1")
4
5result = agent.scrape(
6 url="https://example.com/products",
7 task="Extract all product names, prices, and ratings",
8 schema={
9 "type": "array",
10 "items": {
11 "type": "object",
12 "properties": {
13 "name": {"type": "string"},
14 "price": {"type": "string"},
15 "rating": {"type": "string"}
16 }
17 }
18 }
19)
20
21print(result.status) # "success" | "partial" | "failed"
22print(result.data) # Clean JSON data
23print(result.message) # Human-readable explanation1# Cookie-based auth
2result = agent.scrape(
3 url="https://dashboard.example.com/analytics",
4 task="Get my usage statistics",
5 auth={"method": "cookies", "cookies": {"session_id": "abc123"}}
6)
7
8# API token
9result = agent.scrape(
10 url="https://api.example.com/v2/data",
11 task="Get all user records",
12 auth={"method": "token", "token": "sk-xxx"}
13)python webscrape_agent.py "https://example.com/pricing" "Extract all pricing tiers with features"1import unsloth
2from unsloth import FastLanguageModel
3from unsloth.chat_templates import get_chat_template
4
5model, tokenizer = FastLanguageModel.from_pretrained(
6 "sukritvemula/WebScrapeAgent-7B-v1",
7 max_seq_length=4096,
8 load_in_4bit=True,
9)
10FastLanguageModel.for_inference(model)
11tokenizer = get_chat_template(tokenizer, chat_template="qwen-2.5")
12
13messages = [
14 {"role": "system", "content": "You are WebScrapeAgent..."},
15 {"role": "user", "content": "Task: Extract pricing data\nURL: https://example.com/pricing"},
16]
17
18inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to("cuda")
19outputs = model.generate(input_ids=inputs, max_new_tokens=1024, temperature=0.3)
20print(tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True))| Action | Purpose | Example Params |
|---|---|---|
NAVIGATE | Load a URL | {"url": "...", "method": "GET", "headers": {...}} |
CLICK | Click an element | {"selector": "#submit-btn"} |
FILL_FORM | Submit a form | {"selector": "#login", "fields": {"email": "...", "password": "..."}} |
WAIT | Wait for dynamic content | {"selector": ".results", "timeout_ms": 5000} |
SET_COOKIES | Inject auth cookies | {"cookies": {"session": "abc"}} |
SET_HEADERS | Set HTTP headers | {"headers": {"Authorization": "Bearer ..."}} |
LOAD_BROWSER_PROFILE | Use saved browser session | {"profile_name": "work-chrome"} |
EXECUTE_JS | Run JavaScript | {"script": "return document.querySelector('#app').innerHTML"} |
SCROLL | Scroll the page | {"direction": "down", "amount": 500} |
SWITCH_STRATEGY | Change approach on failure | {"new_strategy": "headless_browser", "reason": "403 blocked"} |
RETURN_RESULT | Return final data | {"status": "success", "data": [...], "message": "..."} |
| Paper | Key Contribution | Result |
|---|---|---|
| ScrapeGraphAI-100k | QLoRA + completion-only loss for HTML→JSON | Key F1 = 0.887 at 1.7B params |
| BrowserAgent | Multi-turn browser SFT on Qwen2.5-7B | +20% over baselines |
| A3-Annotators | Assistant-token-only loss + thought chains | 41.5% WebArena |
| Parameter | Value | Source |
|---|---|---|
| Base model | Qwen/Qwen2.5-7B-Instruct | — |
| Method | QLoRA (4-bit NF4) | ScrapeGraphAI |
| LoRA rank | 32 | Increased from paper's 16 for structured output complexity |
| LoRA alpha | 32 | Standard (= rank) |
| LoRA targets | All linear (q,k,v,o,gate,up,down) | ScrapeGraphAI + A3 |
| Learning rate | 1e-4 | ScrapeGraphAI |
| LR schedule | Cosine with 3% warmup | A3-Annotators |
| Optimizer | AdamW 8-bit | Unsloth best practice |
| Epochs | 2 | ScrapeGraphAI + BrowserAgent |
| Effective batch | 16 | — |
| Max seq length | 4096 | — |
| Loss | Completion-only (assistant tokens) | All three papers |
| Gradient checkpointing | Unsloth custom | — |
| Source | Count | % | What It Teaches |
|---|---|---|---|
| ScrapeGraphAI-100k | 25,244 | 55.3% | HTML→JSON extraction across real websites |
| BrowserAgent-Data | 20,361 | 44.6% | Multi-turn browser interaction and reasoning |
| Synthetic scenarios | 19 | 0.04% | Auth handling, error recovery, diverse HTML |
WebScrapeAgent_Training.ipynb in Google Colab with a T4 GPU runtime. Everything is set up — just run all cells.1pip install unsloth trl peft transformers accelerate datasets bitsandbytes
2
3# Train with defaults (pushes to Hub)
4python train.py
5
6# Custom settings
7python train.py \
8 --model unsloth/Qwen2.5-7B-Instruct-bnb-4bit \
9 --output your-username/WebScrapeAgent-7B-custom \
10 --epochs 3 \
11 --lr 5e-5 \
12 --lora-r 64 \
13 --batch-size 2 \
14 --grad-accum 8
15
16# Save locally only (no Hub push)
17python train.py --no-push --save-local ./my-modelActionExecutor class in webscrape_agent.py).| File | Purpose |
|---|---|
webscrape_agent.py | Runtime inference loop — Python API and CLI |
train.py | Standalone training script (CLI with args) |
WebScrapeAgent_Training.ipynb | Colab/Kaggle training notebook |
evaluate.py | Evaluation script testing all 4 core skills |
prepare_data.py | Dataset preparation pipeline (builds the training data) |