← Selected work

Case study · AI · Incident diagnosis

Finding why carts failed, with an AI agent

A client had millions of reais in GMV at risk from carts failing at checkout, and everyone assumed it was stock. I built an agent with Claude Code that found the cause in hours instead of about two days, and it was not stock.

Role
Customer Success Manager
When
April 2026
Tools
Claude Code, live logistics APIs
Shared at
Claude Meetup Rio #5, June 2026
Pedro Amodeo on stage with a microphone, presenting this case at Claude Meetup Rio #5
Presenting this case at Claude Meetup Rio #5, June 2026.

The situation

During VTEX Day, I noticed that cart simulations for a consumer brand were failing and flagged it to the client on the spot. Their cart-unavailability rate was high: shoppers were reaching checkout and finding items they could not buy, at a volume large enough to put millions of reais in GMV at risk in a single quarter.

The problem

The first hypothesis, theirs and mine, was stock. The data to check it existed but was unstructured: an export of tens of thousands of failed items and a partial report with a few causes. Testing each case by hand against the live logistics setup would have taken about two days, and the answer depended on details of this account that no generic analysis would know.

What I did

  1. Wrote down what the agent couldn't know

    An agent doesn't know the client by default. Before asking it anything, I wrote the account's context into a file it loads every time: which sales channels count, how the logistics chain is built, and the rules the analysis has to follow.

    client-context.md · excerpt, anonymized
    ## Sales channels
    Main store        include
    External channel  empty, exclude
    
    ## Logistics
    Multi-warehouse. Store = warehouse.
    warehouse → dock → policy → freight
    One broken link: product disappears.
    
    ## Analysis rules
    Risk = failed carts × median ticket
    Never list price: it inflates risk.
    Report only causes above a set volume.
  2. Let the agent do the cross-checking

    With the context loaded, the agent queried the platform's logistics APIs in real time, cross-referenced every failed item in the export with the API diagnosis, and ranked the root causes by volume.

  3. Made the judgment calls myself, then wrote them down

    Excluding the channel that is empty by design, measuring risk by the median ticket instead of list price, and setting the bar for a real cause were my decisions; the context file makes the agent apply them every time. Without them the same agent would have produced a fast, confident, wrong answer.

  4. Turned the answer into something the client could act on

    The output was three artifacts: an audit with the API evidence for each cause, an interactive dashboard, and a playbook with actions ordered by priority and owner. I presented the findings to the client's CEO.

How the agent ran

In

  • Export of failed items
  • Partial availability report
  • Account context file

Agent

  1. Routes to the account's workspace
  2. Loads the account context
  3. Queries logistics APIs live
  4. Cross-checks every item
  5. Ranks root causes by volume

Out

  • Audit with evidence
  • Interactive dashboard
  • Playbook by priority and owner

What changed

  • Right cause, not the assumed oneMost failures came from logistics configuration, not stock, so the client stopped working on the wrong fix.
  • Fixed the same dayThe configuration was corrected the same day and held through a month of follow-up.
  • Hours, not daysThe analysis took hours instead of about two days of manual checks, and the dashboard stayed in use as the client's availability monitor.

Working on a problem like this?

I'm always up for a conversation about commerce, data or AI in customer work.