RAIA™ Specification

Hierarchical Loops & Polymorphic Comms

This spec documents the real-time visual loops showing background agent processes, pending human gates, and chronological action events in a centralized workspace.

← Back to Developer Hub TEXTBOOK SPECIFICATION
RAIA™ (Real estate Artificial Intelligence Agent) Specification

This spec documents the real-time visual loops showing background agent processes, pending human gates, and chronological action events in a centralized workspace.

🧩 Section A: In Plain English

Hierarchical Loops & Polymorphic Comms

Imagine a team of specialized assistants, each with specific expertise, working together 24/7. They handle routine tasks automatically, only asking for human input when facing truly important decisions.

Sovereign Architecture Spec

Hierarchical Loops & Polymorphic Comms

Deconstructing RAIA™ (Real estate Artificial Intelligence Agent) OS into dedicated, nested state-machine loops at each tier of the Rental Pyramid, and abstracting all message deliveries into a single **Polymorphic Comms Engine** to achieve high-leverage agentic design.

1. The 3-Tier Operational Loops

The Rental Pyramid State Machines

Each layer of the pyramid runs its own dedicated background loop. An upper layer loop **cannot execute** until all invariants of the lower loops are fully satisfied and locked in.

T1: PEAK

Owner Onboarding Loop

Verifies land registry titles and completes KYC/AML checks for beneficial owners before any property registration occurs.

📌 Target: Landlord / SPV
📂 Required Docs: ID, MSA, Title Deed
⚙️ Action: Sumsub Verification Hook
T2: CORE

Physical Asset Readiness

Manages physical property readiness—securing keys, safety certificates (EPC, EICR, CP12), and municipal Selective/HMO licenses.

📌 Target: Asset / Contractor
📂 Required Docs: Keys, Safety Certs
⚙️ Action: Automated Surveyor Booking
T3: BASE

Tenancy Lifecycle Loop

Manages signed ASTs, deposit protections, condition inventories, rent guarantee insurance (RGI), and monthly rent ledger sync.

📌 Target: Tenant / Occupant
📂 Required Docs: AST, Deposit, Inventory
⚙️ Action: MyDeposits & automated bank reconciliation gateway Sync

2. The Polymorphic Comms Engine

Object-Oriented Agent Skills

Instead of duplicating messaging logic inside individual state machines, RAIA™ (Real estate Artificial Intelligence Agent) abstracts all communication into a single **Polymorphic Comms Engine** (or comms-delivery-engine skill). The loop simply passes the recipient and template; the comms engine dynamically resolves transport and tracking:

1. Target Person ID
person_id: "usr_9024c81"
Resolves to: Mi Song (Landlord)
2. Message Template
template: "epc_expiry_consent"
Params: {cost: "£79", date: "June 26"}

Repository Code

The live codebase implementation for this specification sits within the following repository folder:

ex-col items-center justify-center">
Comms Engine Polymorphic Skill
Looks up preferred channels & active slots in tbl_persons_comms_stats.
💬
WhatsApp (Preferred)
Delivered via Twilio API
92% Reach
📧
Email (Secondary)
Delivered via SendGrid API
Fallback
📱
SMS / Text (Alert)
Delivered via Twilio SMS
Fallback

3. Unified Object-Oriented Code Specification

By modularizing our skills, we decouple business logic from transport details. Here is how our loops cleanly invoke the Polymorphic Comms skill in the code:

TypeScript Class / Design
class CommsDeliveryEngine {
  private async getPreferences(personId: string) {
    // Queries tbl_persons_comms_stats & tbl_persons_channels
    const { data } = await supabase
      .from('tbl_persons_comms_stats')
      .select('comm_preferred, whatsapp_number, email_address')
      .eq('person_id', personId)
      .single();
    return data;
  }

  public async deliverMessage(
    personId: string, 
    templateKey: string, 
    params: Record
  ) {
    const pref = await this.getPreferences(personId);
    const content = this.compileTemplate(templateKey, params);

    // Polymorphic routing based on preferred channels
    if (pref.comm_preferred === 'whatsapp') {
      return await this.sendWhatsApp(pref.whatsapp_number, content);
    } else if (pref.comm_preferred === 'email') {
      return await this.sendEmail(pref.email_address, content);
    } else {
      return await this.sendSMS(pref.whatsapp_number, content); // Fallback
    }
  }
}

// EXAMPLE LOOP INVOCATION: T2 Property Compliance Loop
class PropertyComplianceLoop {
  private comms = new CommsDeliveryEngine();

  public async handleExpiringEPC(assetId: string, landlordId: string) {
    await this.comms.deliverMessage(landlordId, 'epc_expiry_consent', {
      cost: "£79",
      date: "June 26"
    });
    // State machine updates to: PENDING_LANDLORD_CONSENT
  }
}

Repository Code

The live codebase implementation for this textbook logic sits within the following repository folder: