File size: 3,833 Bytes
116524e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Browser-Use Integration

The `BrowserUse` runner wraps [browser-use](https://github.com/browser-use/browser-use) with ACE learning. The agent automates browser tasks and learns strategies from each run β€” improving navigation, element selection, and error recovery over time.

## Installation

```bash

uv add ace-framework[browser-use]

```

## Quick Start

```python

from ace import BrowserUse

from langchain_openai import ChatOpenAI



runner = BrowserUse.from_model(

    browser_llm=ChatOpenAI(model="gpt-4o"),

    ace_model="gpt-4o-mini",

)



results = runner.run("Find the top post on Hacker News")

runner.save("browser_expert.json")

```

## Parameters

### from_model()



| Parameter | Type | Default | Description |

|-----------|------|---------|-------------|

| `browser_llm` | `Any` | β€” | LLM for browser-use execution |
| `ace_model` | `str` | `"gpt-4o-mini"` | Model for Reflector + SkillManager |
| `ace_max_tokens` | `int` | `2048` | Max tokens for ACE LLM responses |
| `ace_temperature` | `float` | `0.0` | Sampling temperature for ACE roles |

### from_roles()



| Parameter | Type | Default | Description |

|-----------|------|---------|-------------|

| `browser_llm` | `Any` | β€” | LLM for browser-use execution |
| `reflector` | `ReflectorLike` | β€” | Reflector instance |
| `skill_manager` | `SkillManagerLike` | β€” | SkillManager instance |
| `skillbook_path` | `str` | `None` | Load saved skillbook |
| `browser` | `Browser` | `None` | browser-use Browser instance |
| `agent_kwargs` | `dict` | `None` | Extra kwargs for browser-use Agent |
| `dedup_config` | `DeduplicationConfig` | `None` | Deduplication config |
| `checkpoint_dir` | `str` | `None` | Checkpoint directory |

## Methods

```python

results = runner.run(tasks, epochs=1)       # Run with learning

runner.save("path.json")                    # Save skillbook

runner.wait_for_background()                # Wait for async learning

runner.get_strategies()                     # View learned strategies

```

## How It Works

1. **INJECT** β€” Skillbook strategies are added to the task prompt
2. **EXECUTE** β€” browser-use runs the task (navigation, clicks, form fills)
3. **Extract trace** β€” ACE extracts a chronological trace of agent thoughts, actions, and results
4. **LEARN** β€” Reflector analyzes the full trace, SkillManager updates the skillbook

The extracted trace includes:

- Agent reasoning at each step
- Browser actions taken (click, type, navigate)
- Page observations
- Success/failure of each action

## Running Multiple Tasks

```python

results = runner.run([

    "Find the top post on Hacker News",

    "Search for ACE framework on GitHub",

    "Check the weather in NYC",

])

```

## Example: Domain Checker

```python

from ace import BrowserUse

from langchain_openai import ChatOpenAI



runner = BrowserUse.from_model(

    browser_llm=ChatOpenAI(model="gpt-4o"),

    ace_model="gpt-4o-mini",

)



domains = ["example.com", "test.org", "sample.net"]

for domain in domains:

    runner.run(f"Check if {domain} is available for registration")



# After several runs, the agent learns:

# - Which registrar sites to use

# - How to navigate the domain search UI

# - How to interpret availability results

runner.save("domain_checker.json")

```

## Resuming from a Saved Skillbook

```python

runner = BrowserUse.from_model(

    browser_llm=ChatOpenAI(model="gpt-4o"),

    ace_model="gpt-4o-mini",

    skillbook_path="browser_expert.json",

)

```

## What to Read Next

- [Integration Pattern](../guides/integration.md) β€” how the INJECT/EXECUTE/LEARN pattern works
- [The Skillbook](../concepts/skillbook.md) β€” how learned strategies are stored
- [Opik Observability](opik.md) β€” monitor browser automation costs