SH.
Back to The Lab
The Lab · 04

Vector Logistics Autopilot

A real-time travel disruption recovery backend powered by Fastify, WebSockets, LangGraph, and Redis. Explores a seven-state recovery workflow with parallel option search, human-in-the-loop confirmation interrupts, Whisper audio transcription, and threshold-gated payment verification.

01. Project Overview

Housed in the Gemini-Vector-Backend repository, Vector is a TypeScript travel recovery backend designed to detect flight disruptions, search alternative travel options in parallel, propose a ranked recovery plan over WebSockets, and execute bookings after explicit user confirmation.

02. Problem & Exploration

Explores stateful, human-in-the-loop agent orchestration for time-sensitive travel disruptions where parallel tool fan-out, real-time client streaming, and payment safety guardrails must work together.

What This Experiment Explores

Explores LangGraph interrupt/resume state machines, parallel Send fan-out, real-time WebSocket event streaming, and multi-factor payment guardrails for voice-driven agent workflows.

03. Implemented Capabilities

  • Seven-state LangGraph finite-state machine (Monitoring through Completed) using interrupt() and Command({ resume }) to pause for user confirmation or rejection.
  • Parallel search fan-out via LangGraph Send across flight, hotel, traffic, and ride tool wrappers, aggregated and ranked into structured JSON proposals by OpenAI GPT-4o.
  • Fastify HTTP and WebSocket server (/ws) persisting travel sessions and graph state in Redis via ioredis, with a dev-only delay injection endpoint for testing.
  • Per-session base64 audio chunk buffering and OpenAI Whisper transcription with spoken confirmation and cancellation phrase matching.
  • Threshold-gated payment workflow (default above £50) checking voice biometric verification, spoken confirmation phrase, and Stripe PaymentIntents HTTP authorization.

04. Technical Approach & Stack

Fastify registers REST endpoints (/health, /sessions, /metrics) and a bidirectional WebSocket handler that streams state transitions, proposals, and payment verification prompts. A compiled LangGraph StateGraph coordinates disruption analysis, parallel tool fan-out, and human confirmation interrupts, while Redis stores session records and graph snapshots.

Verified Technology Stack

  • TypeScript
  • Node.js
  • Fastify
  • WebSockets
  • LangGraph
  • OpenAI API
  • Redis
  • Zod
  • Stripe API

05. Known Limitations & Notes

  • Despite the repository name Gemini-Vector-Backend, the implementation uses OpenAI (GPT-4o and Whisper) and Redis rather than Google Gemini or a vector database.
  • Voice biometric verification, Stripe charges, Whisper transcription, and travel search tools include development fallbacks or stubs when external API keys or service URLs are unset.
  • The /metrics endpoint currently returns a placeholder active_sessions count.