Project Overview and Business Context
The client was a B2B SaaS company selling workflow automation software to operations teams at mid-market UK businesses. Their outbound sales process relied on two SDRs who spent 60-70% of their time on research and email writing, with only 30-40% on calls and relationship-building. The brief was to build an AI SDR agent that handled the research and writing layer so that the SDRs could focus on calls, responses, and pipeline management. The agent needed to: import prospect lists (from LinkedIn, CSV, or HubSpot contact exports), research each prospect's company using publicly available information (company website, LinkedIn profile, recent news), generate a personalised first-touch email for each prospect that referenced specific relevant context, manage a four-touch email sequence over 14 days, detect replies and route them to the SDR for human response, book meetings via calendar link when prospects expressed interest, and sync all contact activity, email sends, opens, clicks, and replies to HubSpot. UK GDPR compliance for B2B outreach requires a legitimate interests basis, a clear unsubscribe mechanism on every email, and a suppression list process for contacts who have opted out. These requirements shaped the agent's compliance layer: every email includes a GDPR-compliant unsubscribe footer, unsubscribes are processed within 24 hours, and the suppression list is checked before every send.
Technical Architecture and Stack Decisions
The agent is built as a Next.js application with Supabase for prospect data, sequence state, and email logs, deployed on Vercel. LangChain orchestrates the multi-step research and generation workflow. The prospect research pipeline runs when a new prospect is imported. It uses a LangChain agent with two tools: a company website scraper (Puppeteer-based, fetching the homepage and About/Product pages) and a web search tool (Bing Search API) that retrieves recent news mentions and LinkedIn data for the company. The research agent is orchestrated by GPT-4o, which decides which tools to call based on the prospect's company name and the information retrieved so far, then synthesises the research output into a structured company summary: industry, company size estimate, product category, recent news or milestones, and relevant context for the client's value proposition. GPT-4o then generates the personalised first-touch email using the company summary and a system prompt encoding the client's ICP (ideal customer profile), value proposition, and email style guide. The sequence engine is a cron job that runs every two hours, checks Supabase for prospects due for their next touch, and sends the appropriate sequence email (touches 2-4 are templatised with light personalisation tokens). Replies are detected via the email provider webhook (SendGrid), which routes incoming replies to Supabase. The agent classifies reply intent (interested, not interested, out of office, unsubscribe) and notifies the assigned SDR for human responses on interested or ambiguous replies. HubSpot API integration syncs contact records, email activity logs, and meeting bookings in real time.
Key AI and ML Components
GPT-4o powers two critical tasks. Prospect research synthesis: the LangChain agent orchestrates tool calls to gather company information, and GPT-4o synthesises the retrieved information into the structured company summary used for personalisation. The quality of this synthesis directly determines the quality of the personalised email, as generic research produces generic emails. The system prompt for research synthesis instructs GPT-4o to prioritise specific, recent, and differentiating company facts over generic industry descriptions. Email generation: GPT-4o receives the company summary, the prospect's role and name, the client's value proposition, and the email style guide, and generates a personalised first-touch email. The style guide encodes sentence length (short), opening line style (no questions, no compliments, start with a specific observation), and the call-to-action format (a specific open-ended question, not a meeting request in the first email). LangChain manages the multi-step research workflow, handling tool call orchestration, retry logic on tool failures, and result aggregation. Reply intent classification uses a lightweight GPT-4o call with a few-shot classification prompt: given the reply text, classify as interested, not interested, out of office, unsubscribe, or ambiguous. This classification drives automated routing without requiring SDR review of every reply.
Challenges Solved and How
Prospect research quality varies significantly based on company website quality and public presence. For well-documented companies with informative websites, the research synthesis produces specific, useful personalisation context. For companies with sparse websites, the research output is generic and the personalisation quality falls. The system handles this with a confidence score on the research output: if the scraper and search tools return fewer than three specific, differentiating facts about the company, the prospect is flagged for manual SDR research before email generation, rather than sending a weakly personalised email that reads as generic despite the AI effort. Email sending reputation is critical for outbound sales. High-volume AI-generated email outreach can damage sending domain reputation if email quality or deliverability is not managed carefully. The build uses a warmed sending domain, SPF, DKIM, and DMARC records, SendGrid infrastructure with engagement-based sending, and a daily send volume cap calibrated to the domain's reputation score. GDPR unsubscribe processing was tested extensively: every unsubscribe link generates a one-click opt-out to Supabase, the suppression list is checked synchronously before every send, and unsubscribes are synced to HubSpot within the 24-hour window required by UK GDPR for timely processing.
Outcome and Measurable Results
The client deployed the AI SDR agent for a 12-week live period with two SDRs actively reviewing and managing the agent's output. SDR research and email writing time fell from an average of 6 hours per day to 1.5 hours per day per SDR, with the freed time reallocated to calls and follow-up conversations. Personalised first-touch email open rates were 38% (versus an industry average of 21-28% for cold outreach in this segment) and reply rates were 6.4% (versus a typical 2-4% baseline for manual cold email). The agent booked 23 qualified meetings over the 12-week period from a prospect list of 840 contacts, a meeting booking rate of 2.7%, significantly above the 1.1% rate the two SDRs had achieved manually in the prior quarter on equivalent prospect lists. HubSpot data quality improved as a side effect: every email send, open, and click was logged automatically rather than relying on SDR diligence.
Lessons for Similar Projects
Personalisation quality is the single most important variable in AI outbound. A well-researched, specifically relevant email from an AI agent outperforms a generic email from a human. An AI email that is generic is worse than a human email that is generic because it reads as obviously automated. Invest the build effort in the research synthesis layer. Build a compliance layer from day one, not as a post-launch addition. UK GDPR requirements for B2B email outreach (legitimate interests assessment, unsubscribe processing, suppression list management) are not optional. Retrofitting compliance to a live outbound system that has already been sending is expensive and creates regulatory risk. Keep humans in the loop for reply handling. Automated response to sales replies is a fast path to poor prospect relationships and wasted pipeline. The agent classifies intent and routes to humans; it does not attempt to continue the conversation autonomously. This is the right boundary for an AI SDR in the current landscape.