AI Automation · B2B Distribution & Industrial Products
AI Email to Quotation Automation Platform
Agentic platform that reads inbound B2B inquiries from Outlook, extracts the requirement, matches a vector indexed product catalogue and drafts a priced quotation - inbox to quote with no manual keying.
- Role
- AI Engineer - Full Stack
- Built the agent runtime, middleware stack, four stage pipeline, Graph integration and operator UI.
- Industry
- B2B Distribution & Industrial Products
- Timeline
- Completed
Business impact
- pipeline stages
- 4
- retrieval
- Semantic vector search
- human control
- Draft only output
- manual steps removed
- 5
Overview
Built an end to end email automation platform for a B2B sales operation, connecting to a company mailbox and leaving a ready to send reply with an attached PDF quotation in the drafts folder.
A custom agent runtime with a middleware stack runs four staged prompts against a structured output contract: analysis extracts requirements, specifications, quantity, budget and timeline; incomplete inquiries generate clarifying questions instead of guesses; semantic search over the catalogue returns candidates; a quotation is generated and a draft reply written back to the mailbox.
Technical architecture
- Frontend
- React and TypeScript operator console for the processed inquiry queue and drafts
- API
- FastAPI async service covering auth, emails, drafts, automation, settings and storage
- Agent Runtime
- Custom agent class over LangChain with tool binding, structured output and a middleware chain
- Pipeline
- Four stage orchestration with a per run model call budget
- Vector Store
- Qdrant collection built by a separate indexing service over the product catalogue
- Data
- MySQL via async SQLAlchemy for users, tokens, processed emails and settings
Key features
- Outlook integration over Microsoft Graph - sync, thread retrieval, draft creation and send
- Four stage agent pipeline: inquiry analysis, follow up generation, product matching and response drafting
- Structured extraction of requirements, specifications, quantity, budget band and timeline from free form prose
- Clarification instead of hallucination when required information is missing
- Semantic product matching over a vector indexed catalogue rather than keyword lookup
- Automatic priced quotation generation rendered to PDF
- Draft back workflow - the system never sends autonomously, a human approves every quotation
- Attachment document processing for PDFs and images on the inquiry thread
- Custom agent runtime with pluggable middleware and a hard model call budget per inquiry
Challenges solved
- Loose, inconsistent inquiry text handled with a structured extraction schema and generated search queries
- Knowing when not to answer - incomplete inquiries route to a clarification path rather than a confident quote
- Bounding agent cost with a hard model call cap so a pathological thread cannot run away
- Keeping a human in the loop - the system writes drafts and never sends
Tech stack
- Python
- FastAPI
- LangChain
- Azure OpenAI (GPT 4o)
- Qdrant
- Microsoft Graph API
- MSAL OAuth2
- MySQL
- SQLAlchemy
- Pydantic
- WeasyPrint
- React
- TypeScript
- Docker