Buy and return items on Amazon using browser automation. Use for purchasing, reordering, checking order history, and processing returns.
agent-browser CLI installed--remote-debugging-port=9222 (see Starting the browser)ssh -L 6080:localhost:6080 <host> → http://localhost:6080/vnc.htmlSet these environment variables or configure your defaults:
# Your default shipping address (verify on checkout)
export AMAZON_SHIPPING_ADDRESS="Your shipping address"
# Your preferred payment method description (verify on checkout)
export AMAZON_PAYMENT_METHOD="Your preferred card"
# Your preferred return drop-off location
export AMAZON_RETURN_DROPOFF="Whole Foods"
Always verify shipping address and payment method are correct before placing an order.
AMAZON_RETURN_DROPOFF or Whole Foodsagent-browser connect 9222
Always open a new tab — other sessions share the same Chrome. Use --new-tab on every open command.
agent-browser open "https://www.amazon.com/gp/your-account/order-history"
agent-browser snapshot -i
# Find search box, fill with item name, click search
# From order history search results
agent-browser click @[buy-it-again-ref]
# Wait for checkout page
agent-browser snapshot
# Verify correct address and payment method are selected
agent-browser click @[place-order-ref]
macOS (opens a visible Chrome window):
open -na "Google Chrome" --args --user-data-dir=$HOME/.config/chrome-agent --no-first-run --remote-debugging-port=9222 https://www.amazon.com
Linux (headless with Xvfb/VNC):
DISPLAY=:99 google-chrome --user-data-dir=$HOME/.config/chrome-agent --no-first-run --remote-debugging-port=9222 https://www.amazon.com &
Linux (desktop/GUI session):
google-chrome --user-data-dir=$HOME/.config/chrome-agent --no-first-run --remote-debugging-port=9222 https://www.amazon.com &
$HOME/.config/chrome-agent:99 on port 5999 (noVNC on 6080)