Skip to main content

ACBE — Adaptive Counterfactual Browser Evolution

PyPI version Python Version License: MIT Tests

The autonomous self-improvement layer for AI web agents.

An AI browser agent should not endlessly repeat the exact same mistakes. It should diagnose verified failures, synthesize counterfactual alternatives, validate in a shadow sandbox, and transfer learned heuristics permanently—without retraining model weights.


Key Benchmarks (ACBE-Bench)

Across 25 standardized modern web hazard scenarios (shadow roots, dynamic overlays, timing jitter, polymorphic class mutation):

  • 95.2% Autonomous Recovery Rate (recovers trapped navigation sessions with zero human intervention)
  • 87.5% Zero-Shot Cross-Environment Transfer (generalizes heuristics learned on one domain to completely unseen websites)
  • 0.0% Regression Rate (strictly guarded by two-proportion Z-test statistical gates)

Installation

Install the zero-dependency core engine from PyPI:

pip install acbe

Or install with optional full dashboard and browser dependencies:

pip install "acbe[full]"

Quickstart in 30 Seconds

Python SDK

from acbe import ACBE
from acbe.agents.custom_agent import ScriptedAgent
from acbe.core.types import ActionType, LocatorStrategy
from acbe.experiments.runner import TaskStep
from benchmarks.environments import make_shop_environment

# 1. Initialize environment with an adversarial trap (e.g. look-alike button)
env = make_shop_environment("demo-shop", trap=True)

# 2. Define baseline agent
agent = ScriptedAgent(
    steps=[
        TaskStep(ActionType.CLICK, "Browse products"),
        TaskStep(ActionType.CLICK, "Add to cart"),
        TaskStep(ActionType.CLICK, "Proceed to checkout"),
    ],
    locator_strategy=LocatorStrategy.TEXT_VISUAL,
)

# 3. Wrap with ACBE self-healing layer
system = ACBE(agent=agent, browser="mock", environment=env)

# 4. Execute and observe autonomous self-healing
result = system.run_and_improve("Add product to cart and checkout.")

print("Initial Run:", result.initial_success)
print("Improvement Triggered:", result.improvement_triggered)
print("Promoted Strategy:", result.improvement.top_candidate)

CLI

ACBE includes a full developer CLI:

# Initialize local state store
acbe init

# Run a navigation task
acbe run wrong_element_0

# Trigger autonomous diagnosis and repair loop
acbe improve wrong_element_0

# Launch the local REST API server
acbe serve --port 8420

The 5-Stage Closed Learning Loop

Task Execution ➔ Invariant Verification ➔ Root Cause Diagnosis 
               ➔ Counterfactual Strategy Funnel ➔ Shadow Sandbox A/B Gate 
               ➔ Procedural Memory Indexing ➔ Zero-Shot Transfer
  1. Deterministic Invariant Checks: Agents are never permitted to declare their own success. External DOM state hashes verify post-conditions.
  2. Root Cause Diagnosis: Maps failure symptoms to 13+ deterministic web trap classes (e.g., selector drift, hydration delay, overlay interception).
  3. Counterfactual Strategy Funnel: Synthesizes alternative execution candidates filtered cheaply from heuristic to LLM-level.
  4. Statistical Promotion Gate: Validates candidates in a shadow sandbox against baseline and regression suites ($z \ge 1.96, p < 0.05$).
  5. Procedural Vector Memory: Records promoted rules for runtime reuse across mutated domains.

Interactive Console & Landing Page

ACBE includes a Next.js 14 engineering console featuring:

  • Virtual Browser Viewport: Step-by-step element trajectory inspector with target highlighting.
  • Diagnostic Failure Lab: Bayesian root cause confidence meters and inline 1-click auto-repair.
  • 4-Tier Strategy Registry: Visual advancement funnel (Draft ➔ Experimental ➔ Validated ➔ Promoted).
  • A/B Trial Comparator: Head-to-head win rate comparison and token overhead meters.
  • Lineage DAG & Safe Rollback: 1-click atomic snapshot rollback for full provenance.

To launch the full stack locally:

# Windows 1-click launcher
start_project.bat

# Or manual launch:
py -m acbe.cli.main serve --port 8420
cd frontend && npm run dev

Project Architecture

acbe/            # Core installable Python library
├── core/        # Types, config, state machine invariants
├── failure/     # Diagnostic engine & 13-class taxonomy store
├── strategy/    # Heuristic synthesis & MCTS candidate ranking
├── experiments/ # A/B runner, statistical promotion gates
├── memory/      # SQLite & vector procedural store
├── evolution/   # Version DAG lineage & safe rollback engine
└── api/         # Flask REST API engine
benchmarks/      # ACBE-Bench standardized web hazard tasks
frontend/        # Next.js 14 + Tailwind luxury console & landing page
tests/           # Complete pytest test suite (143 unit tests)

Testing

Run all automated unit tests:

pytest tests/ -q
# 143 passed in 9.79s

License

MIT License. Open research & developer contribution welcomed.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

acbe-0.1.0.tar.gz (83.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

acbe-0.1.0-py3-none-any.whl (87.2 kB view details)

Uploaded Python 3

File details

Details for the file acbe-0.1.0.tar.gz.

File metadata

  • Download URL: acbe-0.1.0.tar.gz
  • Upload date:
  • Size: 83.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.10

File hashes

Hashes for acbe-0.1.0.tar.gz
Algorithm Hash digest
SHA256 73f77a7d97b5a650bdb476caaa21c3bbe3377e39e1026ce74eec8f10f1f3cbaa
MD5 23f12b920cd5b6d9b81a92e5c3c9d3ba
BLAKE2b-256 c87e2e22e7844828841502388b2422718131e449b7ce34191ddd08ee73f90dcf

See more details on using hashes here.

File details

Details for the file acbe-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: acbe-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 87.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.10

File hashes

Hashes for acbe-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a23992acd283e0213e88a27185bd7f20e7fa06b09559c7d7311b1d9c158d272b
MD5 78d73a617f8db2daa617c0f1400615a3
BLAKE2b-256 a6e4c1b7329b5a7199075385005058c4218326761cd5308987c32ab68738be77

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page