Skip to content

AI Agent Guide ​

CBS has two AI agent surfaces:

  • WhatsApp AI — customer-facing assistant that handles inbound messages via WhatsApp. Customers can enquire about availability, check their booking status, ask about pricing, and get support without calling in.
  • Speedia AI — internal staff assistant. Staff can query the system in natural language, trigger verifications, look up records, and run SOPs conversationally from an internal chat interface.

Both agents run the same underlying SOPs from server/src/sops/sops.json and call the same CBS API routes as human staff.


How agents resolve customers ​

WhatsApp AI ​

When a message arrives from a WhatsApp number, the agent automatically looks up the customer by matching whatsapp_phone_number. No Booking ID is needed — the agent identifies who is writing from the channel.

Lookup tools:

  • query_customer_docs — full customer record search (pass whatsapp_phone_number)
  • get_customer_bookings — all bookings for that customer
  • get_customer_claims — all claims for that customer

Phone numbers must be stored in E.164 format with full country code and no spaces (e.g. 18765550123). If a customer is not found, ask them to confirm the number on their account.

Speedia AI (internal) ​

Staff trigger Speedia by mentioning it in the internal chat. Speedia can accept a customer name, email, Booking ID, or phone number to look up records — and can run any SOP on request.


Customer-facing SOPs (WhatsApp AI) ​

These run in ai mode — the agent responds conversationally.

Booking enquiry (booking_request) ​

What it does: Handles a customer who wants to rent a vehicle.

Agent collects:

  1. Customer name (if not already resolved from WhatsApp lookup)
  2. Pickup and drop-off dates and times
  3. Preferred vehicle class
  4. Pickup and drop-off location

Agent then: searches availability, presents 2–3 options with rates, confirms their choice, and asks for email/phone to send the checkout link.

Example agent opener:

"Hello! I'd love to help you book a rental. To give you the best options and pricing, could you please let me know your pickup/drop-off dates and times, as well as the type of vehicle you are looking for?"

Booking status check (booking_query) ​

What it does: Looks up a customer's existing reservation and explains its current status.

Agent asks for: Booking ID/reference, or uses the WhatsApp number to auto-resolve the customer.

Agent then: looks up the booking, optionally calls query_customer_docs for invoice/contract detail, and explains: status, vehicle, dates, outstanding balance.

Example agent response:

"Thank you! I have located your reservation. Your booking is fully Confirmed for a Toyota Corolla from June 5 to June 10. Pickup is scheduled at our Main Location at 10:00 AM."

Refund request (refund_request) ​

What it does: Processes a customer refund or cancellation request.

Agent checks: Payment status and cancellation policy for the booking. Advises refund timeline (3–5 business days) if eligible, or escalates if outside the free cancellation window.

Accident / damage report (accident_or_damage_report) ​

What it does: Handles a customer reporting a vehicle incident mid-rental.

Safety first — agent always confirms whether everyone is safe before anything else. If there are injuries, advises calling emergency services immediately.

Agent then: gets location and Booking ID, walks customer through: police report, photos, third-party details, coordinates roadside if needed.


Internal SOPs (Speedia AI) ​

These run in ai or api mode — Speedia can be invoked by staff conversationally.

QuickBooks verification (quickbooks_verification) ​

What it does: Runs a full financial audit on a booking.

Staff triggers it by: asking Speedia to verify a booking (by Booking ID), or via the QuickBooks dialog on the booking edit page.

What Speedia checks:

  1. Booking state is valid for verification
  2. All debits and credits balance
  3. Booking total matches sum of all payments
  4. Security deposit is captured and recorded
  5. Every payment receipt is OCR-read and matched to the correct invoice
  6. Transactions map to the correct QuickBooks accounts
  7. All contracts are fully signed (signature.url present)
  8. Any discrepancies are flagged

Results written back to booking: quickbooks_ai_verification_status, quickbooks_verified_items, quickbooks_ai_feedback, quickbooks_last_ai_verification_run

E2E browser tests (scheduled/developer-triggered) ​

Speedia can trigger browser automation SOPs on demand or on a schedule:

  • booking_e2e_browser_test — full booking lifecycle smoke test
  • customer_e2e_browser_test — customer CRUD smoke test
  • booking_permissions_e2e_browser_test — role-based access regression test

These run against staging or local environments.


SOP configuration ​

All SOPs are in server/src/sops/sops.json. Each entry has:

FieldDescription
nameSOP identifier
modes["ai", "api"] — where the SOP runs
categorycustomer_facing or internal
enabledWhether the SOP is active
browser_modetrue for browser automation SOPs
trigger_conditionsPlain-language conditions that activate this SOP
required_informationData the agent must collect before proceeding
stepsProcedural steps (strings for conversational, objects for browser automation)
example_responsesSample language for specific situations

To add or modify a SOP, edit sops.json and redeploy the Worker — no code changes needed.