Pitcocy
System Build

An AI Email Support Agent for E-Commerce

A Laravel + Filament email agent that classifies, drafts, and auto-sends customer support email. Multilingual. 13-step safety gate. Running inside a Dutch trailer-parts shop that ships to 24 EU countries.

Client: TrailerPlus·E-Commerce·
An AI Email Support Agent for E-Commerce

About TrailerPlus

Dutch e-commerce business selling trailer parts across 24 EU country domains

TrailerPlus sells trailer parts across 24 EU country domains. Axles, brakes, tires, dampers, couplings, the technical bits most drivers never think about until something breaks. Four people run the whole operation out of a small office in the Netherlands. The shop ships across the continent, but the team is small enough that everyone wears every hat.

The Challenge

The inbox was the bottleneck. Every product question turned into a catalog lookup, every refund needed careful hands, every reply got written from scratch in whatever language the customer wrote in. Seven of those on a good week. Volume scales with the shop. The team doesn't.

What I Built

A Laravel + Filament application that owns the support inbox. Polls Gmail, cleans the mail, detects language, and classifies each message by category and risk tier. The reply agent then runs with a tool set scoped to the sender, grounded in a knowledge base, and produces a draft in the original language. The team's view stays in Dutch, translated in on the way down and back-translated on the way out. Every potential auto-send runs through a 13-step safety gate before it leaves; anything that doesn't pass lands in a draft inbox with the reason logged.

How I Think About It

The features don't make the system. The ideas behind them do.

Identity binding

The sender's email gets set on the message record at ingest, server-side. From then on every tool that touches customer data reads identity from that field, not from whatever the agent asks for, and verifies ownership before returning anything. The agent doesn't get to choose whose data it sees.

Customer content is data, not instructions

Every customer body, attachment, and KB result lives inside tagged blocks with explicit 'this is data' framing around it. The hardened system prompt is structurally separated from anything that arrived in an email, so prompt injection has nowhere to land.

Deterministic where determinism works

Product URLs are a lookup table across 24 domains, not an LLM round-trip. The model never talks to the Magento API directly either, that part is just code. Save the model for the things only a model can do, and write code for the rest.

Auto-send is earned, not granted

Every category starts off. The 13-step gate decides on every message that comes through, and categories graduate to auto-send one at a time as trust accumulates in production. Nothing flips on by default.

How an Email Becomes a Reply

Drafting an email is one thing. Deciding when to send it is a different problem entirely. Every incoming message runs through this chain, and stage 7 is where the decision happens.

  1. 1

    Clean

    Best-available body (html > textAsHtml > text). Quote removal via email-reply-parser. Signature images, scripts, styles, iframes stripped. User-attached product photos pass through.

  2. 2

    Detect language

    Cheap LLM call. ISO 639-1 code plus Dutch display label from a lookup table. Not LLM-freeform.

  3. 3

    Classify

    Category, risk tier, confidence, reasoning. Per-message classification history row written. Yellow forced when confidence < 0.85.

  4. 4

    Extract order ID

    Pre-fetches order data when an ID is present, so the agent doesn't burn a tool call on the easy case.

  5. 5

    Generate reply

    Reply agent runs in reply or form mode with the customer's bound identity, KB retrieval, and Magento tools. Structured JSON out, no autoFix heroics.

  6. 6

    Translate

    Customer message and draft translated to Dutch for the team. Skipped when a message is eligible for auto-send.

  7. 7

    Safety gateHuman gate

    13 checks in precedence order: kill switch, category off, risk ≠ green, confidence < 0.85, keyword tripwire, thread-turn cap, per-thread cooldown, per-customer cap, global hourly/daily cap, loop detector, tool error, semantic safety check. Any miss routes the message to the draft inbox with the reason logged.

  8. 8

    Dispatch

    All gates pass → Gmail API threaded reply. Any miss → draft in the Filament inbox for human review.

The agent does the work. The gate decides if it's safe to send. The team handles what isn't. That's what 'human in the loop' actually looks like when you build it, instead of putting it on a slide :D

A Few Shots from the Tool

Dual-pane operator view

Dual-pane operator view

Customer message on the left, agent draft on the right. EN / NL toggle on both sides. Operators read and edit in Dutch, the system back-translates on send. A 10-15 minute reply becomes a 30-second check.

Every model call, audited

Every model call, audited

Cheap models for the easy stages (translate, detect_language, extract_order_id), the heavy model only for classify and generate_reply. Per-call cost, latency, and token usage visible in the admin panel.

What This Changes

Time and cost spent on repetitive work, before and after.

Reading & labeling emails

Manual, every emailAutomatic

Drafting product responses

10-15 min per email30 sec review

Invoice processing

Manual reviewAutomated

Order status replies

5-10 min lookupAuto-drafted

Hours saved per day on email alone. Time the team now spends on growing the business instead of managing an inbox.

The Solution

Production system

Delivered as a Laravel + Filament application running on Docker. Connected to Gmail via OAuth, drafting in production within a working week, auto-sending after the team graduated categories one by one. Continuously tuned on real traffic. Categories, tripwires, KB, prompts all editable from the admin panel without redeploys.

  • Live email processing from Gmail in production
  • Knowledge base built from product pages, PDFs, and policy content
  • 13-step safety gate with kill switch and per-category auto-send
  • Multilingual customer support across 8 priority languages
  • Forever audit trail for every auto-send and every gate decision
  • Admin panel for the team, no developer access required to operate

Results

100%
emails auto-classified
~90%
faster email responses
8
languages handled
24
EU country domains

What People Said

Drowning in customer email?

I build AI support systems for e-commerce teams. Classification, multilingual replies, safe auto-send, full audit. If your inbox is the bottleneck, reach out. Happy to map out what this looks like for your shop.

Let's talk