Skip to main content
This example sends the agent to a real online store. It finds a named product, adds it to the cart and reads the cart back. It stops there: no checkout, no personal details, no payment.
  • The store and the product come from Commerce Bench, an open harness that tests shopping agents on real stores. Barnes & Noble is one of the stores its reference agent finished on a default Anchor session.
  • The prompt states where to stop. Keep that line in any shopping task you write.
Before you run it, set ANCHORBROWSER_API_KEY and install the SDK. The Node.js version also needs zod 4, and the Python version needs pydantic.

Output

Both scripts on this page were run against the live API on November 27, 2026. This is the output of one of those runs. Your values will differ.

Notes

  • Two runs put different listings of the book in the cart: one at $22.00 and one at $37.99. Both were hardcover. Name the edition or the ISBN in the prompt when the exact item matters.
  • No agent in these docs submits payment. If you extend this example toward checkout, stop before the payment step.
  • Many stores turn an automated browser away before the agent can act. In the published Commerce Bench runs, the same agent got into 12 of 30 stores from a laptop browser, 17 on a default Anchor session and 25 with the best Anchor setup for each store. See the results.
  • If a store blocks a default session, turn on a proxy, captcha solving or extra stealth. See Network and stealth for what each plan includes.
  • The task result is checked: a status other than success raises an error instead of printing a failure as if it worked.
  • The session is ended in a finally block. A task does not end the session it runs in.