Skip to content
Back to skills

Web Agent Reward Model

ASecurity

Create principle-guided reward models for web automation agents that evaluate reasoning process quality rather than just outcomes. Implement domain-specific principles (HTML understanding, interaction patterns, state tracking) to guide agent behavior in web navigation and task completion.

  • 6 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 9, 2026
toolspythongoapi

Works with

  • cli
  • api

Security analysis

A100/100

Scanned September 9, 2026

npx -y skills add ADu2021/skillXiv --skill web-agent-reward-model --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Web Agent Reward Model?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Web Agent Reward Model
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/adu2021-web-agent-reward-model/badge)](https://www.skillsdirectory.com/skills/adu2021-web-agent-reward-model)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: web-agent-reward-model
title: "WebArbiter: A Principle-Guided Reasoning Process Reward Model for Web Agents"
version: 0.0.2
engine: skillxiv-v0.0.2-claude-opus-4.6
license: MIT
url: "https://arxiv.org/abs/2601.21872"
keywords: [web-agents, reward-model, process-evaluation, reasoning-guidance, principle-based]
description: "Create principle-guided reward models for web automation agents that evaluate reasoning process quality rather than just outcomes. Implement domain-specific principles (HTML understanding, interaction patterns, state tracking) to guide agent behavior in web navigation and task completion."
---

## Problem

Web automation agents struggle with task completion because they rely on sparse outcome rewards. Intermediate steps in web navigation (finding elements, understanding page structure, planning interaction sequences) are difficult to evaluate, leading to poor exploration and inefficient trajectories.

## Solution

Build a principle-guided reward model that evaluates web agent reasoning using domain-specific principles. Rather than just rating success or failure, score intermediate reasoning quality based on:

- **Interaction Principles**: Validity and appropriateness of DOM interactions
- **Navigation Reasoning**: Sound logic in page traversal decisions
- **Goal Alignment**: Trajectory steps align with intended task objective
- **Information Extraction**: Correct parsing and use of page content

## When to Use

- Training agents for web navigation, form filling, or automated browsing
- When agents make systematic navigation errors despite correct high-level goals
- For improving agent sample efficiency in web automation tasks
- When you need interpretable feedback on agent reasoning quality

## When NOT to Use

- API-based automation (doesn't require HTML/DOM reasoning)
- Simple single-page interactions
- Environments where outcome rewards are dense and frequent

## Implementation

### Step 1: Define Principle-Based Scoring Framework

Establish the core evaluation principles for web agent reasoning.

```python
class WebPrincipleEvaluator:
    """Evaluate agent reasoning against web domain principles"""

    def __init__(self):
        self.principles = [
            "interaction_validity",
            "page_understanding",
            "goal_alignment",
            "state_consistency"
        ]

    def evaluate_step(self, state, action, html_context):
        """Score a single agent step against principles"""
        scores = {
            "valid_interaction": self.check_interaction_validity(action, html_context),
            "semantic_understanding": self.check_page_understanding(action, state),
            "goal_directed": self.check_goal_alignment(action, state),
            "state_consistent": self.check_state_consistency(state, action)
        }
        return scores
```

### Step 2: Implement HTML-Aware Validation

Create validators for DOM interactions and page understanding.

```python
def check_interaction_validity(action, html_doc):
    """
    Validate that action targets exist and are interactable.
    action: {"type": "click"|"type"|..., "target": selector}
    html_doc: parsed HTML tree
    """
    target = find_element(html_doc, action["target"])

    if target is None:
        return {"valid": False, "reason": "element_not_found"}

    if action["type"] == "click" and not is_clickable(target):
        return {"valid": False, "reason": "element_not_clickable"}

    if action["type"] == "type" and not is_text_input(target):
        return {"valid": False, "reason": "element_not_text_input"}

    return {"valid": True, "confidence": 1.0}

def check_page_understanding(action, current_state):
    """
    Verify agent understood page context when choosing action.
    current_state: agent's internal state/memory
    """
    understood = {
        "has_page_title": bool(current_state.get("page_title")),
        "has_form_fields": len(current_state.get("form_fields", [])) > 0,
        "tracked_links": len(current_state.get("visible_links", [])) > 0,
    }

    return sum(understood.values()) / len(understood)
```

### Step 3: Build Trajectory-Level Reward Computation

Evaluate entire trajectories using the principle scores.

```python
def score_trajectory(trajectory, goal_description, html_snapshots):
    """
    Compute principle-guided reward for entire trajectory.
    trajectory: list of (state, action, result) tuples
    """
    step_scores = []

    for i, (state, action, result) in enumerate(trajectory):
        html = html_snapshots[i]

        step_score = {
            "interaction_quality": check_interaction_validity(action, html),
            "understanding_quality": check_page_understanding(action, state),
            "alignment_with_goal": check_goal_alignment(action, goal_description, state),
            "state_tracking": check_state_consistency(state, action)
        }

        step_scores.append(step_score)

    # Aggregate: penalize invalid interactions, reward goal-aligned steps
    trajectory_reward = aggregate_principle_scores(
        step_scores,
        weights={
            "interaction": 0.3,
            "understanding": 0.25,
            "alignment": 0.35,
            "consistency": 0.1
        }
    )

    return trajectory_reward, step_scores
```

### Step 4: Integration with Agent Training

Use principle-guided rewards to update agent policy.

```python
def compute_reinforcement_signal(trajectory, outcome_reward, principle_scores, alpha=0.4):
    """
    Combine outcome reward with principle-based process reward.
    alpha: weight for process reward vs outcome (0.4 = 40% process, 60% outcome)
    """
    principle_reward = principle_scores["trajectory_reward"]

    # Blend signals: prioritize outcome but use principles for refinement
    blended_reward = (
        (1 - alpha) * outcome_reward +
        alpha * principle_reward
    )

    return blended_reward
```

### Step 5: Implement Reasoning Trace Logging

Capture and explain agent decisions for better interpretability.

```python
def log_reasoning_trace(trajectory, principle_evaluations):
    """
    Create interpretable trace of agent's reasoning with principle evaluations
    """
    trace = {
        "steps": [],
        "principle_violations": [],
        "successful_patterns": []
    }

    for i, evals in enumerate(principle_evaluations):
        step_trace = {
            "step_num": i,
            "principle_scores": evals,
            "reasoning_quality": sum(evals.values()) / len(evals),
        }

        # Track violations for learning
        for principle, score in evals.items():
            if score < 0.5:
                trace["principle_violations"].append({
                    "step": i,
                    "principle": principle,
                    "severity": 1 - score
                })

        trace["steps"].append(step_trace)

    return trace
```

## Key Design Patterns

- **Domain-Specific Principles**: Focus on HTML/DOM understanding, interaction validity, and goal alignment
- **Process + Outcome**: Blend sparse outcome rewards with dense principle-based signals
- **Interpretable Feedback**: Maintain trace of reasoning violations for analysis and improvement
- **Gradient for RL**: Use principle scores as differentiable or semi-differentiable rewards for gradient-based agent training

## Applications

- Web form automation systems
- Research agent training
- UI automation frameworks
- Bot detection and prevention (adverse principle violations indicate bot-like behavior)

## References

- arXiv:2601.21872: WebArbiter principle-guided framework
- Designed for evaluation of web navigation reasoning quality

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.