← back to work
AI Systems · Two-Agent Orchestration

AI-Powered Property Inquiry & Booking System

A production dual-agent system that qualifies inbound property leads and books viewings end-to-end — entirely over WhatsApp, with zero human intervention.

n8nGPT-4.1RedisEvolution APIGoogle SheetsGoogle CalendarGmailTwo-Agent Orchestration

24/7

Lead Coverage

2

Orchestrated Agents

0

Human Touchpoints

~90s

Booking Pipeline

// The Problem

Property leads don't wait.

Real estate agencies lose a significant share of inbound leads simply because no one is available to respond outside business hours. A prospective buyer messages at 10 PM asking about a listing — by morning, they've contacted three competitors.

The existing process required agents to manually qualify callers, check availability, create CRM entries, book calendar slots, and send confirmation emails — a multi-step workflow prone to delays, errors, and dropped leads.

Leads go cold after-hours

Lost revenue, competitor advantage

Manual CRM entry for every inquiry

Agent time wasted on admin

Calendar conflicts & double-booking

Poor client experience

No confirmation system

High no-show rate for viewings

// System Overview

Two agents. One seamless pipeline.

The system is built as a two-agent orchestration in n8n. The primary agent handles all conversational intelligence; the sub-agent owns every transactional action. Neither overlaps.

// system-architecture
WhatsApp Message
Evolution API Webhook
Session Router
Redis · New / Resume
History Loader
Redis · Conversation State

Kelly — Primary Agent

GPT-4.1 · Conversational AI

listings_leadsbooking_specialistThink

Property Query Path

listings_leads tool → Google Sheets lookup → formatted reply → Evolution API send

Booking Handoff Path

booking_specialist_workflow tool → sub-agent invoked with full context

Maya — Booking Sub-Agent

GPT-4.1 · Transaction Engine

listings_leadsupdate_inquiry_crmbook_an_appointmentsend_email_notifications
Google Sheets CRM
Google Calendar
Gmail (×2 recipients)

// Workflow Architecture

Node-by-node breakdown.

Main Workflow — Kelly

1

Webhook Trigger

Evolution API posts inbound WhatsApp messages. Extracts phone, message body, and pushName from payload.

2

Session Manager (Redis)

Checks for existing session key landlord:session:{phone}. Creates UUID session ID on new contact; resumes on returning lead.

3

Active Ref Tracker (Redis)

Stores the last property reference a lead enquired about at landlord:activeRef:{sessionId} — enables context continuity across turns.

4

History Loader (Redis)

Fetches full conversation history from landlord:history:{sessionId}. Provides Kelly with multi-turn context.

5

Kelly AI Agent

GPT-4.1 agent with system prompt defining her persona, tone, and constraints. Three tools: listings_leads (property lookup), booking_specialist_workflow (handoff), and Think (scratchpad reasoning).

6

Response Formatter → Evolution API

Formats Kelly's output and dispatches reply via Evolution API send-text endpoint back to the WhatsApp lead.

Sub-Workflow — Maya

1

Workflow Trigger

Receives invocation from Kelly's booking_specialist_workflow tool call. Payload includes full conversation history and current lead context.

2

Parse Booking Handoff

Extracts and normalises the structured handoff data passed from Kelly — client name, phone, property reference, preferred time.

3

Conversation History Parser

Reconstructs the message array into Maya's expected input format so she has full context without re-fetching Redis.

4

Maya AI Agent

GPT-4.1 agent with booking-specialist persona. Has four tools: listings_leads (verify property), update_inquiry_crm (Google Sheets), book_an_appointment (Google Calendar), send_email_notifications (Gmail).

5

update_inquiry_crm

Appends a structured row to the Google Sheets inquiries tab: client name, phone, property ref, status, booking timestamp.

6

book_an_appointment

Creates a Google Calendar event for the viewing. Sets title, attendees, time block, and description with lead details.

7

send_email_notifications

Triggers two Gmail sends: confirmation email to the client with viewing details, and internal alert to the listing agent with lead summary.

8

Response to Main

Returns booking confirmation summary back to Kelly's tool call, so she can relay a natural-language confirmation to the lead on WhatsApp.

// Technical Stack

Every tool earns its place.

n8n

Orchestration Platform

Visual workflow engine that manages both agents, triggers, conditional routing, and inter-workflow tool invocation without custom server infrastructure.

GPT-4.1

LLM (Both Agents)

OpenAI's GPT-4.1 powers Kelly and Maya. Chosen for strong instruction-following, reliable tool-call formatting, and low hallucination rate on structured outputs.

Redis

Session & State Layer

Sub-millisecond key lookups for session IDs, conversation history serialisation, and active property reference tracking. Stateless WhatsApp → stateful agent context.

Evolution API

WhatsApp Gateway

Provides webhook-based inbound message events and REST endpoints for outbound sends — the primary communication channel for all lead interactions.

Google Sheets

Listings DB + CRM

Dual-role: source-of-truth for property listings (read by both agents) and append-only inquiry CRM updated by Maya on each booking.

Google Calendar

Appointment Engine

Maya books viewings directly to the agent's calendar via the Calendar API. Events include all lead details and prevent double-booking.

Gmail

Notification System

Dual notification dispatch: client-facing confirmation with viewing details; internal agent alert with lead profile and property context.

// Automation Logic

How the agents think.

The system behaviour is defined by careful prompt engineering and tool design — not hard-coded branching.

Kelly's Qualification Flow

  1. 1.Greets lead by name using WhatsApp pushName
  2. 2.Identifies buyer/tenant intent via natural conversation
  3. 3.Queries listings_leads to surface matching properties
  4. 4.Tracks the active property reference in Redis
  5. 5.Detects booking intent and hands off to Maya

Maya's Booking Flow

  1. 1.Receives structured handoff from Kelly
  2. 2.Verifies property details via listings_leads
  3. 3.Captures client info and preferred viewing time
  4. 4.Appends structured row to Google Sheets CRM
  5. 5.Books Google Calendar appointment
  6. 6.Sends dual Gmail notifications
  7. 7.Returns confirmation to Kelly for WhatsApp reply

Session Continuity

  1. 1.Every message resolves session via phone number
  2. 2.New leads get a UUID; returning leads resume
  3. 3.Full conversation history loaded from Redis
  4. 4.Active property ref preserved across turns
  5. 5.Context never lost between messages

// Business Value

What this actually delivers.

24/7 Lead Response

No lead goes unanswered regardless of time zone, public holidays, or agent availability. Kelly responds within seconds of any inbound WhatsApp message.

🤖

Zero-Touch Bookings

From first enquiry to confirmed calendar event with dual email notifications — Maya executes the entire pipeline without a human in the loop.

📊

Automatic CRM Hygiene

Every qualified lead is appended to the inquiry sheet with a consistent schema: name, phone, property ref, status, and timestamp. No manual data entry.

🕐

Agent Time Reclaimed

Listing agents receive a notification email with a pre-qualified lead summary. They show up to confirmed viewings — not to qualification calls.

🧠

Context-Aware Conversations

Redis session management means Kelly remembers what the lead asked about, which properties they showed interest in, and where the conversation left off.

📈

Scalable Without Hiring

The system handles concurrent leads with independent sessions. Volume can increase 10× without adding headcount or increasing response time.

// Engineering Decisions

Why it's built this way.

Decision 01

Two agents instead of one

Splitting responsibilities keeps each agent's context window tight and its system prompt focused. Kelly is optimised for conversation; Maya is optimised for transactional accuracy. A single monolithic agent would require a much larger context and more complex branching logic — increasing cost and failure surface.

Decision 02

Redis for session state, not n8n memory

n8n's built-in memory is per-execution. Real estate lead conversations span hours or days across multiple WhatsApp sessions. Redis gives persistent, phone-keyed state that survives workflow re-executions, server restarts, and disconnections.

Decision 03

Google Sheets as both listings DB and CRM

The client already manages their property listings in Google Sheets. Rather than introducing a new database layer, both agents query the same source of truth. The inquiry tab is append-only — a deliberate choice to prevent agent-side data corruption.

Decision 04

Sub-workflow as a tool call, not a separate trigger

Invoking Maya as a tool call from Kelly's agent node means the handoff is synchronous — Kelly waits for Maya's confirmation before sending the final WhatsApp reply. An asynchronous trigger would require a separate state reconciliation mechanism.

Decision 05

GPT-4.1 over cheaper alternatives

Real estate bookings involve structured data extraction (dates, property refs, personal details) and multi-step tool use. GPT-4.1's superior instruction-following and tool-call reliability justifies the cost at this use-case complexity level.

// Challenges

What made this hard.

Context handoff integrity

Ensuring Maya received a complete, correctly-formatted conversation history from Kelly's tool call required precise prompt engineering and careful serialisation of the Redis history format.

Session collision prevention

Multiple leads can message simultaneously. Each phone number needed its own isolated session namespace in Redis to prevent conversation state bleed between concurrent sessions.

Tool call reliability

Getting GPT-4.1 to reliably invoke the right tool at the right time — especially the booking handoff — required iterative system prompt tuning and explicit tool-trigger conditions.

Calendar availability logic

Maya books appointments without a built-in availability check. This required designing the prompt to collect and validate preferred viewing times before invoking the Calendar API.

Dual email targeting

The send_email_notifications tool needed to dispatch two distinct emails (client-facing vs agent-facing) with different content and recipients from a single tool invocation.

WhatsApp message formatting

Evolution API has specific constraints on message format. Kelly's responses had to be engineered to avoid markdown that would render as raw symbols in WhatsApp's plain-text display.

// Future Improvements

Where this goes next.

Real-time availability checking

High

Integrate Google Calendar free/busy queries before Maya books, eliminating conflict potential.

Image-enabled property tours

Medium

Extend Kelly to send property images and floor plans via Evolution API media messages.

Lead scoring layer

Medium

Add a pre-agent classification node that scores intent (hot/warm/cold) and adjusts Kelly's response urgency.

Multi-language support

Low

GPT-4.1 handles multilingual input — formalise language detection to auto-switch Kelly's response language.

No-show follow-up automation

High

If a lead misses their viewing, trigger a re-engagement sequence with alternative slots.

Analytics dashboard

Low

Stream booking events to a Google Data Studio dashboard tracking conversion rate, peak enquiry times, and property demand.

// want something like this?

Let's build your system.

Every automation I build is production-grade and specific to the business. No templates, no shortcuts.