Context
Our client runs an e-commerce business across several Shopify stores serving several countries. As the business grew, so did its stack. Each store held its own operational data. Advertising performance lived in Meta and other ad platforms. Customer conversations arrived through separate social channels. Creative assets accumulated across folders and campaigns. Returns and order queries were handled somewhere else again.
Every system worked. None of them shared an intelligence layer. A question as ordinary as “what changed yesterday across the business, and why?” meant assembling the answer by hand from multiple stores, advertising accounts, currencies and countries.
The next step was not another dashboard.
Problem
The hard part was never building a chatbot.
An agent analysing sales needs orders, ad spend, returns, discounts, product data and costs. A customer-service agent needs live order and tracking records. A comment agent needs enough commerce context to tell a product question from an actual order problem. Building each one separately would have rebuilt exactly the fragmentation the client wanted to remove — and the environment was already awkward: the same product appeared in several stores under different identifiers, stores ran in different currencies and time zones, and ad accounts did not follow Shopify’s naming.
Underneath sat the real engineering constraint. Giving a language model unrestricted access to production commerce systems is unsafe. An analytical agent must not be able to refund an order. A support agent must not be able to change an advertising budget. A model must not calculate contribution margin differently each time it is asked.
So the requirement was not agents. It was the layer they stand on: a shared data model, a controlled tool layer, permissions, workflow state, auditability and human approval boundaries.
Approach
We built it as a commerce operating system rather than a collection of bots.
Connect each system once. Shopify stores, advertising platforms, social channels, support systems and creative repositories feed one integration and event layer — agents do not build their own integrations per store. Every event enters carrying its business context: brand, store, market, country, currency, channel.
Normalise without flattening. Orders, products, campaigns, spend, creatives, refunds, discounts, costs and conversations map to a common model while the source records are preserved. Both local and reporting currencies are kept, so revenue earned in euros stays identifiable as euros even when reporting converts it.
Separate calculation from interpretation. Revenue, COGS, gross and contribution margin, ROAS, MER, CAC, AOV and refund rates are computed by deterministic application and database logic. The model does not invent those numbers. It receives verified metrics and does what it is genuinely better at — explaining what changed and what deserves attention.
Scope every tool. Agents reach the platform only through explicit tools — getOrder(),
getCampaignMetrics(), checkReturnEligibility(), createReturn(), replyToComment() — and
each holds only the tools its responsibility requires. Reads can run automatically; higher-risk
actions require human approval.
What we built
The Commerce Intelligence Agent came first, deliberately. It is read-only, immediately useful to management, and building it forced the hardest underlying problem to be solved first: one trustworthy analytical model spanning stores, countries and currencies. Management can ask across the business — why revenue rose while contribution margin fell, which products sell well but lose money after advertising and discounts — and the agent investigates downward from company to country, store, product, campaign and creative.
The Margin Agent carries that past top-line revenue, evaluating profitability by product, store, country and campaign. A campaign producing more revenue is not necessarily producing more profit.
The Customer Service Agent handles order status, tracking, common product questions and return requests. It never infers an order’s state from the conversation; it calls the tool, retrieves the record, and answers from verified data. Returns and refunds follow the client’s approval rules.
The Comment Agent classifies intent before it acts. A product question, a shipping query and a reputational complaint do not deserve the same workflow. Low-risk replies go automatically; sensitive ones escalate to a person.
The Creative Librarian Agent uses multimodal models to classify advertising images and video by product, market, language, format, hook and angle — so the question stops being “where is that file” and becomes “what about our creatives is actually working”.
An AI Control Center shows which agents are running, over which stores and countries, with their executions, failures, escalations, approvals and model usage. Every significant action is logged with its model, prompt version, tool call, parameters and approval state — an audit trail, rather than business actions buried inside model conversations.
Improvement is deliberate rather than autonomous. Production agents cannot rewrite their own rules. Corrections, escalations and outcomes become evaluation data, and a candidate prompt or workflow change has to beat the current version against that dataset before it ships. The model layer stays vendor-neutral: OpenAI and Anthropic models sit behind a common interface, so classification, reasoning and vision workloads each use what suits them.
Outcome
Each Shopify store, advertising account and social channel is now an input to a shared commerce model rather than another isolated source of truth.
Management gets a cross-store, cross-country view without forcing the underlying businesses to behave as a single store. Operational teams get agents that retrieve, investigate, organise and prepare work inside explicit permission boundaries. Advertising can be read against margin rather than ROAS alone, creative performance against what is actually in the image, and customer conversations against live order state.
The same architecture takes further agents — inventory risk, campaign anomalies, localisation, dispute evidence — without adding another disconnected integration stack.
The outcome is not the number of agents. It is that AI works inside the commerce operation rather than beside it.
Related
AI Engineering · Agentic AI · E-commerce Automation · LLM Applications · Multimodal AI · Evaluations and Guardrails