AgentR Webcmd Browser Agent Tutorial: Teach an AI Browser a Site Once, Then Reuse It

Introduction

Every browser agent starts from zero. It opens a page, reads the whole layout, hunts for the same search box, filters, and submit button, and pays for that rediscovery in tokens on every run. Run the same research, price check, or inbox sweep every morning, and you pay that learning cost again and again. AgentR Webcmd is open source browser infrastructure built to stop that waste: it records what an agent observes on a site, including pages, states, actions, workflows, APIs, pitfalls, and fallback paths, as an agent-facing sitemap stored locally, so the next agent starts from the map instead of from scratch. This tutorial installs Webcmd, runs one task the slow way, inspects what it learned, and runs the task again so you can see the reuse loop working.

Quick answer

Install Webcmd with npm, add its webcmd-browser skill to Claude or Codex, run a read-only research task once so it learns the site, then rerun the same task and inspect the stored memory with webcmd site memory list.

Evidence

The case for site memory is a cost case, and AgentR published numbers you can check rather than just a slogan. On BU Bench V1, a 100-task browser automation benchmark published by the browser-use project, Webcmd passed 67 tasks, the highest score in AgentR’s published comparison, at an estimated $0.255 per completed task, the lowest of the five tools tested, against $0.297 for browser-use and $0.554 for agent-browser. Webcmd averaged 9.8 agent turns per completed task, 34 percent fewer than browser-use at 14.8 turns. Treat these as a vendor-run comparison, not a guarantee: all tools used the same Pi controller, model, Codex gpt-5.4 judge, and CloakBrowser engine, and the benchmark report documents the methodology and reproduction steps.

The project has traction beyond its own announcement. As of October 2026, the repository shows 2,754 stars and 1,538 forks under Apache 2.0, and the launch announcement notes Webcmd was the number one trending JavaScript repository on Trendshift on August 22. The cost pressure behind it is real: Gartner predicted in June 2025 that more than 40 percent of agentic AI projects will be canceled by the end of 2027, citing escalating costs, unclear business value, and inadequate risk controls. AgentR’s founder Nishant Gaurav framed the bet plainly: “We are building systems that learn from real use, not just from training data.” AgentR’s stated goal is to cut browser-agent token spend by up to 90 percent, which is a vendor goal, not a measured result, so this tutorial measures your own first run against your second run instead of quoting that goal as a fact. The Webcmd documentation site states the design in the same terms: the live browser is always truth, Webcmd never explores just to learn, and a memory failure never blocks a task.

Prerequisites

You need Node.js 20.6 or later, npm, and one agent harness that can load a skill, such as Claude Code or Codex. You also need a read-only practice task, for example researching a topic on Hacker News and Reddit, so first runs cannot post, buy, or delete anything. This tutorial was verified on October 30, 2026 with Node.js 24.22.1 and Webcmd 0.8.4, and the first webcmd doctor run downloaded a 206 MB CloakBrowser build, so expect a one-time download on a fresh machine.

Step-by-step guide

Step 1: Install Webcmd and verify the installation

Install the package globally, then confirm the binary answers:

node --version
npm install -g @agentrhq/webcmd
webcmd --version

You should see Node.js 20.6 or later and Webcmd 0.8.4 or similar. If the shell reports webcmd: command not found after a successful install, your npm global bin directory is not on your PATH, which happened in this tutorial’s lab run. Find it and add it for the current session:

npm config get prefix
export PATH="$(npm config get prefix)/bin:$PATH"
webcmd --version

Then run the diagnostic. It checks the browser bridge and, on a fresh machine, fetches the stealth Chromium build Webcmd drives:

webcmd doctor

A healthy result reports the Webcmd and Node.js versions, and notes no Cloak runtime profiles are active yet. That last line is normal before your first browser-backed command, not an error.

Step 2: Add the webcmd-browser skill to your agent

Webcmd is designed to be driven through an agent. Install its single skill:

webcmd skills add

When prompted, choose Claude, Codex, another supported harness, or a custom skills path. The installer adds exactly one skill, webcmd-browser. Confirm it:

webcmd skills list

You should see webcmd-browser, covering live browser interaction, authenticated handoff, visible UI verification, and ad-hoc page inspection. Load or tag it only for live browser work. Setup commands do not require it, and loading it for unrelated tasks just burns context.

Step 3: Run a read-only task for the first time

Pick one repeatable, read-only task and write it down exactly, because you will run the same wording twice. A good first task, adapted from the project’s own examples, is:

Use webcmd to research the latest discussions about browser automation
across Hacker News and Reddit, then return a concise comparison with
source links.

Run it through your agent with the webcmd-browser skill loaded. On this first run, the agent explores: it finds the front pages, learns where discussion lists, comments, and outbound links live, and completes the comparison. Save the output, and note how many agent turns the run took and roughly how much it cost, if your harness reports them. This first run is deliberately the expensive one: it builds the map.

Webcmd works in two layers. Layer 0 is live browser control for an unfamiliar site: inspect, click, type, extract, capture network calls, and complete the task in a real browser. Layer 1 is sitemap memory for a familiar site: the captured sitemap of observed pages, states, actions, workflows, APIs, pitfalls, and fallback paths. Your first run exercises layer 0 and populates layer 1. You can also seed memory for a site directly before a task:

webcmd site memory context https://news.ycombinator.com

That command resolves the product identity, seeds memory once, and returns a task draft path.

Step 4: Inspect what Webcmd learned

Do not take the reuse claim on faith. Inspect the stored memory for the site you just visited:

webcmd site memory list news.ycombinator.com
webcmd site memory show news.ycombinator.com

The list view shows memory files with size, checksum, and last update, and the show view prints every record. Read it critically. A good entry names real pages and actions from step 3, notes a pitfall such as a login wall, and records a fallback path. A vague entry that could describe any news site means the run did not learn anything useful, so rerun with a narrower request before trusting reuse.

You can also keep your own notes alongside the learned memory, which is the right place for judgments the agent should not have to rediscover:

webcmd site note add news.ycombinator.com --text "front page is server-rendered"

Notes are for facts you verified yourself, such as which page holds the discussion list. Keep them short: a note that was true before a redesign can mislead a later run, and the live browser, not the note, is the source of truth.

Step 5: Run the same task again and compare

Now rerun the exact task wording from step 3, with the same skill loaded, and compare the result against the first run. Check three things. First, is the answer correct and sourced, with links that open? Second, did the run take fewer turns, or at least skip the exploratory steps from the first run? Third, did anything in stored memory disagree with the live page, and if so, did the agent follow the live page? The third check matters most: a memory layer that overrides the live site is a liability. On a changed page, a correct second run should explore the changed part fresh and shortcut only the parts that are still true.

For a clean A/B test, run the comparison in a fresh profile. Profiles are cookie jars, so a new profile gives you a clean session without deleting the memory you built:

webcmd profile create fresh-test
webcmd profile use fresh-test
webcmd session list

A fresh profile still benefits from per-site memory while keeping cookies and session state separate. That separation is also how you keep accounts apart: one profile per account, never a shared default profile for two logins.

Step 6: Use manual sessions for scripted exploration

Agent-driven runs are the normal path, but scripted work needs explicit sessions. Create a named session inside a profile, list its tabs, run one sandboxed Playwright-style program against it, and close it when you are done:

webcmd --profile work session create "Work Project" -f json
webcmd --profile work --session work-project-k7 browser tabs
webcmd --profile work --session work-project-k7 browser run --file explore.js
webcmd --profile work session close work-project-k7

Session IDs are readable and profile-scoped, and parallel agents should create separate sessions rather than sharing one. You can also pipe a tiny program straight in for a one-off check such as reading a page title:

printf 'return await page.title();' \
  | webcmd --profile work --session work-project-k7 browser run --stdin

Raw browser commands require an explicit readable session ID, so keep the ID from the create step. If an overlapping run returns SESSION_BUSY, wait and retry rather than forcing a second browser into the same session.

Step 7: Decide what Webcmd is worth to you

After two runs, make the call with your own numbers, not the vendor’s. Webcmd earns its place when the same site is visited repeatedly, the navigation is non-obvious, and the task is read-heavy: daily research sweeps, price checks, and inbox or dashboard summaries. It earns nothing on a site you visit once, and it can mislead on a site that redesigns weekly. The honest version of the 90 percent goal is narrower: you save rediscovery turns on repeat visits to stable sites, and the saving grows with repetition. If your second run was not faster or more reliable, retest after three or four visits before judging it.

For repeatable agent workflows, pair this with the guardrails in our n8n AI agent production reliability checklist and place the browser step inside a larger workflow using our complete n8n guide. For a computer-style interface rather than a structured sitemap, compare this approach with our GitHub Copilot computer use tutorial before committing to one browser strategy.

Troubleshooting

webcmd: command not found after a successful install

This is a PATH problem, not a failed install. Run npm config get prefix, confirm the bin directory under it contains webcmd, and add it to your PATH with export PATH="$(npm config get prefix)/bin:$PATH". If the command works in a new shell, only the older session lacked the directory. If it still fails, npm installed to a different prefix than your shell uses.

The first webcmd doctor run seems to hang on a download

It is downloading CloakBrowser, the stealth Chromium build Webcmd drives. In this tutorial’s verification run, the download was 206 MB with a checksum step after it finished. Let it complete, and rerun webcmd doctor if it is interrupted. On a metered connection, run webcmd doctor once before you need the browser.

SESSION_BUSY on a browser run

A second overlapping run against the same session returns SESSION_BUSY. Wait and retry instead of opening a second browser on the same session. For parallel work, create a separate session per agent with webcmd session create, since sessions are independent browser windows within a profile.

The second run follows stale memory to a page that moved

Trust the live page and fix the memory, in that order. Rerun the task, confirm the agent follows the current layout, then add a site note recording the change, such as a moved section or renamed filter. Never edit a memory file by hand to a guessed URL: a wrong shortcut is worse than no shortcut, because the next agent will follow it without the exploration that would have caught the error.

A logged-in task opens the wrong account

Profiles are cookie jars, so the fix is profile discipline. List profiles with webcmd profile list, switch with webcmd profile use, and confirm with webcmd session list before running the task. Create one profile per account, named after its purpose, such as work or social. If a session is already open under the wrong profile, close it and create a new one under the right profile.

The agent loads the skill for non-browser work

The webcmd-browser skill is for live browser work only. If your agent reaches for it on a plain coding or writing task, name the browser task explicitly and tag the skill only for that turn. Installation, memory inspection, and profile management do not require it.

FAQ

Two points deserve emphasis. First, the free part is the local tool, not a hosted service: Webcmd is Apache 2.0 open source, while Webcmd Cloud is still in active development and not yet stable, so plan around local runs. Second, memory is an accelerator, not an authority. The live browser always wins over a stored sitemap, a failed memory lookup never blocks a task, and a separate profile per account is what keeps logged-in sessions from mixing. The front matter of this page carries the full question and answer set on cost, replacement of browser-use and Playwright, storage, supported agents, account safety, and site redesigns.

Conclusion

Webcmd’s idea is simple enough to test in an afternoon: pay the learning cost once, store it as a local agent-facing sitemap, and let later visits start from the map. Install it, add the webcmd-browser skill, run one read-only task twice, inspect the memory with webcmd site memory list, and judge it on your own turn count, not the vendor’s 90 percent goal. If repeat visits to stable sites get faster and stay correct, keep it as the browser layer for your daily sweeps. If not, that site is either too simple to need memory, or too volatile to trust it. Pick your highest-frequency repeat task, run it through Webcmd for a week, and then decide whether site memory belongs in your standard setup.

Frequently asked questions

Is Webcmd free to use?

Yes, Webcmd is open source under the Apache 2.0 license and installs with one npm command. Webcmd Cloud, the hosted option, is in active development and not yet stable, so local use is the practical default for now.

Does Webcmd replace browser-use or Playwright?

No. Webcmd builds on a real browser and Playwright-style programs for live control, and adds a memory layer on top. Browser-use is one of the tools in AgentR's own benchmark comparison, not a component Webcmd replaces. Think of Webcmd as the memory and command layer between your agent and the browser.

Where is the learned site memory stored?

Learning stays local after the first access, which may use a Webcmd Cloud seed. The live browser is always the source of truth, and a memory failure never blocks a task, so a stale entry costs a slower run, not a failed run.

Which agents can use Webcmd?

The installer asks you to choose Claude, Codex, another supported harness, or a custom skills path, and installs exactly one skill named webcmd-browser. Load or tag it only for live browser work. Installation and setup commands do not require it.

Is it safe to use Webcmd with a logged-in account?

Profiles act as cookie jars, so a named profile keeps one account's session separate from another. Start with read-only tasks, keep purchases, posts, and deletions behind your own review, and use a separate profile per account.

What happens when the website changes?

The live browser wins. Webcmd never explores just to learn, so a redesigned page is handled by fresh exploration on that run. Add a site note about the change, rerun the task, and use a fresh profile or session for a clean before and after comparison.

TP
ToolPilot Team

We install, break, and fix automation tools so you don't have to. Every tutorial on ToolPilot is tested hands-on before publishing.

Keep reading