marriageAI Β· the conversation agent

How one message becomes a reply

marriageAI answers every customer message on WhatsApp. Each message makes one pass through the flow below: the agent loads everything it knows about you, picks the right "brain" for the job, optionally uses tools, and every reply leaves through one door β€” in one consistent voice.

flowchart TD
    IN["πŸ“± Customer message arrives"] --> CTX["Load context
12 sources gathered at once"] CTX --> SHORT["Quick checks
(no AI needed)"] SHORT --> ROUTE["The router
classifies the message"] ROUTE -->|"greeting or FAQ"| CHEAP["Cheap brain
fast + inexpensive"] ROUTE -->|"building a profile"| ONB["Onboarding brain"] ROUTE -->|"complex / sensitive / photo"| DEEP["Deep brain
most capable model"] CHEAP -.->|"not confident"| DEEP DEEP --> TOOLS["Tools
look up proposals, save fields,
send payment details… (max 10 rounds)"] TOOLS --> DEEP ONB --> R["Reply drafted
πŸ“Ό episode recorded"] DEEP --> R CHEAP --> R DEEP -->|"needs a human"| HUM["πŸ™‹ Hand over to staff"] R --> VOICE["🎭 The formatter
ONE persona for every reply"] HUM --> VOICE VOICE --> OUT["Sent via whatsappGateway
the single door"] classDef hi fill:#e7f2ec,stroke:#166b4e,color:#182420 class CTX,ROUTE,VOICE,OUT hi

One customer turn, end to end. The green boxes are the four load-bearing stages.

What the agent knows about you

Before thinking at all, the agent gathers 12 sources in parallel β€” one central "context builder", so every brain sees the same picture:

Who you are β€” account and profile, your journey stage, engagement history, recent phone calls.
What was said β€” the recent conversation, including the bot's own earlier messages, with one-time codes deliberately excluded.
What we've learned β€” a rolling summary updated every turn, per-customer behavior notes, and three knowledge searches: company policies, approved canned answers, and past human corrections.
What you sent β€” photos are classified automatically.

Five brains, one budget rule

Not every message deserves the most expensive model. The router assigns each message a tier β€” the simplest capable brain wins:

TierHandlesCost profile
DEEPcomplex, sensitive, photos, safety topicsmost capable model
DEEP-LITEsimple general questionssame brain, lighter model
CHEAP CHATgreetingsfastest, cheapest
FAQcommon questions, grounded on the knowledge basefastest, cheapest
ONBOARDINGprofile-building conversationsmid-range

A cheap brain that isn't confident escalates itself to the deep one β€” the customer never sees the handoff.

One voice, enforced in one place

Every reply path β€” deep, cheap, onboarding, even the message sent when handing over to a human β€” converges on the formatter before sending. It applies the persona: tone, language mix, spelling rules, message splitting. Change the persona once, every reply changes. The persona text itself lives in the database and is editable from the Dashboard β€” never hard-coded.

The flight recorder

Every reply writes an episode: the message, the reply, the agent's reasoning, which tools ran and what they returned, which brain handled it, and what it cost. Staff can open any bot message in the Agent Inbox and see exactly why the AI said what it said. Episodes also feed the learning pipelines β€” scored nightly for outcomes like "did the customer go silent?" and "did they complete a profile afterwards?".

βœ…
Recent repairs (Aug 2026). The nightly episode scorer was silently broken for months and now runs (282 of 283 episodes scored); the agent now sees its own outbound messages in conversation history; and every registered customer's real name reaches the agent (previously an empty field for all 10,031 users).

When the bot steps aside

Two independent switches silence the bot for a customer: an escalation by the agent itself, or a staff member pressing "Take over from AI" in the Dashboard. Either one is enough. Handover reaches the Agent Inbox instantly through the shared database, and the bot stays silent until staff resolve the conversation.

In this folder

Pipeline deep-dive

The Question Bank

How customer questions are collected, answered by staff, and served back β€” the full loop, including what changed in August 2026.