# Teardown: WhatsApp-to-Web HITL AI Engine

Canonical: https://www.sawantsites.com/work/whatsapp-to-web-hitl-engine/
Author: Saurabh Sawant (https://www.sawantsites.com/about/)
Last reviewed: 2026-12-04

## What bottleneck did the engine solve?
Generating client websites through chat produced inconsistent layouts and off-brand copy, with no structured review step. Sawant Sites engineered the flow as a pipeline: chat messages become a validated brief, the brief becomes a draft site, automated checks score the draft, and a human approves it before anything goes live.

## How does the WhatsApp-to-web pipeline work?
The engine splits one chat request into seven stages so each failure has a clear owner. Models handle extraction and generation, deterministic code validates and scores every output, and a human reviewer holds the only path to publish. Sawant Sites kept model calls narrow so each stage can be tested on its own.
1. **Inbound WhatsApp message** (Channel webhook): Client messages arrive through a WhatsApp webhook and are stored against the conversation, keyed by message ID so retried deliveries never create duplicate work.
2. **Intent and brief extraction** (LLM extraction): A model call turns the conversation into a structured brief: business details, pages, sections, tone and the specific change being requested.
3. **Deterministic schema check** (Code validation): The brief is validated against a strict JSON schema. A missing required field triggers a follow-up question in chat instead of a guessed value.
4. **Draft site generation** (Template assembly): The engine assembles the site from tested section templates and fills them with generated copy, so layout decisions stay inside known components.
5. **Automated QA and eval gate** (Eval runner): Each draft is rendered headlessly and scored for schema completeness, layout at mobile and desktop widths, broken links and brand rules on copy.
6. **Human-in-the-loop approval queue** (Reviewer): A reviewer sees the draft, a diff against the live version and any flagged checks, then approves, edits or sends it back with a note.
7. **Live publish** (Edge deploy): Approved versions deploy to the edge and the client receives the live link in chat. Every published version is kept so it can be rolled back.

## Where does the human sit in the loop?
The human sits between the automated eval gate and publish, and every release passes through them. Sawant Sites designed the queue so reviewers spend their time on judgment instead of hunting for problems: each draft arrives with its check results, a diff against the live site and the chat messages that triggered the change.

Why nothing publishes unchecked: Publishing is a separate, permissioned action that only the approval queue can trigger. The generation stages hold no deploy credentials, so a model error can produce a bad draft but never a bad live site.

Escalation triggers:
- An automated check fails or scores below its threshold
- The draft contains a business detail the client never stated, such as prices or opening hours
- The change touches pricing, legal or contact details
- The request is still ambiguous after one clarifying question in chat

## What does the eval gate check before a draft reaches a reviewer?
The eval gate is a set of automated checks every draft has to pass before a reviewer sees it as clean. Sawant Sites agrees on acceptance criteria up front, then turns failures caught in review into regression cases, so the same mistake is stopped by the gate next time instead of by a person.
- Every required brief field is present and traceable to a client message
- Pages render without horizontal overflow at mobile and desktop widths
- No broken links, missing images or empty sections
- Copy follows the brand rules for tone, banned phrases and factual claims
- Accessibility and performance basics pass on the rendered page

## What typically breaks in chat-to-web generation, and how do we design around it?
Conversational site generation fails in a handful of predictable classes. Below are four common failure modes Sawant Sites designs against at specific layers of a HITL pipeline, so each guard is tested in CI instead of relying on fragile prompt tweaks. Specific client incidents stay confidential under NDA.
- **Extraction and schema:** Broke: A model fills missing brief gaps with plausible details the user never supplied, such as prices or opening hours. Fix: Tag extracted facts to source messages during intake so untraced fields fail schema validation and trigger a clarifying question in chat.
- **Versioning and review:** Broke: A short follow-up like 'change the photo' targets the wrong section or overwrites earlier approved edits. Fix: Represent updates as structured diffs against the last approved version, showing the reviewer exactly what changed before publish.
- **Templates and eval gate:** Broke: Long generated headings or business names overflow narrow mobile viewports. Fix: Constrain generation to tested section templates and verify rendered drafts across mobile and desktop widths in the automated QA gate.
- **Channel ingestion:** Broke: Retried webhook deliveries trigger duplicate generation jobs for the same inbound message. Fix: Key inbound processing by provider message ID so retries are idempotent and attach cleanly to the existing job.

## What does the client own, and what stays a reusable foundation?
The client owns the engine Sawant Sites built for them: code, prompts, templates, brand rules, conversation data and deployments. Sawant Sites keeps only generic foundations that hold no client logic or data, licensed perpetually to the client. No client-specific code, prompt or data is reused for anyone else.

Client owns 100%:
- The engine's application code and deployment configuration
- Extraction and generation prompts, plus the brief schema
- Section templates, brand rules and design tokens
- Conversation history, briefs and every published site version
- The eval set, regression cases and reviewer decisions
- The cloud, messaging and model provider accounts the engine runs on

Reusable foundations:
- A generic eval runner that scores outputs against a test set in CI
- An approval queue pattern with diffs and audit logs
- LLM tracing and token usage telemetry
- Webhook ingestion with idempotency and retries
- Headless rendering checks for layout and overflow

## Frequently asked questions
### Could the same pattern run on Slack or web chat instead of WhatsApp?
Yes. The channel is one adapter at the start of the pipeline. Sawant Sites builds chat-to-action systems on WhatsApp, Slack and web chat with the same structure: extraction into a strict schema, deterministic checks, an eval gate and a human approval queue before anything changes in production.

### Does the reviewer in a human-in-the-loop queue need to be technical?
No. The approval queue shows the rendered draft, a plain diff against the live version and any failed checks in plain language. Reviewers approve, edit copy or send the draft back with a note. Engineering only gets involved when a check fails for a reason the reviewer cannot fix from the queue.

### Can Sawant Sites build a similar human-in-the-loop engine for our business?
Yes. Sawant Sites builds new human-in-the-loop engines on its generic foundations (eval runner, approval queue, tracing) and engineers everything specific to your business in your own repository. No prompts, templates or data from other clients are reused, and you own 100% of the custom code you receive.
