Skip to main content

Architecture

Understanding the technical architecture of PriveTag B2A Platform.

System Overview

Component Details

API Gateway

The entry point for all AI agent requests:
FeatureTechnologyDescription
Load BalancingAWS ALBDistributes traffic across instances
SSL TerminationCloudFrontHandles HTTPS
Rate LimitingRedisPer-key rate limiting
AuthenticationCustomAPI key validation

Recommendation Engine

Processes recommendation requests: Key Technologies:
  • Language: TypeScript (Node.js)
  • ML Model: Custom scoring algorithm
  • Cache: Redis for hot data

Booking Service

Handles booking creation and voucher delivery:
StepDescriptionSLA
ValidationCheck availability< 100ms
ReservationLock inventory< 200ms
PaymentProcess if required< 2s
VoucherGenerate QR + PDF< 500ms
EmailSend to user< 30s

Inventory Hub

Aggregates availability from multiple sources: Inventory Priority:
  1. Direct venue partnerships (highest margin)
  2. Klook (good coverage, fast API)
  3. Viator (extensive catalog)
  4. GetYourGuide / KKday (backup)

Ground Truth Engine

Processes and stores verified visit data:
-- Ground Truth Schema
CREATE TABLE ground_truth (
    id UUID PRIMARY KEY,
    booking_id UUID REFERENCES bookings(id),
    context_log_id UUID REFERENCES context_logs(id),
    activity_id UUID REFERENCES activities(id),
    verified_at TIMESTAMP NOT NULL,
    verification_method VARCHAR(20),
    user_profile JSONB,
    created_at TIMESTAMP DEFAULT NOW()
);

-- Index for efficient lookups
CREATE INDEX idx_gt_profile ON ground_truth
    USING GIN (user_profile);

Data Flow

Recommendation Flow

Booking Flow

Database Schema

Core Tables

Caching Strategy

Cache Layers

LayerTTLData
L1: Request1 minAPI responses
L2: Context15 minWeather, enrichment
L3: GT Aggregates1 hourGround truth scores
L4: Static24 hoursActivity metadata

Cache Keys

# Context cache
context:{city}:{weather_hash} → enriched context

# Ground Truth aggregates
gt:{travel_type}:{city}:{category} → activity scores

# Inventory
inventory:{activity_id}:{date} → availability

Scalability

Horizontal Scaling

Performance Targets

MetricTargetCurrent
API Latency (p50)< 100ms85ms
API Latency (p99)< 500ms350ms
Booking Success Rate> 99%99.2%
Uptime99.9%99.95%
Ground Truth Rate> 80%85%

Security

API Security

  • Authentication: API key in x-api-key header
  • Rate Limiting: Per-key limits
  • IP Allowlisting: Optional for enterprise
  • Encryption: TLS 1.3 for all connections

Data Security

  • At Rest: AES-256 encryption
  • In Transit: TLS 1.3
  • PII Handling: Anonymization for ML
  • Retention: Configurable per client

Monitoring

Key Metrics

Alerting

AlertThresholdAction
Error Rate> 1%Page on-call
Latency p99> 1sInvestigate
Booking Failures> 5/minEscalate
Database CPU> 80%Scale up

Next Steps