Booking Execution Preview
Agent #3 · Stage 5I — Real Provider Capability Verification & Controlled Activation · Stage 5H Capability Verification Framework · Stage 5G Restaurant Execution + Phone Agent · Stage 5F.2 GYG Completion · Stage 5F.1 Widget Execution · Stage 5B Execution Layer. Real account-level access audit, safe endpoint probing, provider_supports vs account_authorised distinction. No real bookings, holds, or charges made.
Scenarios A–AP (A–T: Stage 5B · U–Z: Stage 5F.1 Widget · AA–AH: Stage 5F.2 Completion · AI–AP: Stage 5G Restaurant)
Stage 5B Architecture
Entities
- • BookingIntent
- • BookingExecutionProposal
- • BookingExecutionAttempt (+ awaiting_user_completion, outcome_unknown)
- • Reservation (+ partner_attribution, booking_channel)
Shared Modules
- • bookingChannelResolver
- • bookingExecutionRouteResolver (deterministic)
- • bookingProviderAdapter (adapter contract)
- • bookingAvailabilityModel (freshness)
- • bookingApprovalHash (SHA-256 scope)
- • bookingExecutionIdempotency (timeout reconcile)
- • bookingExternalConfirmation (confirmation gate)
- • approvalScope · phoneBookingContract · phoneBookingResult
- • bookingExecutionStateMachine · bookingIntentClassifier
Partner-First Channel Priority
Browser automation / web scraping is never used. If a partner integration is available, it must not be bypassed. Partner failure is classified into 4 modes; falling back to a different channel is a material change requiring traveller approval.
Deterministic Test Suites
Stage 5F.1 — GYG Widget Production Execution
New Shared Modules
- • gygWidgetExecutionPolicy (eligibility gate, feature flag)
- • gygWidgetChannel (widget embed, Q7TNRMR)
New Backend Functions
- • executeGygWidget (opens widget, creates attempt)
- • gygWidgetReturn (return state handler)
- • testGygWidgetExecution (73 tests)
Feature Flag
GYG_WIDGET_EXECUTION_ENABLED — server-side, defaults to false. Kill switch: when disabled, returns EXECUTION_CHANNEL_DISABLED. Enforced server-side — not just hidden in UI.
Production State Transitions
Opening the widget does NOT create a confirmed Reservation. "I booked it" routes to Reservation Review/Reconciliation — does NOT directly confirm.
Stage 5F.2 — GYG Completion, Return & Confirmation
New Shared Modules
- • gygConfirmationCapabilities (7-capability audit)
- • gygConfirmationGate (independent confirmation gate)
- • bookingTestHelpers (shared test helpers)
New Backend Functions
- • confirmGygBooking (gate + Reservation create)
- • testGygCompletionLifecycle (126 tests)
GYG Confirmation Capabilities (all 7)
0 confirmed · 1 inconclusive · 6 unavailable. The confirmation gate rejects all automated confirmations until at least one capability becomes confirmed.
Completion State Machine
Core invariant: partner_widget NEVER becomes confirmed merely because the widget was opened, closed, or the traveller returned. Only the independent confirmation gate may produce confirmed — and only with authoritative external evidence.
Confirmation Evidence Required
- • provider = getyourguide (never fabricated)
- • external_booking_id (real provider reference, never fabricated)
- • confirmation_source (provider_api_response | booking_retrieval | provider_webhook | affiliate_conversion_callback | server_to_server)
- • confirmation_timestamp (when the provider confirmed)
- • execution_attempt_id (the attempt this belongs to)
- • booking_product_id (GYG tour ID)
Stage 5G — Restaurant Execution + Phone Agent
New Shared Modules
- • phoneAgentCapabilities (9-capability audit)
- • restaurantExecutionPolicy (routing, privacy, negotiation, confirmation)
New Backend Function
- • testRestaurantExecution (94 tests)
Phone Agent Capability Audit (all 9)
0 confirmed · 1 inconclusive · 8 unavailable. Superagents CAN make outbound calls (Builder plan+), but backend functions cannot invoke Superagents or receive structured results. Phone agent is architecture-only — no executable phone rail.
Restaurant Routing Priority
Phone is NOT used simply because it is available. If a confirmed transactional API can make the same reservation, it has priority. TheFork is NOT treated as transactional until its actual InstaBookr credentials/access have been verified.
Phone Execution State Model
Terminal: confirmed · unavailable · no_answer · requires_reapproval · requires_user · outcome_unknown · failed
Core invariant: A completed call does NOT equal a confirmed reservation. outcome_unknown (call dropped after apparent acceptance) must reconcile before retry — never blindly call again.
Phone Privacy Boundary
- • restaurant_name, date, time, party_size
- • traveller_first_name
- • seating_preference, special_requests
- • payment/card details
- • passport/account credentials
- • trip itinerary, other destinations
- • traveller last name, contact, email
Restaurant Confirmation Evidence
- • restaurant, date, time, party_size (required)
- • confirmation_reference (optional — not mandatory if restaurant doesn't issue one)
- • reservation_name (name the reservation is held under)
- • confirmation_source: provider_api | phone_agent
- • execution_attempt_id + timestamp
Never invent a confirmation number. A booking may be confirmed with structured evidence (date, time, party_size, restaurant acceptance) even without a reference number.
Stage 5H — Real Execution Capability & Provider Activation
New Shared Modules
- • capabilityVerificationFramework (status + evidence, activation state)
- • providerActivationFlags (per-rail kill switches)
- • capabilityExecutionGate (5-condition gate)
- • capabilityMatrix (authoritative readiness matrix)
- • viatorCapabilityAudit · gygCapabilityAudit · agodaCapabilityAudit
- • restaurantProviderAudit · phoneAgentResolution
New Backend Function
- • testCapabilityVerification (155 tests, A–O)
New Internal Page
- • CapabilityReadinessPreview (/CapabilityReadinessPreview)
Final Capability Matrix
| Provider | Category | Search | Avail. | Transactional | Confirmation | Channel | Prod |
|---|---|---|---|---|---|---|---|
| GetYourGuide | Experiences | ✓ | ✓ | ? | ✗ | partner_widget | Off |
| Viator | Experiences | ✓ | ? | ? | ? | partner_deep_link | Off |
| Agoda | Accommodation | ✓ | ✓ | ✗ | ✗ | partner_deep_link | Off |
| TheFork | Restaurants | ✗ | ✗ | ✗ | ✗ | unavailable | Off |
| Phone Agent | Restaurants | n/a | n/a | ? | ? | unavailable | Off |
✓ = confirmed · ? = inconclusive · ✗ = not_authorised · n/a = not applicable. Every value from the capability audit — no inferred capabilities.
Production Kill Switches (per rail)
Each rail has its own flag, defaulting to false. No global booking switch. Verified ≠ production_enabled.
Activation Conditions (all 5 required)
Failure of ANY condition prevents execution. The capabilityExecutionGate enforces all 5 before the router selects a channel.
Phone Agent: Platform vs App Level
Base44 Superagents CAN make outbound calls (platform-level: confirmed). BUT backend functions cannot invoke Superagents or receive structured results (app-level: unavailable). Platform A ≠ App B. Currently 0/9 at app level — phone remains architecture-only.
External Actions Required
- • Viator: Obtain sandbox access, perform controlled live test of booking_hold/creation
- • GetYourGuide: Determine if GETYOURGUIDE_API_KEY is affiliate or transactional; register webhook for confirmation
- • Agoda: Apply for Agoda Book API access through Partner Portal
- • TheFork: Apply for TheFork API partner access, obtain credentials
- • Phone Agent: Base44 must provide a callable API from backend functions to the phone system
Stage 5I — Real Provider Capability Verification
New Shared Module
- • realAccessAuditFramework (probe classification, sanitization, report)
New Backend Functions
- • auditRealProviderAccess (real endpoint probes)
- • testRealAccessAudit (32 tests)
New Report Page
- • CapabilityVerificationReport (/CapabilityVerificationReport)
Real Probe Results (Viator)
| Endpoint | Method | HTTP Status | Classification | Meaning |
|---|---|---|---|---|
| /bookings/cancel-reasons | GET | 403 | not_authorised | Account is affiliate/search only — no booking access |
| /bookings/hold | POST (invalid params) | 403 | not_authorised | Hold endpoint forbidden — Merchant access required |
| /bookings/INVALID-REF | GET | 404 | inconclusive | Ambiguous — but 403s on other endpoints confirm no access |
Result: Viator account is not_authorised for booking endpoints. The VIATOR_API_KEY provides affiliate/search access only. Viator requires Merchant or Full-access+Booking affiliate level for /bookings/hold and /bookings/{ref}/cancel.
Updated Capability Matrix (Real Account Evidence)
| Provider | Category | Auth | Search | Avail. | Booking Hold | Booking Create | Retrieval | Cancel | Overall |
|---|---|---|---|---|---|---|---|---|---|
| Viator | Experiences | ✓ | ✓ | ✓ | ✗ 403 | ✗ | ? 404 | ✗ 403 | not_auth |
| Agoda | Accommodation | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ | ✗ | not_auth |
| TheFork | Restaurants | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | not_auth |
| GetYourGuide | Experiences | ✓ | ✓ (widget) | ✓ (widget) | ? | ? | ? | ✗ | inconclusive |
| Phone Agent | Restaurants | ✗ | n/a | n/a | ✗ | ✗ | ✗ | ✗ | not_auth |
✓ = confirmed · ? = inconclusive · ✗ = not_authorised · n/a = not applicable. 0 providers have transactional booking access. All execution flags remain false.
Provider Supports vs Account Authorised
Viator's platform offers /bookings/hold, /bookings/{ref}/cancel, etc. This is documented and known.
Our VIATOR_API_KEY returned 403 Forbidden on booking endpoints. The account is affiliate/search only — NOT authorised for booking.
Core principle: A capability is only executable when the account is authorised — not merely when the provider supports it.
Stage 5B Execution Capability Audit
Partner booking APIs: Zero integrated. All existing integrations (Viator, GetYourGuide, TravelPayouts, Amadeus, Agoda, TripAdvisor, Google Places) are search/inventory only — none can create a booking. The adapter contract is architecture-ready.
Outbound phone: No API exists in the backend function environment. phone_agent is architecture-only — execution deferred until a calling API is available.
Browser automation: Not available in backend functions. Base44 Superagent browser/phone capabilities are a separate product surface, not callable from executeBookingProposal. Browser scraping is prohibited by design.
Safety Boundaries
- • Partner integration is the primary channel — never bypassed
- • No browser automation / web scraping
- • Channel change on partner failure requires traveller approval
- • Planning and execution are strictly separated
- • No external commitment until explicit traveller approval
- • Approval scope is machine-readable and enforced
- • Stage 5B: Approval-scope hash recomputed before execution — mismatch = APPROVAL_STALE
- • Stage 5B: Execution idempotency key prevents double-bookings from timeouts & double-clicks
- • Stage 5B: Availability revalidated immediately before execution — stale = no auto-book
- • Stage 5B: External confirmation required before canonical Reservation created
- • Stage 5B: Timeout reconciliation reuses existing booking — no second external call
- • Stage 5B: Secure-web handoff = awaiting_user_completion, NOT confirmed
- • Stage 5F.2: partner_widget NEVER confirmed from widget open/close/return — only from the independent confirmation gate
- • Stage 5F.2: User self-report ("I booked it") = user_reported_completion, NOT confirmed
- • Stage 5F.2: Confirmation gate rejects ALL confirmations when no GYG capability is confirmed (currently 0/7)
- • Stage 5F.2: Duplicate confirmation events are idempotent — no duplicate Reservations or itinerary blocks
- • Stage 5F.2: Reopening the same widget preserves original intent, proposal, product, provider, scope, and attribution
- • Stage 5G: Phone is never used simply because it is available — confirmed partner API has priority
- • Stage 5G: TheFork (or any restaurant provider) is NOT transactional until credentials are verified
- • Stage 5G: Phone agent may only negotiate within the approved scope — never autonomously expand constraints
- • Stage 5G: A completed call does NOT equal a confirmed reservation — structured evidence required
- • Stage 5G: outcome_unknown must reconcile before retry — never blindly call the restaurant twice
- • Stage 5G: Privacy boundary: only booking-necessary info passed to the agent — never payment, passport, or trip details
- • Stage 5G: Confirmation number is NOT mandatory — never invent one; structured evidence suffices
- • Stage 5G: Confirmed booking creates one canonical Reservation + hard-locks the itinerary block (booking_channel = phone_agent)
- • Stage 5H: A capability is not executable merely because the provider/platform offers it — must be accessible to THIS InstaBookr application
- • Stage 5H: Search access does NOT imply booking access — each capability classified independently
- • Stage 5H: GYG partner ID (Q7TNRMR) is NOT API credentials — it is an affiliate identifier
- • Stage 5H: Platform-level phone capability without app invocation path = NOT executable
- • Stage 5H: Verified ≠ production_enabled — a capability can be verified + disabled
- • Stage 5H: Each execution rail has its own feature flag — no global booking switch, all default false
- • Stage 5H: Test/sandbox access never automatically enables production
- • Stage 5H: Verification evidence never stores credentials, secrets, or tokens
- • Stage 5H: No capability audit can itself create an external booking
- • Stage 5H: Provider loses authorisation → router immediately stops selecting transactional channel
- • Stage 5H: Commercial commission must not override identity correctness, availability, or execution quality
- • Stage 5I: Real probes use intentionally invalid parameters — no booking, hold, or state is ever created
- • Stage 5I: A 403 on any booking endpoint definitively proves account is not authorised — even if other probes are inconclusive
- • Stage 5I: Provider supports ≠ account authorised — only account-level evidence makes a capability executable
- • Stage 5I: Search access does NOT imply booking access — each capability classified independently with real probes
- • Stage 5I: No credentials, tokens, or secrets are exposed in probe results, evidence, or reports
- • Stage 5I: All execution flags remain false throughout the audit — no activation without explicit approval
- • Stage 5I: The audit itself never creates an external booking — it only probes with invalid parameters
- • Phone agent may not negotiate beyond approved scope
- • Financial commitment requires separate explicit approval
- • No raw card details stored or transmitted
- • Partner attribution, booking IDs & commission preserved on Reservation
