AgentWorks documentation
Browser Automation in Workflows
Browser workflows use the agent-browser skill and the managed
agent_browser tool. Set capabilities.browser_mode to auto, headless, or
cdp; use none when browsing is not required.
Authoring sequence
- Load the installed command guide with
agent_browser(command="skills", args=["get", "core"]). - Open or select the workflow's labeled tab.
- Take an interactive snapshot.
- Act with a live ref or a durable selector.
- Re-snapshot and verify the expected state.
- Save stable site knowledge to the workflow's learnings.
Persisted scripts
Snapshot refs such as @e1 are valid only for the current page state. A saved
script must either parse a fresh ref from a new snapshot or use a stable hook.
Prefer selectors in this order:
data-testid,data-test,data-cy, ordata-qa;- a hand-written semantic
idorname; aria-label;- role plus accessible name resolved from a fresh snapshot;
- stable label, placeholder, or visible text;
- structural CSS or XPath only as a documented last resort.
Avoid generated framework IDs, hashed class names, and nth-child chains.
When the accessibility snapshot is incomplete, use a read-only eval probe to
inventory stable DOM attributes before choosing a selector.
CDP workflows
CDP mode attaches to a visible Chrome and can reuse existing login state. Keep a stable labeled tab for each workflow or account. A single shared CDP browser is the normal concurrency model; configure multiple CDP ports only when one workflow genuinely needs independent Chrome profiles, such as testing two logged-in accounts on the same site.
Debugging
Use network, console, errors, screenshots, HAR capture, recording, and
tracing through the same managed tool. This preserves the workflow's tab lock
and session identity. Do not use raw CDP calls or shell-launched browser actions.
See the core browser reference for setup, isolation, artifact handling, and operational limits.