garofalodeveloperThiago Garofalo

Sales agents: from stalled quotes to AI-prepared follow-ups

Period: November 2026 to date · Role: diagnosis from ERP data, architecture, agent and ERP code, operations · Client: TT Imports, an industrial supplies distributor served by Asset Tecnologia · Status: first agent (follow-up) in production since 2026-11-28; later phases under construction

One-line summary: in a sales operation run by a single person, 84% of the month’s quotes never got a follow-up and no loss was ever recorded; the first agent now prepares the follow-up for every open quote, with business rules in code and AI only where it helps, and nothing reaches the customer without human approval.

About this case study. This is the short version, published as the operation starts. Customer names, prices and tax IDs are left out. The full case, with one month of follow-up numbers, will be added in January 2027. The code lives in a private repository; I can walk through it in an interview.

1. The problem

At TT Imports, one person runs the whole sales operation: receives requests by email, by WhatsApp Business or through the WhatsApp bot behind the ads, registers the customer in the ERP, builds the quote with ICMS ST (Brazilian tax substitution), sends the PDF and chases the answer.

flowchart LR
  EM[Email<br/>4 sales inboxes] --> P((One person))
  WA[WhatsApp Business] --> P
  RB[WhatsApp bot<br/>from the ads] --> P
  P --> CAD[Registers the customer<br/>by tax ID]
  CAD --> COT[Builds the quote<br/>in the ERP]
  COT --> ENV[Sends the PDF]
  ENV -.->|no time left| FUP[Follow up]
  FUP -.-> X[Outcome never<br/>recorded]

November 2026, from the ERP quotes screen:

Indicator Value
Quotes in the month 127
Made by the same person 120 (94%)
Open, no answer from the customer 107 (84%)
Recorded losses 0

Zero losses out of 127 quotes is not performance: it is missing data. Nobody knew why a sale was lost, and all the time went into quoting, with none left for following up. When the first agent went live, there were 247 open quotes in the follow-up queue across all months, none with the buyer’s contact on record.

2. The solution: a team of agents in five phases

The original plan was to automate building the quote, which is what takes the most time. The numbers changed the order: 84% of quotes were stalled after being sent. The stuck money was in the follow-up, not in the quoting.

flowchart LR
  subgraph Intake
    T[Triage<br/>email and bot]
    C[Customer record<br/>by tax ID]
    Q[Draft quote]
  end
  subgraph Follow-up
    F[Follow-up<br/>of open quotes]
    L[Reading<br/>the replies]
  end
  T --> C --> Q --> H{Person<br/>approves}
  H --> CLI[Customer]
  CLI --> L
  F --> H
  L --> D[(Outcome<br/>with reason)]
  classDef prod fill:#dcfce7,stroke:#16a34a,color:#14532d
  class F prod
Phase What the agent does Status
1. Assisted follow-up Reads open quotes, picks who to chase today, writes the message and saves it as a suggestion in the ERP In production since 2026-11-28
2. Daily follow-up The same, scheduled every business day at 7 am, with WhatsApp templates approved by Meta December 2026
3. Reading replies Reads the sales inboxes: the customer’s reply becomes a logged contact and a suggested outcome December 2026
4. Order intake From email and the bot: triage, customer record by tax ID and a draft quote in the ERP January 2027
5. Autonomy for simple cases Sending without approval only where measured accuracy allows After measuring phases 1 to 4

Three rules apply to every phase:

Rule Why
Nothing reaches the customer without human approval Price, credit, freight and ambiguous cases are business decisions. Autonomy only after measuring accuracy
Business rules live in code, not in the model Rules in code are predictable and testable. The model only gets what requires reading text
Email is untrusted content The company has already received phishing disguised as a quote request. The agent does not click links, open attachments or follow instructions written inside an email

3. The first agent: quote follow-up

End-to-end flow

flowchart LR
  ERP[(ERP<br/>quote with source<br/>channel and contact)] -->|token API| AG[Follow-up<br/>agent]
  AG --> REG[Rules in code<br/>queue, cadence,<br/>recipient]
  AG --> IA[AI summarizes the item<br/>validated output]
  REG --> SUG[Suggestion saved<br/>in the ERP]
  IA --> SUG
  SUG --> TELA[Today's follow-up screen<br/>approve, edit, skip]
  TELA -->|approved| ENV[Email from the ERP with the PDF<br/>or WhatsApp by link]
  ENV --> CLI[Customer]
  CLI --> DES[Contact and outcome<br/>with reason]
  DES --> ERP

The core idea is separating who writes from who sends. The agent only saves suggestions, and none of its API calls sends anything to the customer. The message goes out when the person approves it on screen. At worst, an agent mistake becomes a bad suggestion, not a wrong message to a customer.

The cadence

Each contact has a job, instead of repeating “any news?”:

stateDiagram-v2
  [*] --> Sent
  Sent --> Contact1: 2 business days, clear doubts
  Contact1 --> Contact2: +3 business days, offer an adjustment
  Contact2 --> Contact3: +5 business days, close and ask why
  Contact3 --> NoAnswer: +5 business days
  Sent --> Revival: over 30 days without contact
  Revival --> NoAnswer: +5 business days
  Contact1 --> Outcome: customer replied
  Contact2 --> Outcome: customer replied
  Contact3 --> Outcome: customer replied
  NoAnswer --> [*]: person confirms
  Outcome --> [*]: won or lost, with reason

The third contact exists to capture the reason for the loss (price, lead time, freight, another supplier), which nobody recorded before. Quotes from R$ 500 up enter the queue, sorted by value, capped at 20 a day.

Who the message goes to

This is where the first run taught the most. Of the 20 quotes in the first batch, 17 had no buyer contact. The email in the customer record looked like a way out, but it comes from the company’s registration card at the Federal Revenue and usually belongs to the customer’s accountant. An “autonomous” agent would have sent the follow-up, with prices and terms, to the accounting firm.

flowchart TD
  A[Quote in the queue] --> B{Has source channel<br/>and contact?}
  B -->|yes| OK1[Send through the channel<br/>the request came from]
  B -->|no| C{Buyer flagged<br/>in the customer record?}
  C -->|yes| OK2[Send to the buyer]
  C -->|no| D{Someone in the record with<br/>the quote contact's name?}
  D -->|yes| OK3[Send to that person]
  D -->|no| E[Suggestion without recipient:<br/>the person fills it in]
  R[Customer record email<br/>from the registration card<br/>usually the accountant] -.-> N[Never a recipient]

The rule became code with a test, and on the same day the ERP gained a buyer flag on customer contacts and a mandatory source contact on new quotes.

Where AI comes in

In one function only: saying in a few words what was quoted (“12-inch layflat hose with couplings and clamps”), the way a salesperson would say it on the phone. Everything else (who to chase, when, to whom, with which text) is rules in code.

flowchart LR
  I[Quote items] --> M[Model summarizes<br/>in up to 60 characters]
  M --> V{Validation}
  V -->|one line, no price,<br/>no invented number| OK[Goes into the message]
  V -->|failed| P[Description of the<br/>highest-value item]
  M -->|API error or rate limit| P
  P --> OK

Validation rejects any number that is not in the item descriptions, because an invented size is the costliest mistake in a quote. An AI error never stops the queue: the message falls back to the item description.

4. What is in production

Part What went live on 2026-11-28
ERP Mandatory source channel and contact on new quotes; outcome with reason; contact history; agent API with token and audit log; Sales › Today’s follow-up screen; quote PDF attached to the follow-up email; manual chapter in Portuguese, English and Spanish
Agent Running in a container on Oracle Cloud; the first real run saved 20 suggestions in the ERP; 9 rule tests
WhatsApp bot Three follow-up templates with quick-reply buttons (check-in, adjustment, closing) submitted to Meta for review; the button the customer taps already records the outcome

Every agent run ends with a one-line summary (queue, suggestions, missing contact, items summarized by AI, errors), which is the basis for measurement.

5. How it is measured

Against November 2026:

Criterion for phase 2 (daily schedule): no wrong recipient during the assisted phase and most suggestions approved without rewriting.

6. Lessons so far

7. Stack and code

Node.js 22 · Claude API (item summary, with validation and a non-AI fallback) · in-house ERP on Next.js 16, Drizzle and PostgreSQL · WhatsApp Cloud API · Docker on an ARM VM on Oracle Cloud in São Paulo, behind Caddy.

The agent and ERP code is private. I can walk through it in an interview.