AI Sales Engineer Using OpenAI’s GPT-5-mini & Free-Tier Infrastructure

As a technical advisory firm in an emerging industry, Foray faces a common challenge: our website's static contact form is a passive, inefficient tool for qualifying complex, high-value client engagements. We need a way to engage potential clients in a substantive conversation, assess their needs against our core services, and seamlessly book a discovery call… all without incurring significant infrastructure costs or development overhead.

The solution was to build the AI Assess feature: a sophisticated, AI-driven chat agent embedded directly into Foray's Squarespace site. By leveraging a serverless architecture with Cloudflare Workers and OpenAI's latest models, we created an intelligent "Foray AI Consultant" that acts as a virtual SME. It engages users in a natural, adaptive conversation, qualifies their needs, and concludes by providing a pre-populated Calendly link with a rich "Opportunity Brief," transitioning a curious visitor into a highly qualified lead with zero human intervention.

Beyond the Static Contact Form

For a consultancy like Foray, the initial client conversation is critical. A simple "Name, Email, Message" form fails to capture the nuance of a potential project, leading to:

  • Unqualified Leads: Time spent on discovery calls with clients who aren't a good fit.

  • High Friction: Potential clients with complex needs may be hesitant to summarize them in a small text box.

  • Lost Opportunity: A passive form doesn't demonstrate the firm's technical expertise or provide immediate value to the visitor.

The goal was to create an automated system that could replicate the initial, high-level discovery conversation a human consultant would have, directly on the website.

A Virtual AI Consultant

We designed and built the AI Assess feature, a tool with a clear mission:

  1. Engage Intelligently: Act as a virtual "Foray AI Consultant" with a deep understanding of Foray's services.

  2. Qualify Dynamically: Guide the user through a conversational diagnostic to collect four key data points: the business problem, desired outcome, available data, and technical capability.

  3. Automate the Handoff: Conclude the conversation by generating a rich "Opportunity Brief" and embedding it into a custom Calendly link for a seamless booking experience.

Behind the Scenes

To achieve this with maximum security and minimal cost, we chose a modern, serverless architecture.

  1. Front-End (Squarespace): The user-facing chat interface was built with HTML, CSS, and JavaScript and embedded directly into the "AI Assess" page using a standard Squarespace Code Block. This kept the client-side code simple and easy to update.

  1. Secure Backend (Cloudflare Workers): The "brain" of the operation is a serverless function running on Cloudflare's global network. We chose this over a traditional server for three key reasons:

    • Security: The user's browser never communicates directly with OpenAI. The Cloudflare Worker acts as a secure proxy, receiving the conversation history and safely adding the secret OpenAI API key on the server side, where it is never exposed to the public.

    • Scalability: The worker can handle a massive number of concurrent conversations without any performance degradation.

    • Cost: Cloudflare's free tier includes 100,000 requests per day, making the infrastructure cost effectively zero for the vast majority of use cases.

  2. Intelligence Layer (OpenAI): We used OpenAI's gpt-5-mini model, accessed via their API. The true innovation was in the iterative refinement of the system prompt—the core set of instructions that gives the AI its persona, goals, and rules of engagement. We fine-tuned the prompt to strike the perfect balance between a structured qualification process and the freedom to ask intelligent, clarifying questions. The final system prompt that gives the AI its sophisticated, adaptive behavior is as follows:

You are the "Foray AI Readiness Assessor. Your persona is an elite, intelligent, and highly adaptive consultant.

Your Mission: Your primary goal is to determine if a client is a good fit by collecting four key pieces of information: 1) The core Business Problem, 2) The desired Business Outcome, 3) The available Data, and 4) The client's current technical Capability.

Your Rules of Engagement:

  • You MUST ask questions ONE AT A TIME. NEVER output a numbered list or ask for multiple pieces of information in a single turn. Your goal is a natural, turn-by-turn conversation.

  • You must guide the conversation to collect all four key pieces of information. You can ask for them in any order that feels natural.

  • You are permitted to rephrase the core questions to be more conversational or to help a user who seems confused, but you must still collect the substance of each of the four key points.

  • You have a mandatory budget of THREE strategic, "free-for-all" questions that you MUST use during the conversation. You have complete autonomy on what these questions are and when to ask them. Use them to probe deeper, clarify ambiguity, or transition between topics to make the conversation feel more natural and to better qualify the opportunity.

  • Once you have gathered all four key pieces of information, your mission is complete.

  • Final Step: Synthesize the entire conversation into a rich "Opportunity Brief." Then, append the final call to action: "The initial parameters of your project appear to be a strong fit. To discuss a potential engagement, schedule a discovery call with our team here: {{Code to insert a custom Calendly Link}}

The Value Proposition

This serverless approach delivers a powerful trifecta of benefits.

1. Intelligent SME-Equivalent Deal Qualification

The AI doesn't just follow a script; it consults. By understanding the user's needs and asking strategic follow-up questions, it gathers the essential information a human consultant would. The final "Opportunity Brief" pre-populated in the Calendly link saves hours of initial discovery time, allowing the first human-to-human conversation to be incredibly high-bandwidth and focused on the solution.

2. Almost Negligible Infrastructure Costs

A traditional approach would require a dedicated server, incurring monthly costs regardless of traffic. The serverless model is radically different.

  • Cloudflare Worker: $0 (within the generous free tier).

  • OpenAI API: The cost is purely transactional, based on usage.

Based on an average conversation of 10 turns, the cost per successful booking is less than one cent. This makes the ROI virtually infinite.

3. A Seamless Customer Experience

From the customer's perspective, the interaction is effortless. They visit the site, engage in a helpful, intelligent conversation, and are presented with a simple "Schedule a Meeting" button. When they click it, their details and a complete summary of their needs are already waiting for them. This frictionless journey from curiosity to qualified meeting is the hallmark of a modern, customer-centric sales process.

Next
Next

Multi-Agent Research Flow & Emergence Case Study