You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`PredicateBrowserAgent` is a new high-level agent wrapper that gives you a **browser-use-like**`step()` / `run()` surface, but keeps Predicate’s core philosophy:
15
+
16
+
-**Snapshot-first perception** (structured DOM snapshot is the default)
17
+
-**Verification-first control plane** (you can gate progress with deterministic checks)
18
+
- Optional **vision fallback** (bounded) when snapshots aren’t sufficient
19
+
20
+
It’s built on top of `AgentRuntime` + `RuntimeAgent`.
21
+
22
+
##### Quickstart (single step)
23
+
24
+
```python
25
+
from predicate import AgentRuntime, PredicateBrowserAgent, PredicateBrowserAgentConfig, RuntimeStep
26
+
from predicate.llm_provider import OpenAIProvider # or AnthropicProvider / DeepInfraProvider / LocalLLMProvider
27
+
28
+
runtime = AgentRuntime(backend=...) # PlaywrightBackend, CDPBackendV0, etc.
29
+
llm = OpenAIProvider(model="gpt-4o-mini")
30
+
31
+
agent = PredicateBrowserAgent(
32
+
runtime=runtime,
33
+
executor=llm,
34
+
config=PredicateBrowserAgentConfig(
35
+
# Token control: include last N step summaries in the prompt (0 disables history).
36
+
history_last_n=2,
37
+
),
38
+
)
39
+
40
+
ok =await agent.step(
41
+
task_goal="Find pricing and verify checkout button exists",
42
+
step=RuntimeStep(goal="Open pricing page"),
43
+
)
44
+
```
45
+
46
+
##### Customize the compact prompt (advanced)
47
+
48
+
If you want to change the “compact prompt” the executor sees (e.g. fewer fields / different layout), you can override it:
If you want to measure token spend, you can enable best-effort accounting (depends on provider reporting `prompt_tokens` / `completion_tokens` / `total_tokens` in `LLMResponse`):
##### RuntimeAgent: act once without step lifecycle (orchestrators)
102
+
103
+
`RuntimeAgent` now exposes `act_once(...)` helpers that execute exactly one action **without** calling `runtime.begin_step()` / `runtime.emit_step_end()`. This is intended for external orchestrators (e.g. WebBench) that already own step lifecycle and just want the SDK’s snapshot-first propose+execute block.
0 commit comments