---
title: AI Margin Intelligence Agent: Which eCommerce Products Are Actually Profitable? (2026)
description: Revenue is not profit. Rank SKUs only when cost, discounts, shipping, returns, ads, and fees exist — else unknown. Reuse Gateway ~180→95 ms and ~$791/mo at 50K sessions.
url: https://www.factualminds.com/blog/ai-margin-intelligence-ecommerce-2026/
datePublished: 2026-08-27T00:00:00.000Z
dateModified: 2026-08-27T00:00:00.000Z
author: palaniappan-p
category: AI Agents
tags: ai-agents, ecommerce, amazon-bedrock, bedrock-agentcore, generative-ai, operations
---

# AI Margin Intelligence Agent: Which eCommerce Products Are Actually Profitable? (2026)

> Revenue is not profit. Rank SKUs only when cost, discounts, shipping, returns, ads, and fees exist — else unknown. Reuse Gateway ~180→95 ms and ~$791/mo at 50K sessions.

**Revenue ≠ profit.** A SKU can grow GMV and destroy contribution once you subtract discounts, product cost, merchant-borne shipping, allocated returns, ads, and marketplace fees. This post is **AI margin intelligence**: which products are actually profitable — only when the [data contract](https://www.factualminds.com/examples/architecture-blog-2026/ecommerce-ai-agents-series/margin-intelligence-data-contract.md) is filled. If cost is missing, the answer is **unknown**. It is not a number the model invents.

**On June 17, 2026**, AgentCore **Harness** reached general availability — a config-driven loop that can schedule a contribution job ([What's New](https://aws.amazon.com/about-aws/whats-new/2026/06/amazon-bedrock-agentcore-harness-generally-available/)). That date made a first production loop cheap to **start**. It did not tell you which SKUs are profitable. After July 30, 2026, Agents Classic is the wrong net-new host.

> **AWS lifecycle notice (June 30, 2026)** — Amazon Bedrock Agents Classic is in maintenance for new customers after **July 30, 2026**. Net-new margin agents should use [Bedrock AgentCore](/blog/amazon-bedrock-agentcore-production/). Full matrix: [lifecycle roundup](/blog/aws-service-lifecycle-updates-june-2026/).

This is **not** [excess inventory](/blog/ai-agent-excess-inventory-dead-stock-ecommerce-2026/) (post 23). Excess asks how to **exit units you already own**. Margin asks whether the unit **should have been sold** on contribution. Same Gateway family. Different question. Different evals.

It is **not** a client engagement. We do not publish a merchant GM%, a recovered-margin dollar, or a "unprofitable SKU count." Fields and formulas below are a contract for **you** to fill.

> **First-party signals we reuse (not eCommerce outcomes)** — Gateway server-side tools cut median tool round-trip **~180 ms → ~95 ms** on a **B2B CRM assistant** (12 tools, ~8k turns/day) — [Gateway post](/blog/amazon-bedrock-agentcore-gateway-server-side-tool-execution-2026/). Platform TCO silhouette: support-style AgentCore at **50K sessions/mo ~$791/mo** platform + model ([decision guide](/blog/aws-bedrock-agentcore-vs-amazon-q-enterprise-decision-guide-2026/)). Model your mix on the [AgentCore pricing calculator](/tools/amazon-bedrock-agentcore-pricing-calculator/). Treat **~$791/mo** as a **platform cost floor to plan against**, not as margin the agent will find.

> **Reproduce this** — Copy [`margin-intelligence-data-contract.md`](https://www.factualminds.com/examples/architecture-blog-2026/ecommerce-ai-agents-series/margin-intelligence-data-contract.md). Fill **your** source systems. If `product_cost` is empty, the row is `unknown` — do not submit a ranked "winners" slide. Series folder: [`ecommerce-ai-agents-series/`](https://www.factualminds.com/examples/architecture-blog-2026/ecommerce-ai-agents-series/README.md). Ship gates: [`monday-checklist.md`](https://www.factualminds.com/examples/architecture-blog-2026/ecommerce-ai-agents-series/monday-checklist.md).

This is series part 49. It sits on the [AI-ready data layer](/blog/ai-ready-ecommerce-data-layer-2026/) (join keys, `asOf`, named tools — not `SELECT *`). Inventory cover still belongs to [reorder](/blog/ai-inventory-agent-reorder-ecommerce-2026/). Live list price belongs to [pricing intelligence](/blog/ai-pricing-intelligence-agent-ecommerce-2026/). Do not merge the three prompts in week one.

**Opinionated take:** if any required cost term is missing, return **`unknown` and refuse to rank as truth**. Trade-off: finance waits for ERP costing and a named ad-allocation rule. The alternative is a confident GM% that is a vibe.

FactualMinds is an AWS Select Tier Consulting Partner. We help merchants sequence agents — we do not sell a guaranteed profitability dashboard.

## Why revenue rankings lie

OMS net revenue is easy. Contribution is not. Discounts sit in promo. Cost sits in ERP. Shipping sits in 3PL invoices. Returns sit in RMA plus restocking and inbound freight. Ads sit in a platform with an attribution argument. Marketplace fees sit on the channel settlement.

**Why this matters / who breaks without it:** merchandising features last week's revenue heroes. Paid media keeps bidding. Excess-inventory work (post 23) markdowns aging units **without** knowing whether the SKU was ever contribution-positive. Finance breaks when the board is shown a ranked list that skipped cost. The agent is useful when those inputs live in **different** systems and someone still wants a single answer.

If a Looker tile already computes contribution with finance-owned allocation and nobody is pasting CSVs, **do not wrap that tile in an agent**. Keep the tile. Use the agent only to **join** incomplete sources, flag missing fields, and recommend a next action that a human owns.

## How stores handle this today

A weekly GM% export. A merch meeting that treats revenue rank as profit rank. An ads manager allocating spend by last-click. A 3PL bill that never hits the SKU. Shopify reports that stop at product cost **if** cost was typed into Admin — and many catalogs never were.

Those are **reports**. Keep them. The agent is for the messy join: this SKU, this period, these named tools, this `asOf`. It is not a second general ledger.

Shopify Flow "if revenue > N then tag bestseller" is not this job. Flow cannot allocate return cost or ads. Keep Flow for the tag. Keep the agent for the contract. Keep finance for the rank.

## The contract (inputs, not a FactualMinds margin)

From [`margin-intelligence-data-contract.md`](https://www.factualminds.com/examples/architecture-blog-2026/ecommerce-ai-agents-series/margin-intelligence-data-contract.md):

```text
Contribution-ish view (only if all inputs exist) =
  Selling price
    − Discounts
    − Product cost
    − Shipping (merchant-borne)
    − Returns cost (allocated)
    − Advertising (allocated, method named)
    − Marketplace fees (if relevant)
```

If any term is missing, **do not publish a ranking presented as truth**.

| Field | Source system | If missing |
| ----- | ------------- | ---------- |
| `sku` | PIM / storefront | Stop |
| `units_sold` | OMS | Stop |
| `net_revenue` | OMS / finance | Stop |
| `product_cost` | ERP / costing | `unknown` — **no rank** |
| `discount_amount` | OMS / promo | Assume 0 only if promo engine confirms none |
| `shipping_cost_merchant` | 3PL / finance | `unknown` |
| `return_cost_allocated` | RMA + finance | `unknown` or exclude from rank |
| `ad_cost_allocated` | Ads + **named** attribution rule | `unknown` — name the rule or skip |
| `marketplace_fees` | Channel | 0 if D2C-only and **confirmed** |

**Agent answers:**

- "Which products are generating **profitable** growth?" — only with the contract filled.
- "Which products grew **revenue**?" — allowed with OMS only; **label it revenue, not profit**.

Demo SKUs in your worksheet are **fixtures**. Do not treat a sample contribution as a client outcome.

## What the agent can automate

- Read named tools: OMS revenue and units, ERP cost, promo discounts, 3PL shipping, RMA allocation, ads allocation, marketplace fees.
- Return `profitable` / `unprofitable` / `unknown` with `evidence_tool` + `evidence_ref` per term.
- Recommend **investigate cost**, **stop ranking**, **hand to pricing**, or **hand to excess** — not a live price write.
- Refuse the profitable-growth question when `product_cost` is empty.

It cannot invent COGS because "the category average is probably fine." It cannot allocate ads without a rule id. It cannot Execute `updatePrice`.

## What stays deterministic

- Finance-owned allocation methods (returns, ads). The agent cites the method; it does not legislate last-click vs data-driven.
- Promo engine discount totals. Do not re-parse chat for "we gave them 20%."
- D2C vs marketplace fee presence — a channel flag, not a model guess.
- [Data-layer](/blog/ai-ready-ecommerce-data-layer-2026/) join keys. If Shopify id ≠ ERP id, the row is unknown until the join exists.

```mermaid
flowchart TD
  skuPeriod[SKU and period]
  tools[Named cost revenue shipping returns ads fee tools]
  complete{All required terms present?}
  unknown[Return unknown — no rank as truth]
  contrib[Contribution view]
  rec[Recommend only]
  hitl[Human owns price cost and markdown]
  skuPeriod --> tools
  tools --> complete
  complete -->|no| unknown
  complete -->|yes| contrib
  contrib --> rec
  rec --> hitl
```

**SKU + period → tools → complete? → unknown or contribution → recommend → human.** Detection of missing cost is **deterministic** (null field). Using the model as the only costing system is how you ship fiction.

## Production shape

**Bedrock** is the model layer, not the host. **Harness** (GA June 17, 2026) or **Runtime** hosts the loop. **Gateway + Cedar** on every price and vendor-cost write. **Strands** is a framework you may run **on** Runtime — it does not provide Firecracker isolation, Gateway, Identity JWT, or Cedar. Browser and Code Interpreter **off**. Next.js can be a finance review UI — not the runtime.

| Piece | Role here |
| ----- | --------- |
| **Gateway** | `getRevenue`, `getProductCost`, `getDiscounts`, `getShippingCost`, `getReturnCost`, `getAdCost`, `getMarketplaceFees` — reads |
| **Policy (Cedar)** | Default-deny `updatePrice`, `updateVendorCost`, `createDiscount`. This specialist should not even see those tools in week one |
| **Identity** | Finance / merch associate JWT. Shopper tokens never see cost |
| **Memory** | Period + sku list for the job; do not store raw PII from ads accounts |
| **Knowledge Bases** | Allocation SOP PDFs — documents, not a substitute for the tool |
| **Observability** | `unknown` rate, missing-field mix, attempted price writes (must be zero) |

Absolute latency will be ERP and ads APIs, not Gateway. The ~180 ms → ~95 ms figure is the CRM **platform** canary after server-side tools. Use it to decide Gateway placement, not to SLA a costing export. A once-per-morning brief is cheap; a chatty "is this profitable?" copilot on every merch question is not. Model the mix on the [AgentCore pricing calculator](/tools/amazon-bedrock-agentcore-pricing-calculator/).

There is **no native Shopify AgentCore connector**. Admin product cost, if it exists, is one optional source. ERP is usually the system of record. Attach **your** OpenAPI.

Context: Python 3.12+ if you also clone store-agents stubs; AgentCore Harness GA **June 17, 2026** or Runtime; Gateway OpenAPI; Cedar `LOG_ONLY` then `ENFORCE` before any write tool exists.

```text
# From margin-intelligence-data-contract.md — fill sources for your store
product_cost missing     → unknown, no rank
ad_cost without rule id  → unknown or exclude from rank
D2C confirmed, no MP     → marketplace_fees = 0
promo engine says none   → discount_amount = 0
else                     → do not invent the term
```

Week-one evals: empty cost must not emit a ranked profitable list; revenue-only answers must include the label `revenue_not_profit`; `updatePrice` on this specialist's token must DENY.

## What broke

> **What broke** — A sample harness ranked `SKU-HOOD-GRY-XL` as a "profit hero" from OMS net revenue because `getProductCost` returned null and the prompt said "use 40% GM if missing." Ads were unallocated. **Detection:** eval required `product_cost` present before any `profitable` label; the turn had revenue only. **Fix:** contract returns `unknown`; refuse rank-as-truth; finance fills costing before merch sees a list. **Lesson:** missing cost is not a default GM%. A ranking without the contract is a revenue chart with better typography.

A second counter-case: merging this specialist with [excess inventory](/blog/ai-agent-excess-inventory-dead-stock-ecommerce-2026/). The model recommended markdown-first because aging was 112 days on a SKU that was contribution-negative **and** had an open PO. Excess already forbids markdown-without-inbound. Margin must not become a second markdown bot. **Fix:** margin recommends `hand_to_excess` or `hand_to_pricing` with evidence; it does not call `updatePrice`.

## How this relates to inventory, pricing, and the data layer

- [Excess / dead stock](/blog/ai-agent-excess-inventory-dead-stock-ecommerce-2026/): exit actions (stop-buy, transfer, bundle, promo, liquidation). Needs a GM% **floor** you already trust. This post is how you know whether you **have** contribution inputs at all.
- [Inventory reorder](/blog/ai-inventory-agent-reorder-ecommerce-2026/): what to buy. Do not reorder on revenue rank. If contribution is `unknown`, the reorder brief should say so.
- [Pricing intelligence](/blog/ai-pricing-intelligence-agent-ecommerce-2026/): should you change **this** list price. It consumes margin inputs; it does not invent them.
- [Data layer](/blog/ai-ready-ecommerce-data-layer-2026/): join keys and `asOf`. Margin is the first finance-shaped consumer of that layer.

## What This Post Doesn't Cover

- A measured GM%, contribution dollar, or unprofitable-SKU count from a FactualMinds commerce engagement
- Excess-inventory action order (stop-buy first) — [post 23](/blog/ai-agent-excess-inventory-dead-stock-ecommerce-2026/)
- Live list-price Execute — [pricing intelligence](/blog/ai-pricing-intelligence-agent-ecommerce-2026/)
- Personalized offer classes — [offers](/blog/ai-agents-personalized-offers-ecommerce-2026/)
- Full activity-based costing, warehouse labor standards, or tax
- Last-click vs MTA as a FactualMinds recommendation — **name your rule**, then encode it
- PCI-scoped payment automation or AgentCore Payments / x402
- A native Shopify AgentCore costing app (it does not exist)
- Classic Agents cutover — [production guide](/blog/amazon-bedrock-agentcore-production/)

## What to Do This Week

1. Clone [`margin-intelligence-data-contract.md`](https://www.factualminds.com/examples/architecture-blog-2026/ecommerce-ai-agents-series/margin-intelligence-data-contract.md). Sit with finance. Name the source for each field.
2. If `product_cost` is empty for the category you care about, **stop**. Fix costing. Do not staff an agent.
3. Draft **read** OpenAPI only: revenue, cost, discounts, shipping, returns, ads, fees. No price write.
4. Stand up Harness (GA June 17, 2026) or Runtime; Gateway; Policy **`LOG_ONLY`**. Identity: associate / finance only.
5. Eval: null cost → `unknown`; revenue-only answers must not say profitable; attempted `updatePrice` DENY.
6. Keep the existing GM% tile if it already has finance-owned allocation. Add the agent only to join gaps.
7. Price the job on the [AgentCore pricing calculator](/tools/amazon-bedrock-agentcore-pricing-calculator/). A morning brief should notice a ~$791/mo floor at 50K sessions; a demo that cannot describe volume will not.
8. Book a conversation — [contact us](/contact-us/). Bring the filled contract, not a promised GM$ recovery. Architecture: [Amazon Bedrock](/services/aws-bedrock/), [Generative AI on AWS](/services/generative-ai-on-aws/), [AWS for retail / eCommerce](/industries/aws-retail-ecommerce/).

Full ship list: [`monday-checklist.md`](https://www.factualminds.com/examples/architecture-blog-2026/ecommerce-ai-agents-series/monday-checklist.md).

## If You Only Do One Thing
Encode **missing cost → unknown, no rank as truth** in the tool contract and in evals — not only in the prompt. Revenue charts are already cheap. Fiction GM% is expensive.

Need a contribution contract that refuses to invent COGS? [Contact FactualMinds](/contact-us/) for an Agent Opportunity Assessment conversation, or start from the [15 automations pillar](/blog/ai-agents-for-ecommerce-15-automations-2026/).

## FAQ

### When should we NOT rank products as profitable with an AI agent?

Do not publish a profit ranking when `product_cost` is missing, when ad allocation has no named rule, or when merchant-borne shipping and return cost are unknown. Revenue growth from OMS is allowed — label it revenue, not profit. An agent that fills COGS from a guess is a finance incident.

### What could go wrong if the agent ranks on revenue alone?

Hero SKUs with heavy discounting, free shipping, and paid traffic look like winners while contribution is negative. Merch features them, ads keep spending, and excess-inventory markdowns fire on the wrong SKU. The contract refuses rank-as-truth when any required term is missing.

### When should we NOT let this agent change price or vendor cost?

Always in week one, and later only as HITL. Live price, markdown, and vendor cost edits move money. This specialist is read plus recommend. Pricing writes belong in the pricing-intelligence post with Cedar and a named owner — not in a margin brief. [pricing intelligence](/blog/ai-pricing-intelligence-agent-ecommerce-2026/).

### What could go wrong if we merge this prompt with excess inventory?

Post 23 asks how to exit aging units. This post asks which SKUs are actually profitable. A merged specialist will markdown a high-velocity thin-margin SKU because aging was 90 days, or stop-buy a profitable slow mover. Separate tools, separate evals, separate owners. [excess inventory](/blog/ai-agent-excess-inventory-dead-stock-ecommerce-2026/).

### Should margin intelligence run on Harness or Runtime?

Harness fits a scheduled contribution job with named read tools and a JSON schema. Use Runtime plus Strands if margin, pricing, and merchandising specialists must not share write tools. Bedrock is the model. Strands is not Gateway, Identity, or Policy. Net-new builds should not use Agents Classic after July 30, 2026.

### Is there a native Shopify AgentCore connector for cost and ads?

No. Cost lives in ERP or costing. Ads live in the ad platform plus your attribution rule. Returns live in RMA. Attach those as OpenAPI or MCP on Gateway. Do not wait for a Shopify AgentCore profitability app. Do not put payment capture in this tool list.

## FAQ

### When should we NOT rank products as profitable with an AI agent?
Do not publish a profit ranking when product_cost is missing, when ad allocation has no named rule, or when merchant-borne shipping and return cost are unknown. Revenue growth from OMS is allowed — label it revenue, not profit. An agent that fills COGS from a guess is a finance incident.

### What could go wrong if the agent ranks on revenue alone?
Hero SKUs with heavy discounting, free shipping, and paid traffic look like winners while contribution is negative. Merch features them, ads keep spending, and excess-inventory markdowns fire on the wrong SKU. The contract refuses rank-as-truth when any required term is missing.

### When should we NOT let this agent change price or vendor cost?
Always in week one, and later only as HITL. Live price, markdown, and vendor cost edits move money. This specialist is read plus recommend. Pricing writes belong in the pricing-intelligence post with Cedar and a named owner — not in a margin brief. pricing intelligence.

### What could go wrong if we merge this prompt with excess inventory?
Post 23 asks how to exit aging units. This post asks which SKUs are actually profitable. A merged specialist will markdown a high-velocity thin-margin SKU because aging was 90 days, or stop-buy a profitable slow mover. Separate tools, separate evals, separate owners. excess inventory.

### Should margin intelligence run on Harness or Runtime?
Harness fits a scheduled contribution job with named read tools and a JSON schema. Use Runtime plus Strands if margin, pricing, and merchandising specialists must not share write tools. Bedrock is the model. Strands is not Gateway, Identity, or Policy. Net-new builds should not use Agents Classic after July 30, 2026.

### Is there a native Shopify AgentCore connector for cost and ads?
No. Cost lives in ERP or costing. Ads live in the ad platform plus your attribution rule. Returns live in RMA. Attach those as OpenAPI or MCP on Gateway. Do not wait for a Shopify AgentCore profitability app. Do not put payment capture in this tool list.

---

*Source: https://www.factualminds.com/blog/ai-margin-intelligence-ecommerce-2026/*
