---
title: AI Margin Intelligence Agent: Which eCommerce Products Are Actually Profitable? (2026)
description: Merch features last week's revenue heroes. ERP cost is empty. Fill the margin contract first: the answer is unknown if cost is missing, and there is no ranked profit list. The ~$791/mo platform cost floor at 50,000 sessions is planning cost, not margin found.
url: https://www.joinhorizon.co/blog/ai-margin-intelligence-ecommerce-2026/
datePublished: 2026-08-27T00:00:00.000Z
dateModified: 2026-10-28T00: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)

> Merch features last week's revenue heroes. ERP cost is empty. Fill the margin contract first: the answer is unknown if cost is missing, and there is no ranked profit list. The ~$791/mo platform cost floor at 50,000 sessions is planning cost, not margin found.

Thursday, merch pulls last week's revenue rank and calls them profit heroes. Finance opens ERP, where `product_cost` is empty for half the category. Ads, shipping, and returns never joined the slide. After **July 30, 2026**, new agents should not start on the older Agents Classic product.

Revenue is not 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, and only when the [data contract](https://www.joinhorizon.co/examples/architecture-blog-2026/ecommerce-ai-agents-series/margin-intelligence-data-contract.md) is filled. If cost is missing, the answer is **unknown**, not a number the model invents.

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

**The job.** Answer which SKUs are contribution-positive when cost, discounts, shipping, returns, ads, and fees exist in named tools. Refuse rank-as-truth when any required term is missing.

**This week.** Clone the margin contract. Sit with finance. Name the source for each field. If `product_cost` is empty, stop and fix costing before you host a loop.

**A person still signs.** Live price, vendor cost, and markdown moves stay HITL-owned.

**Skip it when** a Looker tile already computes contribution with finance-owned allocation and nobody is pasting CSVs. Keep the tile.

**Our 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. Without them you get a confident GM% that is a vibe.

> **Copy the margin contract:** Open [`margin-intelligence-data-contract.md`](https://www.joinhorizon.co/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`, so do not submit a ranked "winners" slide. Series folder: [`ecommerce-ai-agents-series/`](https://www.joinhorizon.co/examples/architecture-blog-2026/ecommerce-ai-agents-series/README.md). Ship gates: [`monday-checklist.md`](https://www.joinhorizon.co/examples/architecture-blog-2026/ecommerce-ai-agents-series/monday-checklist.md).

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

This is **not** [excess inventory](https://www.joinhorizon.co/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. It shares the Gateway family but asks a different question and needs 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.

## 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.

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.joinhorizon.co/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](https://www.joinhorizon.co/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.

## Do not start with AWS

Procurement wants a stack slide. The honest order is business contract → tools → host.

| 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) |

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.

```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.

## For your technical lead

**On June 17, 2026**, AgentCore **Harness** reached general availability. It is 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. **Agents Classic** is in maintenance for new customers after **July 30, 2026**. Net-new margin agents should use [Bedrock AgentCore](https://www.joinhorizon.co/blog/amazon-bedrock-agentcore-production/). Full matrix: [lifecycle roundup](https://www.joinhorizon.co/blog/aws-service-lifecycle-updates-june-2026/).

> **First-party signals we reuse (not store results):** Gateway server-side tools cut median tool round-trip **~180 ms → ~95 ms** on a **B2B CRM assistant** (12 tools, ~8k turns/day), from the [Gateway post](https://www.joinhorizon.co/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](https://www.joinhorizon.co/blog/aws-bedrock-agentcore-vs-amazon-q-enterprise-decision-guide-2026/)). Model your mix on the [AgentCore pricing calculator](https://www.joinhorizon.co/tools/amazon-bedrock-agentcore-pricing-calculator/). Treat **~$791/mo** as a **platform cost floor to plan against**; it is not margin the agent will find.

> **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](https://www.joinhorizon.co/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`.

**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.

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.

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.

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

- [Excess / dead stock](https://www.joinhorizon.co/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](https://www.joinhorizon.co/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](https://www.joinhorizon.co/blog/ai-pricing-intelligence-agent-ecommerce-2026/): should you change **this** list price. It consumes margin inputs; it does not invent them.
- [Data layer](https://www.joinhorizon.co/blog/ai-ready-ecommerce-data-layer-2026/): join keys and `asOf`. Margin is the first finance-shaped consumer of that layer.

## What to do this week

1. Clone [`margin-intelligence-data-contract.md`](https://www.joinhorizon.co/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](https://www.joinhorizon.co/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](https://www.joinhorizon.co/contact-us/). Bring the filled contract, not a promised GM$ recovery. Architecture: [Amazon Bedrock](https://www.joinhorizon.co/services/aws-bedrock/), [Generative AI on AWS](https://www.joinhorizon.co/services/generative-ai-on-aws/), [AWS for retail / eCommerce](https://www.joinhorizon.co/industries/aws-retail-ecommerce/).
9. To scope this as one first workflow rather than a fleet, start from the [AI inventory agent](https://www.joinhorizon.co/ai-agents/inventory/) page.

Full ship list: [`monday-checklist.md`](https://www.joinhorizon.co/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 the evals, as well as the prompt. Revenue charts are already cheap. Fiction GM% is expensive.

## 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](https://www.joinhorizon.co/blog/ai-agent-excess-inventory-dead-stock-ecommerce-2026/)
- Live list-price Execute: [pricing intelligence](https://www.joinhorizon.co/blog/ai-pricing-intelligence-agent-ecommerce-2026/)
- Personalized offer classes: [offers](https://www.joinhorizon.co/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](https://www.joinhorizon.co/blog/amazon-bedrock-agentcore-production/)

## 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. See [pricing intelligence](https://www.joinhorizon.co/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. See [excess inventory](https://www.joinhorizon.co/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.

---

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

## How the margin intelligence stays bounded

Show which SKUs are profitable from cost, price, and fee inputs the tools return.

- **Maturity:** Level 2 — reference architecture
- **Risk:** high
- **Oversight:** approval
- **Starts when:** A margin review, or a question about true profit for a SKU.
- **Tools:** Reads only, through named tools. No shell, no unrestricted SQL, and no undeclared API.
- **Stops for a person:** The agent does not reprice. A suggested price is a proposal for merchandising.
- **Checked by:** Profit uses the stated cost inputs. Missing cost is missing, not zero.
- **Untrusted data:** Vendor invoices pasted in that contradict the cost system.
- **If it fails:** If the margin intelligence stops, name the reason: completed, budget_exceeded, timed_out, cancelled, guardrail_blocked, approval_required, tool_failure, verification_failed, or partial_completion. Retry a timeout at most twice. Back off on rate limits. After repeated verification failure, escalate. Stop when the budget is exhausted or a permission is denied. No unbounded loop. The agent does not reprice. A suggested price is a proposal for merchandising.
- **Lifecycle:** Explore, then act, then confirm, then verify. Explore gathers the context for the margin intelligence. Act stays reversible. Confirm stops before an irreversible step. Verify is a separate check of the outcome.

Reference architecture, not a published production deployment. The shared contract is the [AWS store-agent architecture](https://www.joinhorizon.co/blog/aws-ai-agents-for-ecommerce-factualminds-2026/#operating-contract).

## 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. See 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. See 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.joinhorizon.co/blog/ai-margin-intelligence-ecommerce-2026/*
