Avneesh.
03AI Automation
← back

project_03

Orbit Cold Mailer

AI-powered B2B cold outreach engine that researches prospects in real-time and generates personalized emails, LinkedIn messages, and WhatsApp messages via a production FastAPI backend.

● ProductionFastAPIPythonGemini 2.5
Overview

Orbit Cold Mailer is a production FastAPI backend that orchestrates multi-channel B2B cold outreach. It ingests buyer profiles and seller context, runs AI research using Tavily web search and LinkedIn post analysis, and generates hyper-personalized cold emails, LinkedIn messages, WhatsApp messages, and follow-up emails — each on its own dedicated route. The system supports multiple LLM backends (Gemini Flash, OpenAI GPT, AWS Bedrock) behind a unified router and streams real-time research progress via WebSocket.

Problem

Sales teams spend hours researching a prospect only to send a cold email that still ends up generic. There is no scalable way to produce outreach that references a prospect's real recent activity, business pain points, and company-specific context while staying concise, natural, and conversion-focused across email, LinkedIn, and WhatsApp.

Engineering Challenges
01.Orchestrating multi-step AI research (LinkedIn analysis, company insights) inside a single API request without hitting timeout limits.
02.Supporting Gemini, GPT, and AWS Bedrock with transparent failover so prompts never need to change across providers.
03.Managing 12 Tavily API keys with automatic rotation to prevent rate-limit failures during high traffic.
04.Streaming incremental research progress in real-time via WebSocket while async pipeline tasks run concurrently.
05.Mapping heterogeneous buyer/seller input into a strict Pydantic model before passing to the LLM pipeline.
06.Preventing hallucinations in generation — only facts explicitly present in the prompt may appear in the output.
Key Decisions
FastAPI over Flask — native async/await support enables concurrent research tasks without thread-pool overhead.
Pydantic models at every layer — input validation, LLM structured output, and company insights — for end-to-end type safety.
LLM router abstraction built so Gemini, GPT, and Bedrock are interchangeable without touching any prompt or business logic.
Tavily multi-key pool implemented as an ordered failover list so one exhausted key never blocks a live request.
WebSocket route added alongside REST endpoints to push each research step to the client without polling.
Email prompt engineered with an explicit no-hallucination rule so the model can only use data provided in the context.
Stack
PythonFastAPIPydanticGoogle Gemini 2.5 FlashOpenAI GPTAWS BedrockLangChainTavilyPostgreSQLasyncpgWebSocketuvicorn
Architecture
Key Features
Cold Email Generation Generates personalized B2B cold emails via /cold-email with AI-researched buyer context, banned-word enforcement, and a strict no-hallucination guarantee.
LinkedIn Message Generation Produces concise sub-500-character messages via /cold-message, tailored to the buyer's profile and recent company activity.
WhatsApp Message Generation Creates WhatsApp-ready outreach via /cold-whatsapp using the same research-first pipeline as cold email.
Follow-up Email Engine Generates contextual follow-ups via /followup that reference the original subject and body for thread continuity.
Real-time WebSocket Streaming Pushes each research step as a live chunk to the client over WebSocket so the UI updates while the pipeline is still running.
Multi-LLM Router Unified abstraction routing to Gemini Flash, OpenAI GPT, or AWS Bedrock with automatic failover between providers.
Tavily Web Research with Key Pooling Runs date-scoped advanced web searches using a 12-key Tavily pool — failed keys are skipped automatically so research never stalls.
LinkedIn Insight Extraction Parses buyer and company LinkedIn activity to extract buying intent, opportunities, sentiment, writing style, and mentioned technologies.
Metrics
4Outreach Channels (Email, LinkedIn, WhatsApp, Follow-up)
12Tavily API Keys in Rotation
3LLM Providers Supported (Gemini, GPT, Bedrock)
5Async Research Steps per Request