Building Commerce Agents
From protocol understanding to hands-on deployment: building agents that buy, sell, and serve.
The Agent Architecture
A commerce agent is not a chatbot with a payment API. It is an autonomous system that interprets consumer intent, navigates complex decision spaces, executes transactions, and learns from every interaction. Understanding the architecture is essential for building agents that are reliable, safe, and effective.
The Five Components
Every production commerce agent consists of five core components:
Tools: The capabilities the agent can invoke. In commerce, tools include product search, inventory lookup, price comparison, cart management, payment initiation, order tracking, and customer service actions. Each tool is a defined interface with inputs, outputs, and error handling.
Memory: What the agent knows about the consumer and the current session. Short-term memory covers the current conversation (what has been discussed, what preferences have been stated). Long-term memory covers the consumer's history (past purchases, stated preferences, loyalty status, saved payment methods).
Planning: The agent's ability to decompose a complex request into a sequence of actions. "Find me a birthday gift for my partner who likes cooking, under $75, delivered by Friday" requires the agent to plan: interpret preferences, search products, filter by price, check delivery timelines, and present options.
Guardrails: The boundaries within which the agent operates. Spending limits, approved merchant categories, prohibited actions, escalation triggers, and compliance requirements. Guardrails are encoded in policy, not just code, and must be enforceable at runtime.
The Agent Loop: The continuous cycle of observe (receive input or signal), think (plan the next action), act (invoke a tool or respond), and evaluate (assess the outcome and update state). The loop runs until the consumer's intent is fulfilled or the agent determines it cannot proceed.
Agents vs. Chatbots
A chatbot responds to prompts. It waits for input, processes it, and returns output. If the conversation ends, it forgets everything.
A commerce agent pursues goals. It maintains state across interactions, makes decisions without explicit prompting, takes actions with real-world consequences, and adapts its strategy based on outcomes. The difference is not sophistication. It is autonomy.
An agent can decide to search three more merchants before presenting a recommendation. A chatbot only does what you ask it to do.
MCP for Commerce
Model Context Protocol is complementary to commerce protocols. In this section, we get specific about how MCP enables commerce agents to connect to the backend systems they need.
The Connectivity Layer
A commerce agent needs access to:
- Inventory systems: Real-time stock levels, warehouse locations, reorder points, incoming shipments.
- Pricing engines: Current prices, promotional rules, volume discounts, dynamic pricing logic, currency conversion.
- Fulfilment systems: Shipping options, delivery windows, carrier rates, tracking APIs, return processing.
- CRM data: Customer profiles, purchase history, loyalty status, communication preferences, support tickets.
- Product catalogues: Full product attributes, images, specifications, categorisation, related products.
- Payment infrastructure: SPTs, saved payment methods, BNPL eligibility, transaction history.
MCP provides a standardised way for the agent to connect to each of these systems through defined tool interfaces. Instead of building custom API integrations for every backend, the agent uses MCP servers that expose each system's capabilities through a consistent protocol.
Commerce-Specific Performance
Building commerce MCP servers requires attention to specific performance concerns:
Latency sensitivity: Commerce transactions have time expectations. An inventory check that takes 5 seconds is acceptable for a human browsing. For an agent evaluating 20 products, it needs to complete in under 500 milliseconds per query.
Data freshness: Inventory and pricing data must be real-time or near-real-time. An agent that recommends an out-of-stock product or quotes the wrong price damages trust immediately.
Error handling: Every tool call can fail. The agent must handle inventory unavailability, payment declines, fulfilment delays, and system outages gracefully, with fallback strategies for each.
Rate limiting: Commerce APIs typically have rate limits. An agent querying multiple products across multiple merchants can easily exceed limits. The MCP server must implement intelligent rate management.
Conversational Checkout
Microsoft's research describes agentic commerce as "the new front door to retail." The conversation replaces the page. Instead of navigating filters and clicking through product galleries, the consumer expresses intent in natural language and the agent handles everything else.
The Conversation Flow
Intent capture: The consumer states what they want. The agent extracts constraints (budget, timing, preferences, requirements) and confirms understanding.
Discovery: The agent searches across available products, evaluating options against the stated constraints. It may ask clarifying questions if the intent is ambiguous.
Presentation: The agent presents a curated shortlist with clear reasoning for each recommendation. Not 50 results. Three to five options with explicit trade-offs.
Refinement: The consumer reacts. They might narrow preferences, adjust budget, or ask for alternatives. The agent refines its recommendations in real time.
Decision: The consumer selects a product. The agent confirms the choice, presents the total cost, and requests payment authorisation.
Execution: The agent initiates payment through SPTs or the appropriate payment rail, confirms the order, and provides tracking information.
Follow-up: Post-purchase, the agent can handle delivery updates, returns, reorders, and related recommendations.
Design Principles
Transparency: The agent always explains why it recommends something. "I chose this because it fits your budget and has next-day delivery" builds trust. Black-box recommendations erode it.
Control: The consumer can override any recommendation, adjust parameters, or take manual control at any point. The agent assists, it does not dictate.
Graceful degradation: When the agent cannot fulfil a request (product unavailable, budget too restrictive, timing impossible), it explains why and offers alternatives rather than failing silently.
Escalation: Complex situations (disputes, exceptions, ambiguous requests) should escalate to human agents with a full summary of the conversation and the agent's assessment.
Deployment Models
There are three primary deployment models for commerce agents, each with different strategic implications.
Owned Storefront Agent
An agent deployed on your own website, app, or messaging channel. It represents your brand, sells your products, and operates within your ecosystem.
Advantages: Full control over the experience, direct access to customer data, no platform fees, ability to customise for your specific product knowledge.
Challenges: You must build and maintain the agent infrastructure, handle scaling, and drive traffic to your own properties.
Best for: Brands with complex products requiring expert guidance, high-value purchases where trust matters, businesses with existing direct-to-consumer channels.
Marketplace Agent
An agent that operates within a third-party platform (ChatGPT app, Google Shopping, marketplace integration). It represents your brand but operates within someone else's rules.
Advantages: Access to the platform's existing user base, lower infrastructure costs, built-in trust from the platform brand.
Challenges: Platform fees, limited control over the experience, data sharing restrictions, dependency on platform policies.
Best for: Brands seeking discovery and reach, commoditised products where convenience matters, businesses entering new markets.
Hybrid Model
Most sophisticated operators will use both. Third-party marketplace agents drive discovery and capture demand from consumers who are not yet in your ecosystem. Owned storefront agents convert that demand into deep relationships and capture the intelligence feedback loop.
Marketplace agents generate transactions. Owned agents generate intelligence. Both generate revenue, but only intelligence compounds over time.
Agent-Native Loyalty
Traditional loyalty programmes reward purchases with points. Agent-native loyalty programmes reward engagement and create a feedback loop that makes the agent smarter with every interaction.
The Feedback Loop
Every agent interaction generates data:
- What the consumer searched for, what they considered, what they rejected, and why.
- Price sensitivity thresholds, brand preferences, feature priorities.
- Delivery preferences, return patterns, seasonal buying behaviour.
- How they responded to recommendations: accepted, modified, or overridden.
This data feeds back into the agent's recommendation engine, making each subsequent interaction more relevant. A loyalty programme built on this feedback loop does not just reward past purchases. It improves future experiences.
Designing Agent-Native Loyalty
Reward engagement, not just transactions. A consumer who interacts with the agent, provides preference data, and refines recommendations is more valuable than one who makes a single purchase.
Personalise rewards based on agent intelligence. The agent knows the consumer's preferences. Offer rewards that align with what they actually want, not generic discounts.
Create switching costs through intelligence. The more a consumer interacts with your agent, the better it understands them. Switching to a competitor means starting from zero. This is the most powerful loyalty mechanism: the relationship itself.
Of owned agents, marketplace agents, or hybrid approaches, which deployment model aligns best with your product complexity and customer relationships?
Key Takeaways
- Five components define agents: Tools, memory, planning, guardrails, and the agent loop form the architecture of every production commerce agent.
- MCP is the connectivity layer: Commerce agents connect to inventory, pricing, fulfilment, CRM, and payment systems through MCP servers with commerce-specific performance requirements.
- Conversation replaces the page: Conversational checkout follows intent capture, discovery, presentation, refinement, decision, execution, and follow-up. Transparency and control are non-negotiable.
- Three deployment models: Owned agents build intelligence, marketplace agents drive discovery, hybrid approaches capture both. Intelligence compounds; transactions do not.
- Loyalty is the feedback loop: Agent-native loyalty rewards engagement, personalises through intelligence, and creates switching costs through relationship depth.