Skip to main content
The Agent Platform Javascript SDK (AgP JS SDK) lets you monitor e-commerce prices using the agent.shopFor() command. You can execute a number of web-based workflows, including tracking e-commerce prices across multiple retailers, aggregating product deals in real time, and automating price comparisons to help users make informed purchasing decisions. Here’s a summary of what the AgP JS SDK empowers you to do when monitoring prices across e-commerce websites or carrying our other shopping-related tasks:
  • Define a list of products to monitor.
  • Use an agent to search for each product across e-commerce websites.
  • Receive real-time updates when information is available.
  • Log the prices or messages to the console.
In this example, we’ll explore how to monitor e-commerce prices using the agent.shopFor() method. You’ll see how the AgP JS SDK uses agents to scan the web and extract information, track progress in real time, and report results — all with minimal code.

Monitor e-commerce prices

Situation: You want to track product prices across multiple online retailers — for example, to find the best deal on the latest iPhone, MacBook, or AirPods — but manually checking websites is slow and inconsistent. You need a way to automate these searches and collect real-time updates efficiently. Problem: How can you automatically search for multiple products across e-commerce sites, monitor price changes, and receive live updates — all without building complex scraping or API integrations from scratch? Solution: The AgP JS SDK lets you automate price tracking using the agent.shopFor() command. It enables you to define a list of products, execute concurrent search tasks across multiple retailers, and receive live updates as new pricing data or deals are found. With real-time event monitoring and automated completion handling, you can seamlessly aggregate and compare e-commerce data without writing repetitive code.

Step 1: Initialize the SDK

Start by initializing the SDK and setting up authentication with Portal-H. This ensures that your agent can securely access the web and run shopping tasks.
<button id="loginBtn" style="display:none;">Login to Portal-H</button>

<script src="agp.browser.js"></script>
<script>
(async () => {
  const agent = await AGP.WebAgent.init({
    authCallback: (login) => {
      const btn = document.getElementById('loginBtn');
      btn.style.display = 'block';
      btn.onclick = login;
    }
  });

Step 2: Define the products

Create a list of product names that you want to track. Each product in this array will become a separate shopping task.
  const products = [
    'iPhone 15 Pro',
    'MacBook Pro M3',
    'AirPods Pro'
  ];

Step 3: Start shopping tasks

Use the agent.shopFor() command to search for each product online. The SDK will handle the browsing and information gathering automatically.
  for (const product of products) {
    const task = await agent.shopFor(product);

Step 4: Subscribe to real-time updates

Receive live updates from the agent while it searches.
You’ll see messages such as price findings or deal comparisons in your console.
    task.onUpdate((event) => {
      if (event.type === 'ChatMessageEvent') {
        console.log(`${product} update:`, event.data.content);
      }
    });

Step 5: Wait for task completion

Ensure each task completes before moving to the next one.
    await task.waitForCompletion();
  }
})();
</script>

Step 6: Put it all together and run

Here’s a complete example that includes all previous steps, assembled and ready to run:
Browser example
<button id="loginBtn" style="display:none;">Login to Portal-H</button>

<script src="agp.browser.js"></script>
<script>
(async () => {
  const agent = await AGP.WebAgent.init({
    authCallback: (login) => {
      const btn = document.getElementById('loginBtn');
      btn.style.display = 'block';
      btn.onclick = login;
    }
  });

  const products = [
    'iPhone 15 Pro',
    'MacBook Pro M3',
    'AirPods Pro'
  ];

  for (const product of products) {
    const task = await agent.shopFor(product);

    task.onUpdate((event) => {
      if (event.type === 'ChatMessageEvent') {
        console.log(`${product} update:`, event.data.content);
      }
    });

    await task.waitForCompletion();
  }
})();
</script>

Outcome

The AgP JS SDK, running the above code asyncronously, will follow a sequence that:
  • Initializes the SDK and authenticates through Portal-H.
  • Provides real-time updates.
  • Generates an accurate and detailed response, for example:
Amazon
Renewed (Unlocked, 128GB, Blue Titanium): $623.43 (More buying options from $561.14 for used/new)
Renewed Premium (Unlocked, 128GB, Black Titanium): $673.53
Other memory and color variants also available, prices may vary slightly
_Source: Amazon Search Results _

Apple Store (Official)
No longer sold new as of Oct 2025.
Only iPhone 16/17 series currently available for purchase directly from Apple
iPhone 15 Pro not available in Buy or Compare tools
_Source: Apple.com iPhone Section _

Best Buy
Pre-owned (Unlocked, 128GB, Excellent): $749.99
Pre-owned (Unlocked, 256GB, Excellent): $779.99
Pre-owned iPhone 15 Pro Max 256GB: $899.99
Only pre-owned/used models available, no new units found
_Source: Best Buy Search Results _

Summary Table


Store	Condition	Storage	Price
Amazon	Renewed	128 GB	$623.43
Amazon	Renewed	128 GB	$561.14+*
Amazon	Renewed Premium*	128 GB	$673.53
Best Buy*	Pre-Owned	128 GB	$749.99
Best Buy*	Pre-Owned	256 GB	$779.99
Best Buy*	Pre-Owned	256 GB (Pro Max)*	$899.99
Apple	New	—	Unavailable
20+ used & new offers starting at this price on Amazon

Conclusion:

The lowest observed price for a renewed iPhone 15 Pro (128GB) is on Amazon ($623.43, or $561.14 for used offers).
Best Buy offers only pre-owned devices, starting at $749.99 for 128GB.
Apple does not sell the iPhone 15 Pro new anymore; only newer models are available.
For new-in-box, current direct purchase is not possible at major retailers as of October 2025.
I