# ARC checkout guard for Stagehand and browser agents `withArcCheckout(url, attempt)` calls before_checkout, runs your browser steps with ARC's best route in hand, then reports the outcome with after_checkout. No API key. User agent `arc-integration/stagehand`. ## Get the files ```sh curl -s --create-dirs -o integrations/core/arc.ts https://www.arcreport.ai/integrations/core/arc.ts curl -s --create-dirs -o integrations/stagehand/checkout-guard.ts https://www.arcreport.ai/integrations/stagehand/checkout-guard.ts curl -s --create-dirs -o integrations/stagehand/example.ts https://www.arcreport.ai/integrations/stagehand/example.ts ``` Every file is listed at https://www.arcreport.ai/integrations. ## Quickstart ```ts import { withArcCheckout } from "./integrations/stagehand/checkout-guard"; await withArcCheckout(productUrl, async (arc, mark) => { if (arc.reaches_checkout && arc.endpoint) console.log("Machine route:", arc.route, arc.endpoint); await page.act("add this product to the cart"); mark("cart"); await page.act("go to checkout"); mark("checkout"); return { furthest_step: "checkout", blocker: "none" }; // or e.g. { furthest_step: "cart", blocker: "captcha" } }, { agentName: "my-stagehand-agent" }); ``` An ARC error never blocks the attempt: it runs with route `none`. If the attempt throws, the last step passed to `mark()` is reported and the error is rethrown. Stop before payment details unless the buyer has approved them. ## Files - `checkout-guard.ts`: the guard. No browser import. Tested in `integrations/core/kit.test.ts`. - `example.ts`: a full Stagehand run (Stagehand v2 `page.act` API). Stagehand is not installed in ARC's app, so the repo's `tsconfig.json` leaves this file out of type checking. - `../examples/stagehand_precheck.ts`: the older precheck-only example. Spec: https://www.arcreport.ai/for-agents#before-checkout ยท Kit: https://www.arcreport.ai/integrations