How Commerce.com And Cloudflare Are Getting Storefronts Ready For AI Agents
Welcome back to the blog! If you’ve been running a homelab for any amount of time, you already know that the internet is shifting beneath our feet. We’ve spent the last two decades building beautiful, interactive web UIs for humans to click, scroll, and buy. But what happens when the “user” browsing your favorite online store isn’t a human at all, but an AI agent running on a server rack in someone’s basement?
The reality is that AI agents are becoming the new shoppers. Instead of you opening a browser to compare prices for a new NVMe drive, you’ll simply tell your local AI agent, “Find me a 2TB NVMe drive under $150 and order it.” The agent will parse your request, query storefronts, compare specs, and execute the purchase.
To make this a reality, major infrastructure players are stepping up. Specifically, Commerce.com and Cloudflare are teaming up to build the bridge between AI agents and online storefronts. Today, we’re going to break down how they’re doing it, what kind of hardware you need in your homelab to run these agents locally, and how you can build your own AI shopping agent right now.
The Shift to Machine-First Commerce
For an AI agent to buy something, it needs data. Traditional websites are a mess of HTML, CSS, and JavaScript. While an AI can scrape a website using headless browsers, it’s incredibly inefficient. It burns compute cycles, bandwidth, and time.
Instead, AI agents need clean, structured data via APIs.
Commerce.com is tackling this by transitioning to a “machine-first” architecture. They are exposing dedicated API endpoints specifically designed for AI agents. Instead of returning HTML, these endpoints return perfectly formatted JSON payloads containing product specs, pricing, inventory status, and shipping estimates.
Furthermore, Commerce.com is implementing standardized “Agent Auth” protocols. This allows an AI agent to securely authenticate, add items to a cart, and check out using tokenized payment methods without ever rendering a single pixel of a webpage.
Cloudflare’s Role: The AI Gateway and Edge Security
If Commerce.com is providing the data, Cloudflare is providing the pipes and the security. When millions of AI agents start pinging APIs simultaneously, the traffic patterns will look completely different from human traffic.
Cloudflare is introducing specific AI Gateway features to handle this. Here is what they are bringing to the table:
- Agent Verification: Cloudflare is rolling out cryptographic headers that verify an AI agent is who it claims to be. This prevents malicious bots from DDoSing APIs while letting legitimate AI agents through.
- Edge Caching for Agents: Cloudflare’s global edge network is now caching API responses specifically for AI agents. If a thousand agents ask for the price of a specific GPU, Cloudflare serves the cached JSON response from the edge, saving Commerce.com’s origin servers from melting down.
- AI Firewall: Cloudflare is adding rate-limiting and anomaly detection tailored to AI agent behavior, ensuring a rogue local model doesn’t accidentally buy out an entire inventory of thermal paste.
The Hardware: What Your Homelab Needs to Run an Agent
Since this is Self-Hosted Tech, we don’t want to rely on OpenAI or Anthropic to do our shopping for us. We want to run our own AI agents locally. But running an agent capable of “function calling” (the ability to trigger an API request based on a user prompt) requires some serious hardware.
Function calling requires a model that isn’t just good at chatting, but is specifically trained to output strict JSON formats. Here is what you need in your homelab rack to run a competent local shopping agent:
GPU and VRAM
The most critical component is your GPU’s VRAM. To run a model like Llama 3.1 8B (which is excellent at function calling), you need a minimum of 8GB of VRAM to run it at 4-bit quantization. However, if you want to run a smarter model like Command R or Llama 3 70B for complex multi-step reasoning, you’re looking at 24GB to 48GB of VRAM.
- Budget Build: A single used RTX 3060 12GB. Plenty of VRAM to run an 8B model with context room to spare.
- Mid-Tier: An RTX 4070 Ti Super (16GB) or a Mac Studio with unified memory.
- Homelab Beast: Dual RTX 3090s or 4090s (48GB+ VRAM total) to run 70B parameter models locally.
System RAM and CPU
While the GPU does the heavy lifting for inference, your CPU and RAM handle the orchestration, the API requests, and the context management. Aim for at least 32GB of DDR4/DDR5 system RAM. You don’t need a top-tier CPU, but a modern Ryzen 5 or Intel Core i5 will prevent bottlenecks when your agent is juggling multiple HTTP requests.
Networking
Your agent will be making outbound API calls to Commerce.com via Cloudflare. A standard gigabit connection is more than enough, but since we are self-hosters, we like redundancy. Ensure your homelab has a reliable DNS resolver and a static IP (or a dynamic DNS setup) if you plan on exposing your agent’s webhook back to the internet for order confirmations.
Practical Walkthrough: Building a Local Shopping Agent
Let’s get our hands dirty. We’re going to write a simple Python script that uses a local model (via Ollama) to act as a shopping agent. The agent will take a user prompt, decide to call the Commerce.com API, and execute the HTTP request via Cloudflare’s edge.
Prerequisites
- Ollama installed on your homelab server.
- Pull the Llama 3.1 model:
ollama run llama3.1 - Python 3.10+ installed.
- Install the required Python libraries:
1pip install requests ollama
The Code
In this walkthrough, we’ll define a “tool” that our local AI model can use. The model will read our prompt, realize it needs to check product availability, and generate the correct JSON payload to trigger our Python function.
Create a file named agent.py and drop in the following code:
| |
How It Works
- Local Inference: We pass our prompt to
ollama.chat. The model processes this entirely on your local GPU. No data is sent to OpenAI. - Function Calling: Llama 3.1 recognizes that to fulfill the request, it needs to use the
search_commerce_storetool. It outputs a structured JSON object with the exact parameters needed. - API Execution: Our Python script intercepts that JSON, triggers the
search_commerce_storefunction, and makes the HTTP request to Commerce.com (passing the mock Cloudflare agent auth header). - Synthesis: We take the JSON response from the API and feed it back into the local model. The model synthesizes a natural language response: “I found a FastDrive 2TB NVMe for $129.99, which is under your $150 budget!”
This is the exact workflow that Commerce.com and Cloudflare are optimizing for. The storefront provides the data, Cloudflare provides the secure edge routing, and your homelab hardware provides the AI brain.
Summary
The internet is quietly shifting from a human-centric UI experience to an API-centric machine experience. Commerce.com is restructuring storefronts to serve clean, machine-readable JSON to authenticated agents, while Cloudflare is building the edge infrastructure to route, cache, and secure this new wave of AI traffic.
As self-hosters, this is an incredible opportunity. By leveraging a modest GPU setup in our homelabs—like an RTX 3060 or a Mac Studio—we can run models like Llama 3.1 locally. We can build autonomous agents that interact with this new machine-first internet, all while keeping our data, our prompts, and our shopping preferences completely private.
What do you think? Are you ready to hand over your shopping list to an AI agent running on your own hardware? Let us know what GPU you’re using for local inference in the comments below, and don’t forget to subscribe to the YouTube channel for more deep dives into homelabs, self-hosting, and local AI!