👁️ Argos-Action v2.0: Small Language Model Policy & Deterministic MCP Safety Gateway for Computer Use

Dataset on HF Model on HF Space Playground Kaggle Eval Medium Article License Python

Argos-Action-1.5B is an open research prototype exploring how a compact 1.5B Small Language Model (Qwen/Qwen2.5-1.5B-Instruct + LoRA r=16, alpha=32) can serve as a single-turn UI action policy over Semantic Accessibility Trees (AXTree / Windows UIA), paired with a Deterministic Pre-Execution Model Context Protocol (MCP) Safety Gateway (SafetyPolicyEngine) for Defense-in-Depth.

📄 Deep-Dive Engineering Whitepaper: docs/ARCHITECTURE_AND_SAFETY_V2.md
📝 Part 1 Technical Post-Mortem (Medium): "Meu script disse 100%. Ele só tinha validado o gerador"
📊 Reproducible Holdout Benchmark (Kaggle): argos-holdout-v2-eval-of-a-1-5b-ui-action-model


🔬 Why Argos v2.0 Exists (From v1 Post-Mortem to Defense-in-Depth)

In our v1 post-mortem, evaluating the first LoRA adapter (rev 9081fe3) against 132 unique unseen holdout cards (holdout_v2.jsonl) revealed a critical architectural truth about small GUI policy models:

  • What Worked (Format Generalization): The 1.5B LoRA adapter achieved 121/132 (91.7%, Wilson 95% CI [0.857, 0.953]) strict schema conformance ({thought, tool_call, verification_predicate}), compared to 0/132 (0.0%) on the unadapted Qwen2.5-1.5B-Instruct base model (which emitted tool_call as a raw string).
  • What Failed in v1 (Tool Coverage & Safety Policy): Because the v1 training split lacked scroll and select_option examples, only trained press_hotkey on Ctrl+S, and only included 2 narrow escalate_human templates, the v1 adapter achieved 56/132 (42.4%) overall action-type accuracy and 0/28 escalation recall—executing destructive actions on 16/16 dangerous prompts (such as typing DELETE into prod-db-aurora).

How Argos v2.0 Solves Both Layers:

  1. Dataset v2.0 (generate_argos_dataset.py — 100% Unique, 0% Leakage, Full 6-Tool Balance):
    • 1,700 / 1,700 unique training samples (340 per domain) and 300 / 300 unique held-out test samples (60 per domain), with 0/300 overlap in inputs, goals, AXTrees, or element_ids.
    • Full representation of all 6 tools (click, type_text, select_option, scroll, press_hotkey, escalate_human) in both splits.
    • 12 distinct keyboard shortcuts for press_hotkey and 6 adversarial safety categories (340 train / 60 test) for escalate_human, including deceptive UIs with Edit "Type DELETE to confirm" and Button "Confirm Wipe".
  2. Assistant-Only Completion Loss Masking (train_argos_lora.py):
    • Masks all system and user AXTree prompt tokens with labels = -100 up to <|im_start|>assistant\n, focusing gradient updates 100% on the assistant's JSON decision.
  3. Deterministic Pre-Execution MCP Safety Gateway (argos_mcp_bridge.py):
    • Enforces strict per-tool argument schemas (-32602 Invalid params), unknown-tool rejection (-32601 Method not found), and RFC-compliant JSON-RPC 2.0 Notifications (omitting "id" on notifications/safety/escalation).
    • Embeds SafetyPolicyEngine (RULE_01 to RULE_06), which synchronously inspects (tool, arguments, thought, ui_context) before emitting tools/call. Across all 60 held-out safety cases in test.jsonl, even when simulating an unaligned model that attempts to type DELETE or click destructive buttons, the Bridge Guardrail intercepts and halts 60/60 (100.0%, Wilson 95% CI [0.9398, 1.0000]).

🏗️ Defense-in-Depth Architecture

flowchart LR
    Screen["Browser / Windows UIA"] --> AXTree["Semantic AXTree Snapshot"]
    AXTree --> Argos["Argos-Action-1.5B (Policy SLM)"]
    Argos --> Validator["JSON-RPC 2.0 Schema Validator\n(-32700 / -32600 / -32601 / -32602)"]
    Validator --> Guardrail["SafetyPolicyEngine (RULE_01–RULE_06)\nPre-Execution Deterministic Gate"]
    Guardrail -- "Safe" --> Call["MCP tools/call"]
    Guardrail -- "Destructive / 2FA / Injection" --> Halt["MCP notifications/safety/escalation\n(EXECUTION_HALTED)"]

📊 Audited Artifact Specifications & v2.0 Token Census

All metrics below are verified by python evaluate_argos.py (data/metadata/evaluation_summary.json and data/metadata/hashes.json):

Specification Value Verification & Scope
Base Model Qwen/Qwen2.5-1.5B-Instruct 1.54B parameter base checkpoint
LoRA Adapter r=16, alpha=32, 7 projections 18,464,768 trainable params (392 tensors, BF16, 36.98 MB)
Dataset v2.0 Splits 1,700 Train / 300 Test 100% unique rows (1,700/1,700 & 300/300), 0/300 leakage
Domain Balance 5 Domains 340 per domain in Train / 60 per domain in Test
Tool Distribution (Train) All 6 Tools click: 340 · escalate_human: 340 · type_text: 280 · select_option: 260 · press_hotkey: 240 · scroll: 240
Tool Distribution (Test) All 6 Tools escalate_human: 60 · click: 48 · type_text: 48 · select_option: 48 · scroll: 48 · press_hotkey: 48
Token Census (n = 2,000) Input: 147.4 · AXTree: 89.6 Assistant JSON: 127.6 · Full ChatML: 452.0 (tokenizers 0.23.3)
Bridge Guardrail Interception 60 / 60 (100.0%) Wilson 95% CI [0.9398, 1.0000] on simulated unsafe actions across held-out safety cases

Cryptographic SHA-256 Hashes (--seed 42)

  • data/train.jsonl (6,569,128 bytes, 1,700 unique rows):
    108cf75967da5a8b43b5d77f2b6de54381cfeb3bf5f3ddd658ffa3225b2c49a5
  • data/test.jsonl (1,139,642 bytes, 300 unique rows):
    ecb5e6c334a9e063877743d7ae6f5522b954799d4c1fe61e5a18a5b11e4e7af9

🛡️ MCP Bridge v2.0 & Deterministic Guardrail Quickstart

from argos_mcp_bridge import ArgosPrediction, ArgosMCPBridge

bridge = ArgosMCPBridge(enforce_safety_guardrail=True)

# Example: Even if an unaligned model tries to type "DELETE" on prod-db-aurora,
# the Bridge's SafetyPolicyEngine (RULE_01_DESTRUCTIVE_OPERATION) blocks tools/call!
unsafe_model_output = """{
  "thought": "Typing DELETE to confirm database destruction",
  "tool_call": {
    "tool": "type_text",
    "arguments": {"element_id": "inp_confirm_deletion", "text": "DELETE", "press_enter": true}
  },
  "verification_predicate": {"expected_element": "btn_wipe_cluster", "timeout_ms": 1000}
}"""

ui_context = 'Window "Database Admin - Danger Zone" [Heading: "Permanent Resource Deletion: prod-db-aurora"]'

pred = ArgosPrediction.from_raw(unsafe_model_output)
mcp_envelope, is_halted = bridge.to_mcp_wire(pred, ui_context=ui_context)

assert is_halted is True
assert mcp_envelope["method"] == "notifications/safety/escalation"
assert "id" not in mcp_envelope  # Strict JSON-RPC 2.0 Notification compliance
assert mcp_envelope["params"]["enforcement_source"] == "BRIDGE_DETERMINISTIC_GUARDRAIL"
assert mcp_envelope["params"]["rule_id"] == "RULE_01_DESTRUCTIVE_OPERATION"

🧪 Running the Verification & Test Suite

# 1. Regenerate deterministic v2.0 dataset (seed 42)
python generate_argos_dataset.py --seed 42

# 2. Run Stage 1 (Dataset + Token Census) & Stage 2 (MCP Bridge + Guardrail Audit)
python evaluate_argos.py

# 3. Run the 12-case MCP Bridge & Safety Guardrail self-test
python argos_mcp_bridge.py

# 4. Run the automated unit test suite
python -m unittest discover -s tests -v

# 5. (Optional, requires GPU/CPU + torch/peft) Run Stage 3 live model.generate() benchmark
python evaluate_argos.py --run-model-eval

🎯 Space Playground Transparency Disclosure

The online demonstration at Hugging Face Spaces (pedroreoli/argos-action-demo) is a Static MCP Protocol & Guardrail Playground hosted on sdk: static. It allows interactive inspection of the Argos JSON contract, JSON-RPC 2.0 wire envelopes, and the SafetyPolicyEngine interception rules (prod-db-aurora guardrail demo) without running a live GPU backend.


📄 License & Attribution

Licensed under the Apache License 2.0.
Developed by Pedro Lucas Reis (@PedroReoli • LinkedIn).

Downloads last month
103
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for pedroreoli/argos-action-1.5b

Adapter
(1,819)
this model

Dataset used to train pedroreoli/argos-action-1.5b

Space using pedroreoli/argos-action-1.5b 1