System 2 of 4
24/7 AI sales development engine
Researches prospects, writes and sends personalized outreach, classifies replies, runs follow-up sequences, and answers inbound quote requests for a B2B wholesale ingredients business. Every irreversible action sits behind a human approval gate.
In production, 24/7, live revenue
- Role
- Sole architect and operator
- Stack
- Python async, FastAPI, SQLAlchemy 2.0, PostgreSQL + pgvector, Claude API, Voyage embeddings, Gmail API, Telegram Bot API, APScheduler, systemd
- Infrastructure
- ~$34/month, one small Linux VM
- Part of
- ~25,000 lines of code replacing CRM, ERP, helpdesk, and SDR software
- Outcome
- Collections from under $4K to a record $37.8K in a single month within 90 days, at 38% gross margin
Problem
A new wholesale business with one person running it. The conventional stack is a sales team, an ops coordinator, a support rep, and a set of SaaS contracts. I wanted the volume work done by AI and every action that touches a customer gated by a human, so that the system could run around the clock without ever fabricating a product claim or sending something I had not seen.
Architecture
- Prospect ingestion and researchEach prospect gets an AI research pass over its website before any outreach is drafted.
- Personalized first touchInbox round-robin across warmed sending accounts, a warmup ramp, per-day frequency caps, sending-hours windows, and bounce-rate auto-pause.
- Reply detection and classificationReplies are classified by the Claude API as interested, buying signal, knowledge wall, not interested, or hostile, and routed accordingly.
- Draft-first responses and sequencingMulti-touch follow-ups with distinct angles, auto-cancelled the moment a prospect replies. Scheduled sends re-draft themselves if the thread has moved.
- Buying-signal handoffProspects showing intent are handed to me with the thread, and a daily digest summarizes everything else.
- Inbound quote requestsStorefront form to HMAC-verified webhook to spam filter to a Claude-drafted quote to a Telegram approve, edit, or reject prompt to a delayed send. If nothing is approved within four hours, the quote saves to drafts instead of sending.
Ten scheduled jobs, an eleven-table data model with explicit status machines, suppression lists, protected contacts, and a 604-entry RAG knowledge base synced nightly from the product catalog.
Controls that let an AI write to customers
- Two-layer validation before any send. Programmatic style checks for banned phrasing and formatting, then a second model pass that verifies every product claim against the retrieved knowledge base. Product facts can only come from retrieval, never from the model.
- Knowledge-wall escalation. When the model cannot answer a question from retrieved data, it sends a short holding reply and pings me on Telegram with the conversation. I answer in Telegram, the answer flows back, and the engine composes the final email. It escalates instead of bluffing.
- Approval at every irreversible boundary. Quotes go through Telegram approval. Helpdesk and mail integrations are draft-only by design with recipient allowlists. The only way an outbound customer message leaves the helpdesk is a human pressing send.
- Structural leak prevention. Supplier names and internal cost basis are tagged at the field level in the RAG embeddings so they cannot be retrieved into customer-facing text. This was built after a real internal-cost leak was root-caused.
- Prompt architecture designed for caching. Six modular layers, from identity through task, style guardrails, company knowledge, and voice examples, ordered so that Anthropic prompt caching holds cost down.
- Incident-derived guards. A pre-send body guard blocks any message contaminated with draft metadata, built from a real incident and covered by unit tests. Append-only correction logs feed a set of codified writing rules.
Numbers
| Monthly collections | under $4K to a record $37.8K, within 90 days |
|---|---|
| Gross margin | 38% |
| Active pipeline | 35 companies, quotes up to $218K |
| Infrastructure cost | ~$34/month |
| Operational stack replacing CRM, ERP, helpdesk, SDR | ~25,000 lines of code |
| RAG knowledge base | 604 entries |
| Scheduled jobs | 10 |
The operational stack around it
The engine is one service in a set of tools I built so the business could run without CRM, ERP, helpdesk, or SDR software:
- Procurement analytics over $7.5M of purchase history, 2,715 purchase orders, and 95 suppliers: price trends per material, lead times per supplier, spend rollups, open-order tracking, and supplier reliability, used for both quoting and negotiation.
- B2B storefront of 1,200 products with 80+ SEO ingredient guides, co-built on Astro with Cloudflare Pages and a Cloudflare Worker routing over an existing Shopify store, its quote forms wired directly into the engine.
- Organic growth as a controlled experiment. 87 treated pages against a 45-page holdout, scored on quote requests rather than clicks, with a kill rule for any lever that failed to separate. Treated pages reached 17.9 impressions per page against 6.3, and site-wide clicks rose 81% in 28 days.
- Compliance tooling that reads the PDF text of purchase order, supplier invoice, packing list, and certificate-of-analysis chains and mechanically cross-checks numbers, dates, batches, and organic claims for USDA Organic audits. Built after audit prep surfaced an invoice dated before its purchase order. Now a mandatory pre-ship gate.
- Document generation for invoices, purchase orders, and a self-contained e-signature NDA flow with consent capture and an audit trail.
- Packaging mockup generator that renders all 1,200 catalog products as photoreal pouch mockups in about 30 minutes, using displacement mapping and a custom post-process to restore lighting in dark label regions.