AI in Workflows — Research
Date: 2026-06-30 Prepared by: R&D — internal use Status: Research synthesis. All facts are sourced. Worked examples (prompt templates, cost estimates) are illustrative applications of verified concepts. Context: Empire Teas CRM will be built as a custom application. AI features are called directly from the custom backend — no third-party automation platform required. Sources: Anthropic (claude.com/platform/api), Google (ai.google.dev/gemini-api/docs/pricing), LangGraph (docs.langchain.com), Wikipedia (LLM, Prompt Engineering, RAG), Lindy.ai framework comparison, Pipedrive newsroom.
1. What an LLM Actually Is — Plain Language
Before applying AI to Empire Teas’ workflows, you need to understand what it can and cannot do. Most confusion about AI comes from either overestimating or underestimating it.
What it is
An LLM (Large Language Model) is a neural network trained on a massive amount of text — books, websites, documents, code. Through that training it learned patterns: what words follow other words, how sentences are structured, how questions are answered, how information is organised.
When you give it text (a prompt), it predicts what text should come next — extremely well. This makes it very good at:
- Reading and extracting — given an email, pull out the buyer name, country, product, volume, certifications needed
- Summarising — compress a long email thread or CRM history into a 5-line brief
- Drafting — write a follow-up email, a product brief, a quote cover letter
- Classifying — is this lead Hot, Warm, Cold, or Dead?
- Answering questions — given a document about certifications, answer “does this buyer need Halal?”
- Checking completeness — does this quote have all required fields?
What it is not
An LLM does not understand things the way a human does. It generates statistically likely text. This produces three real risks:
-
Hallucination — it generates “syntactically sound” text that is “factually incorrect, nonsensical, or unfaithful to provided source input” (Wikipedia, LLM article). If you ask it to extract a price from an email that doesn’t contain a price, it may invent one rather than say “not found.”
-
No real-time knowledge — without external tools, it cannot check the current Colombo auction price, look up a buyer’s company registration, or access live CRM data. It only knows what you put in the prompt.
-
Sensitivity to phrasing — research shows accuracy can vary “up to 76 accuracy points across formatting changes in few-shot settings” (Wikipedia, Prompt Engineering). How you write the instruction matters enormously.
The practical implication for Empire Teas
These limitations are why every AI workflow in this project should follow the Human-in-the-Loop (HITL) pattern. AI does the repetitive reading and drafting. A human reviews and approves before anything is saved, sent, or acted on. AI is fast and tireless; humans are accountable and can catch errors.
2. The Four AI Techniques Used in This Project
Technique 1: Information Extraction (Structured Output)
What it does: Given unstructured text (an email, a form, a note), AI reads it and extracts specific pieces of information in a structured format.
Example prompt approach:
You are a tea export sales assistant. Read the email below and extract:
- Buyer company name
- Country
- Tea type (black, green, herbal, flavored)
- Grade if mentioned (BOP, BOPF, OP, Dust, etc.)
- Estimated volume (with units)
- Packaging format if mentioned
- Certifications required
- Incoterm requested (CIF, FOB, etc.)
- Delivery port/destination
- Timeline if mentioned
If a field is not mentioned in the email, return null — do not guess.
Return as JSON.
EMAIL:
[email text here]
Why “return null — do not guess” matters: This directly addresses hallucination. Without this instruction, the model may infer a value it wasn’t told. With it, you get honest output: fields that are present are extracted, fields that are absent are flagged as missing.
Output looks like:
{
"buyer_company": "Doğadan Gıda",
"country": "Turkey",
"tea_type": "black",
"grade": "BOP",
"volume": "40,000 kg",
"packaging": null,
"certifications_required": [],
"incoterm": "CIF",
"destination_port": "Istanbul",
"timeline": null
}
This JSON then pre-fills the CRM record. The salesperson reviews and confirms — 30 seconds instead of 5 minutes of manual entry.
Source concept: Wikipedia (Prompt Engineering) — few-shot prompting and structured output.
Technique 2: Classification
What it does: Given a record (a lead, a deal, an email), AI assigns it to a category from a defined list.
Example — lead triage:
You are reviewing an unqualified lead for a Sri Lankan tea exporter.
Classify the lead as one of: HOT, WARM, COLD, DEAD, SPAM.
HOT = clear buyer intent, real company, relevant volume, recent contact
WARM = real company, some interest, but needs qualification
COLD = real inquiry but old (6+ months), unclear intent, or low volume
DEAD = no response after multiple contacts, extremely old, or clearly not a buyer
SPAM = job inquiry, competitor, irrelevant contact
For your classification provide:
1. Classification (HOT/WARM/COLD/DEAD/SPAM)
2. One-sentence reason
3. Suggested next action
LEAD DATA:
Name: [name]
Company: [company]
Country: [country]
Email: [email]
Initial message: [message]
Date: [date]
Last contact: [last contact]
Notes: [notes]
Source concept: Wikipedia (Prompt Engineering) — zero-shot classification.
Technique 3: Summarisation
What it does: Given a long input (email thread, CRM history, deal notes), AI compresses it into a short, structured summary.
Example — pre-call account brief:
You are preparing a sales brief for a call with a buyer.
Using the CRM data below, write a brief that covers:
1. Who they are (company, country, buyer type)
2. What they've ordered or sampled before
3. Any open items (samples pending, quotes outstanding)
4. Last communication summary
5. Suggested talking points for this call
Keep it under 200 words. Be factual — only use information provided below.
CRM DATA:
[deal history, notes, sample records, quote history]
Source concept: Wikipedia (LLM) — summarisation as a core LLM capability.
Technique 4: RAG (Retrieval-Augmented Generation)
What it is: RAG is a technique where the AI, before answering a question, first searches a knowledge base to find relevant information and includes that in its context. This is how you build a “knowledge assistant” that answers from your own documents rather than making things up.
How it works:
- You store your documents (certification PDFs, product specs, SOPs, country requirement guides) in a searchable database.
- When someone asks a question (“Does our Halal cert cover the pyramid bag range?”), the system searches the database for relevant documents.
- Those documents are included in the AI’s prompt along with the question.
- The AI answers based on the actual documents, not its general training.
Why it reduces hallucination: The AI is grounded in your real documents. It doesn’t have to guess. If the answer isn’t in the documents, it says so.
Empire Teas application: A knowledge assistant that answers questions about certifications, country requirements, packaging options, and export procedures — pulling answers from Empire Teas’ actual cert documents and SOPs.
Source: Wikipedia (Retrieval-Augmented Generation).
3. How AI Is Called in a Custom-Built CRM
Since Empire Teas CRM is being built from scratch, AI is called directly from the custom backend — no third-party automation platform needed. The backend code uses the Anthropic SDK to call Claude directly, processes the response, and saves results to the database.
The flow for any AI-powered feature looks like this:
[Event happens in the CRM]
e.g. salesperson clicks "Extract from email" / new email arrives / deal moves stage
↓
[Backend function triggers]
↓
[Backend calls Claude API with a prompt + the relevant data]
↓
[Claude returns structured output (JSON)]
↓
[Backend validates the output, saves to database]
↓
[Frontend shows the result to the salesperson for review]
↓
[Salesperson confirms, edits, or rejects]
The backend owns the entire chain. Claude is just one API call inside it — the same way you’d call a weather API or a payment API.
How it looks in code
import anthropic
client = anthropic.Anthropic(api_key="sk-ant-...")
def extract_inquiry_fields(email_text: str) -> dict:
response = client.messages.create(
model="claude-haiku-4-5-20251001",
max_tokens=500,
messages=[{
"role": "user",
"content": f"""
Extract from this tea inquiry email. Return JSON only.
If a field is not mentioned, return null — do not guess.
Fields: buyer_company, country, grade, volume,
certifications_required, incoterm, destination_port
EMAIL: {email_text}
"""
}]
)
return json.loads(response.content[0].text)
Install the SDK once: pip install anthropic. Get an API key from console.anthropic.com. Every AI feature in the CRM is built this way — a function that takes input, calls Claude, returns structured output.
4. Human-in-the-Loop (HITL) — How It Works in Practice
Human-in-the-loop means the AI does work, a human reviews it before it takes effect, and the human can approve, edit, or reject the AI’s output.
Why it’s essential for Empire Teas
Tea export involves binding commercial commitments — quotes, certifications, delivery terms. An AI error that goes unreviewed and results in a wrong quote being sent to a buyer is a real business problem. HITL ensures AI speeds up the work without removing accountability.
The four HITL patterns
Pattern 1: Notification + Review (simplest)
AI creates a draft CRM record
↓
Salesperson receives notification: "New lead created from email — please review"
↓
Salesperson opens CRM, reviews AI-extracted fields
↓
Salesperson corrects any errors, hits "Confirm"
↓
Record is saved as active
Best for: Inquiry extraction, lead creation. Low risk, high volume.
Pattern 2: Checklist + Gate
Salesperson is about to send a quote
↓
AI runs a completeness check on the quote record
↓
AI returns a checklist: ✅ price included, ❌ Halal cert not confirmed, ❌ quote validity date missing
↓
System blocks sending until the flagged items are resolved
↓
Salesperson addresses the flags, system allows sending
Best for: Quote completeness check. Prevents errors before they reach the buyer.
Pattern 3: Triage Queue
AI processes 200 leads and classifies each as HOT/WARM/COLD/DEAD/SPAM
↓
Results are presented to salesperson as a review queue
↓
Salesperson scans the list, overrides any classifications that are wrong
↓
Approved classifications drive the follow-up workflow (assign owner, send re-engagement email)
Best for: The 200+ unreviewed Pipedrive leads. Bulk AI processing + efficient human review.
Pattern 4: Draft + Edit + Send
AI drafts a follow-up email or account brief
↓
Salesperson sees the draft in their workflow
↓
Salesperson edits as needed (typically minor tweaks)
↓
Salesperson clicks Send
Best for: Re-engagement emails, account briefs before calls. Saves drafting time, human retains control.
6. What “Clean Data” Means — and Why It’s a Prerequisite
A common mistake: building AI workflows before the CRM data is clean. AI cannot work well on poor data.
What clean data means in practice:
| Data quality issue | What AI produces |
|---|---|
| Lead record with no message, just a name and email | AI has nothing to extract from. Output: “insufficient data” |
| Company name in 3 different formats (e.g. “Al Rashidi”, “AL-RASHIDI TRADING”, “Alrashidi”) | AI treats them as 3 different companies. Duplicates persist |
| Deal stage set to “New” for all 200 leads regardless of actual status | AI classification is based on stale/inaccurate stage data |
| Certification requirements stored as a long unstructured note (“needs halal and also they mentioned organic last time”) | AI must parse ambiguous text instead of reading a structured field |
| Volume field containing both “5MT” and “5000kg” and “5 tons” | AI extracts inconsistent units, making comparison impossible |
The sequence matters:
Step 1: Clean and structure the existing CRM data
Step 2: Define the pipeline stages and field schema properly
Step 3: Build AI workflows on top of the clean foundation
Building AI on top of messy Pipedrive data is the single biggest risk to the project. The AI lead triage pilot is also a data cleaning exercise — it will surface and fix the bad records before migrating them to the new CRM.
7. AI Cost at Empire Teas’ Scale
Understanding cost is important for scoping the project. AI API calls are priced per token — roughly one token = ~0.75 words. A typical email is ~300–500 words = ~400–650 tokens.
Current API pricing (verified 2026-06-30)
Anthropic Claude (claude.com/platform/api):
| Model | Input (per 1M tokens) | Output (per 1M tokens) | Best for |
|---|---|---|---|
| Haiku 4.5 | $1.00 | $5.00 | High-volume simple tasks (classification, short extraction) |
| Sonnet 4.6 | $3.00 | $15.00 | Balanced — most use cases |
| Opus 4.8 | $5.00 | $25.00 | Complex reasoning tasks |
Google Gemini (ai.google.dev/gemini-api/docs/pricing):
| Model | Input (per 1M tokens) | Output (per 1M tokens) |
|---|---|---|
| Gemini 2.5 Flash-Lite | $0.10 | $0.40 |
| Gemini 2.5 Flash | $0.30 | $2.50 |
| Gemini 2.5 Pro | $1.25 (≤200k) | $10.00 (≤200k) |
Cost estimate for Empire Teas’ use cases
Inquiry extraction (per email):
- Input: ~800 tokens (email + prompt) = $0.0008 at Claude Haiku pricing
- Output: ~200 tokens (JSON extraction) = $0.001
- Cost per inquiry: ~$0.002 (less than 0.3 cents)
Lead triage (per lead, one-time batch):
- Input: ~500 tokens per lead = $0.0005
- Output: ~100 tokens (classification + reason) = $0.0005
- Cost for 200 leads: ~$0.20 total
Account brief (per call):
- Input: ~2,000 tokens (CRM history + prompt) = $0.002 at Sonnet pricing
- Output: ~300 tokens (brief) = $0.0045
- Cost per brief: ~$0.007 (less than 1 cent)
Annual cost estimate (Empire Teas scale): Assumptions: 20 new inquiries/week, 5 account briefs/week, 10 quote checks/week.
| Workflow | Volume/year | Cost/call | Annual cost |
|---|---|---|---|
| Inquiry extraction | ~1,000 | $0.002 | ~$2.00 |
| Account briefs | ~260 | $0.007 | ~$1.82 |
| Quote checks | ~520 | $0.005 | ~$2.60 |
| Lead triage (one-time) | 200 | $0.001 | ~$0.20 |
| Total API cost | ~$7/year |
The AI API cost is negligible. At Empire Teas’ scale, the LLM API costs a few dollars per year. The meaningful costs are: the automation platform subscription (€20–50/month for n8n cloud or minimal for self-hosted), and the development time to build and test the workflows.
8. The 7 AI Use Cases — Designed in Detail
The existing research lists 7 use cases. Below each is designed with a clear input, what the AI does, and what the output looks like.
Use Case 1: Lead Triage (Pipedrive backlog recovery)
The problem: 200+ leads sitting unreviewed in Pipedrive.
Input: Export all leads from Pipedrive via API — for each lead: company name, country, email, original message, date created, last activity date, any notes.
What AI does: Reads each lead record and outputs:
- Priority: HOT / WARM / COLD / DEAD / SPAM
- One-sentence reason
- Suggested next action (“Send re-engagement email”, “Archive — no activity in 18 months”, “Flag as duplicate of [company]”)
- Draft subject line for re-engagement (for WARM/HOT leads)
Human review step: Salesperson reviews a ranked queue — HOT leads first. They scan the AI’s reasoning, override any misclassifications, and approve. The whole 200-lead review should take under 2 hours instead of 2 days.
Output: Clean, prioritised lead list ready for migration into the new CRM.
Platform: n8n workflow — bulk API pull from Pipedrive → AI batch processing → review queue interface.
Use Case 2: Inquiry Extraction from Email
The problem: Sales team manually reads inquiry emails and re-types information into the CRM.
Input: An inquiry email forwarded to or received by a monitored inbox.
What AI does: Extracts structured fields (buyer, country, product type, grade, volume, certifications, incoterm, destination, timeline) and returns JSON. Fields not mentioned are returned as null — never guessed.
Human review step: Notification to salesperson: “New inquiry received — CRM draft created. Review and confirm.” Salesperson opens pre-filled CRM record, checks fields, corrects any errors, hits confirm. 30 seconds.
Output: Confirmed CRM record with all extractable fields pre-filled, plus a task: “Reply to inquiry — follow-up within 24 hours.”
Platform: n8n — email trigger (Gmail/Outlook) → Claude Haiku extraction → Pipedrive/Zoho API create record → Slack/email notification.
Use Case 3: Account Brief Before a Call
The problem: Salespeople spend 10–15 minutes manually reviewing CRM history before calls.
Input: CRM history for a specific account — all deals, notes, sample records, quote history, last communication date, open items.
What AI does: Summarises into a structured 1-page brief:
- Who they are (company, country, buyer type, relationship length)
- What they’ve ordered or sampled (last 3 interactions)
- Open items (samples pending, quotes outstanding, unanswered messages)
- Last communication summary (1–2 sentences)
- Suggested talking points (based on open items and past patterns)
Human review step: Salesperson reads the brief, verifies it looks right. One button click to generate it — takes 5 seconds to produce.
Output: A brief the salesperson reads in 2 minutes instead of 15 minutes of manual CRM archaeology.
Platform: n8n or Make.com — CRM data pull → Claude Sonnet summarisation → formatted output (Slack message or CRM note).
Use Case 4: Private Label Product Brief Assistant
The problem: After a conversation with a buyer, the salesperson needs to turn rough notes into a structured internal product brief for the R&D/blending team.
Input: Salesperson’s rough notes from a call or email exchange: “they want something similar to English Breakfast, organic, for Germany, double-chamber teabags, 25 per box, eco-friendly packaging, around 10,000 boxes per shipment.”
What AI does: Converts these notes into a structured product brief form:
- Tea type: Black
- Blend profile: English Breakfast style (strong, malty)
- Origin requirement: Ceylon (to qualify for EU Organic certification)
- Certifications required: EU Organic
- Packaging: Double-chamber teabag
- Pack size: 25 teabags per box
- Outer packaging: Eco-friendly (specify material — [needs confirmation])
- Volume: 10,000 boxes per shipment
- Target market: Germany
- Open questions: [specific eco-packaging material? exact shade of colour on box?]
Human review step: Salesperson reviews the structured brief, fills in any gaps flagged by AI, confirms and sends to R&D team.
Output: A clean, complete product brief that R&D can act on immediately — no back-and-forth about missing specs.
Platform: Simple Claude API call — no complex automation needed. Could be a button inside the CRM: “Generate product brief from notes.”
Use Case 5: Quote Completeness Check
The problem: Quotes go out missing required information — no expiry date, payment terms not specified, certification not confirmed for the buyer’s market.
Input: The completed quote record fields from the CRM before sending.
What AI does: Checks every field against a rules list:
- Price included? ✅/❌
- Incoterm specified? ✅/❌
- Quote validity date set? ✅/❌
- MOQ stated? ✅/❌
- Payment terms specified? ✅/❌
- Buyer’s required certifications confirmed for this product? ✅/❌
- Lead time included? ✅/❌
Human review step: System blocks quote from being sent until flagged items are resolved. Salesperson fixes the gaps.
Output: No incomplete quotes reach buyers.
Note: This is a rules-based check enhanced by AI. The certification check (does this product hold the certs this buyer needs?) requires the cert-to-product mapping data from the client (Discovery Question 9 from Section 15 of the tea industry research).
Platform: Logic embedded in the CRM workflow (Zoho Blueprint or Pipedrive automation), optionally with a Claude API call for the certification cross-check.
Use Case 6: Export Documentation Checklist
The problem: Each destination country has different documentation requirements. Missing a document causes customs delays.
Input: Destination country + product type (bulk/private label) + certifications claimed on the shipment.
What AI does (with RAG): Searches an internal knowledge base of country-specific requirements and generates a checklist:
Example output for Germany, EU Organic private label:
Required documents for this shipment:
✅ CUSDEC — submitted via ASYCUDA
✅ SLTB Export Authorisation
✅ Certificate of Origin (Chamber of Commerce)
✅ Commercial Invoice (EUR)
✅ Packing List
✅ Bill of Lading
✅ Lion Logo Certificate (if marketing as Ceylon Tea)
✅ EU Organic Certificate — must match THIS batch/lot number
✅ Phytosanitary Certificate
⚠️ Pesticide residue test report — EU MRL rules are strict for organic claims. Confirm lab report is current.
Human review step: Export team reviews checklist, ticks off items as assembled, confirms before shipment.
Output: No missing documents at customs.
Platform: RAG knowledge base (country requirement documents) + Claude API + CRM-embedded checklist. This is the most technically complex use case — best built in a later phase.
Use Case 7: Re-engagement Email Drafts
The problem: After lead triage, WARM leads need personalised re-engagement emails. Writing 60 individual emails takes a full day.
Input: Each lead’s CRM record — company, country, original inquiry topic, date of last contact, any notes.
What AI does: Drafts a personalised re-engagement email for each lead:
- References what they originally inquired about
- Mentions something relevant (new product, certification Empire Teas recently obtained, upcoming trade fair)
- Keeps it short (3–4 sentences)
- Ends with a clear call to action
Human review step: Salesperson reads each draft, tweaks as needed (typically 1–2 sentences), clicks Send. 60 emails in 2 hours instead of a full day.
Output: Personalised outreach at scale.
Platform: n8n — lead list from CRM → Claude Sonnet draft generation → review queue with edit-and-send interface.
9. What Still Needs to Be Confirmed with the Client
The AI workflows above are designed based on industry knowledge and the tea export workflow. The following must be confirmed before building:
| # | Question | What it unblocks |
|---|---|---|
| 1 | Where do inquiry emails arrive — a shared mailbox, individual sales rep inboxes, a website form, WhatsApp? | Determines the trigger for the inquiry extraction workflow |
| 2 | Who reviews and approves AI outputs — one person or multiple sales reps? | Determines how the review queue and notification routing are designed |
| 3 | Is the team comfortable using AI tools, or will there be adoption resistance? | Determines how much training and change management is needed |
| 4 | Are there data privacy or confidentiality concerns about sending email content to an AI API? | May require self-hosted models or on-premise deployment (changes cost and architecture significantly) |
| 5 | Where are product specs, certifications, and SOPs stored today (Google Drive, SharePoint, physical files)? | Required to build the RAG knowledge base for the documentation checklist |
| 6 | What language are inquiries typically received in? Mostly English, or also Arabic, Turkish, Russian? | Multilingual emails require testing the AI’s extraction accuracy in those languages |
10. Sources
All facts in this document are drawn from the following sources, visited during research:
- Anthropic — claude.com/platform/api (Claude API pricing, verified 2026-06-30)
- Google — ai.google.dev/gemini-api/docs/pricing (Gemini API pricing, verified 2026-06-30)
- LangGraph — docs.langchain.com/oss/python/langgraph/overview (what LangGraph is, HITL capability, key concepts)
- Wikipedia — Large Language Model (capabilities, hallucination, limitations); Prompt Engineering (techniques, few-shot, chain-of-thought, sensitivity); Retrieval-Augmented Generation (RAG mechanics, hallucination reduction)
- Lindy.ai — lindy.ai/blog/best-ai-agent-frameworks (LangGraph, AutoGen, CrewAI comparison)
- Pipedrive — pipedrive.com/en/newsroom (AI features documented as a reference for what generic CRM AI looks like vs. domain-specific AI)