LLM-Powered Outreach
Generation Service
Mini-service that generates personalized outreach text (email, LinkedIn, SMS) using lead + company context with strict guardrails, variant generation, and full audit trail.
Per Request
No Hallucinations
Email/LinkedIn/SMS
Scope Overview
Keep it focused: generate safe, personalized messages from minimal context
Must-Have Features
Input: lead + company context + goal (email/LinkedIn/opener)
Output: 1-3 variants + subject lines (for email)
Tone options: professional, friendly, direct
Guardrails: length limits, no hallucinated claims, safe wording
Store: request, prompt, model output, final selected version
Nice-to-Have (Later)
A/B templates for different industries
Personalization slots (opener only, CTA only)
Multi-step generation (opener → body → CTA)
Multilingual support for global outreach
Three-Tier Architecture
FastAPI orchestration + LLM provider + MongoDB for full audit trail
FastAPI Layer
AI orchestration endpoints
LLM Provider
OpenAI / Anthropic / Any provider
MongoDB Store
Audit trail + prompt history
Input/Output Contract
Structured request and response format with full context and metadata
PersonalizeRequest
{
"channel": "EMAIL | LINKEDIN | SMS",
"tone": "PROFESSIONAL | FRIENDLY | DIRECT",
"goal": "book a 15-min call",
"lead": {
"first_name": "John",
"last_name": "Doe",
"title": "VP of Engineering",
"company_name": "Acme Corp",
"domain": "acme.com"
},
"company_context": {
"summary": "Cloud-native platform for...",
"keywords": ["SaaS", "cloud", "AI"],
"tech_stack": ["React", "AWS"] // optional
},
"constraints": {
"max_words": 120,
"include_subjects": true,
"no_claims_policy": true
}
}PersonalizeResponse
{
"request_id": "req_abc123",
"variants": [
{
"subject": "Quick question about Acme's cloud stack",
"message": "Hi John,\n\nI noticed Acme is building...",
"personalization_points": [
"Used company summary keywords",
"Referenced VP title",
"Mentioned cloud + AWS tech"
],
"risk_flags": []
},
// 2 more variants...
]
}MongoDB Collections
Three collections for complete audit trail and prompt replay
personalization_requests
Full request audit trail
request_id: stringUnique request identifier
input: JSONFull PersonalizeRequest payload
status: stringSUCCESS | FAILED
created_at: timestampRequest timestamp
latency_ms: numberGeneration latency
prompts
Prompt versioning and replay
request_id: stringLinks to request
system_prompt: stringSystem instructions
user_prompt: stringFormatted user prompt
model: stringLLM model used
temperature: numberGeneration temperature
outputs
Generated variants and selection
request_id: stringLinks to request
raw_output: stringRaw LLM response
parsed_variants: arrayArray of variants
selected_variant_index: numberUser selection (optional)
created_at: timestampOutput timestamp
Prompt Strategy
Simple template + strict rules = safe, personalized messages
Safety Rules
Context-Only Policy
Use ONLY provided context
No invented numbers, customers, funding, awards, or metrics
Thin Context Handling
Generic opener when context is minimal
Write relevant message without making claims
Word Count Limits
Enforce max_words constraint
Respect constraints.max_words from request
Spam Prevention
Avoid spammy language
No 'guaranteed', 'free', 'act now', or aggressive CTAs
Personalization Hierarchy
Website summary keywords
Primary personalization anchor
Role/title alignment
Secondary relevance signal
Tech stack (if provided)
Tactical mention when available
Never guess metrics
Avoid all numbers not in context
Quality Checks
Post-processing validation with automatic retry on failure
Word Count Enforcement
Verify message length against max_words
Forbidden Phrase Detection
Scan for spammy language patterns
Hallucination Risk Detection
Check for numbers/claims not in input
Required Elements
Ensure greeting with name, CTA, relevance reason
Retry Logic
If quality checks fail, regenerate with stricter instructions (max 1 retry per request)
FastAPI Endpoints
Three core endpoints for generation and audit
/personalizeGenerate personalized message variants
PersonalizeRequest
PersonalizeResponse (3 variants)
/personalize/{request_id}Retrieve stored request and outputs
request_id parameter
Full request + prompt + outputs
/personalize/{request_id}/selectStore user's selected variant
{ variant_index: 0 }
Success confirmation
Optional React UI (for testing)
Minimal testing interface for experimenting with prompts and variants
Input Form
Lead fields + company summary + tone + channel selection
Generate Button
Trigger personalization with loading state
Variant Display
Show 3 variants with copy-to-clipboard button
Inline Editing
Edit box for each variant before using
Variant Selection
Select which variant to use (tracks in DB)
Risk Flags
Display any quality warnings per variant
Production Benefits
Safe, auditable, and reproducible AI personalization at scale
Generates 3 Usable Messages
Creates high-quality variants from minimal context without hallucinations
Never Invents Claims
Strict guardrails prevent unsourced metrics, customers, or fake data points
Full Audit Trail
Stores requests, prompts, and outputs in MongoDB for replay and analysis
Prompt Replay by ID
Retrieve and replay any generation using request_id for debugging and training
Done Criteria
Generates 3 usable message variants per request
Never invents claims, metrics, or unsourced data
Stores prompt + outputs in MongoDB with audit trail
Supports prompt replay by request_id
Build Your Next Product With AI Expertise
Experience the future of software development. Let our GenAI platform accelerate your next project.
Schedule a Free AI Blueprint Session