Node + Express app that uses the latest @openai/agents SDK to plan a Spring Break trip for any destination city.
The app:
- Collects user inputs for trip timing, length, departure city, destination, activities, weather preferences, air travel class (
economyorbusiness), and hotel class (3,4,5stars) - Uses multiple agents and tools (including OpenAI Web Search) to generate options for:
- Air travel
- Hotel
- Car rental
- Activities
- Safety concerns and packing list
- Shows estimated costs in USD
- Computes destination days/nights from start/end dates and flight schedule timing (including overnight flights)
- Aligns hotel nights and car rental days/costs to computed destination stay
- Streams a live agent activity timeline so users can follow:
- prompts sent to each agent
- responses returned by each agent
- tool calls (including arguments) and tool outputs
- stage-level summaries
- Asks the user to confirm each component
- Presents a final itinerary for final confirmation
- Never purchases anything
TripResearchAgent: Finds realistic flight/hotel/car/activity options and pricingSafetyPackingAgent: Produces safety notes, local transport advice, and packing itemsItineraryComposerAgent: Builds a structured itinerary with confirmation questionsFinalReviewAgent: Produces final summary + final confirmation prompt
An alternative sequential agent workflow is available in src/agents/sequentialAgents.js:
- FlightBookingAgent: Researches flights and calculates the exact days/nights at destination based on flight schedule (accounting for overnight flights and time zone differences)
- HotelBookingAgent: Uses flight data to determine hotel check-in/check-out and calculates nights needed; finds hotels matching that duration
- CarRentalAgent: Uses flight arrival/departure times to determine rental period; recommends cars for that duration
- EventPlanningAgent: Based on final trip duration and arrival/departure times, plans activities, dinners, and events with realistic scheduling
Why Sequential? This approach enables each agent to make informed decisions based on prior results:
- Once flights are chosen, hotel nights are automatically calculated → accurate pricing
- Once flights are confirmed, car rental days are determined → accurate rental period
- Event planning can account for arrival fatigue and departure timing
To use sequential agents, call POST /api/plan-sequential instead of /api/plan-stream.
- OpenAI hosted Web Search tool (
webSearchTool()) - Custom
budget_calculatorfunction tool for itemized USD calculations - Standardized tool monitoring for both hosted (built-in) and custom tools via:
tool_call_startedtool_call_completed- derived web search events:
web_search_called,web_search_output
server.js: Express server + API routes + in-memory itinerary statesrc/agents/tripPlanner.js: Agent setup, tools, orchestration, validationpublic/index.html: Input form + itinerary UIpublic/app.js: Frontend logic for planning and confirmationspublic/styles.css: Minimal styling
-
Install dependencies:
npm install
-
Configure environment variables: Put the secret key in the Github Secrets. The code should pick up the Secret However, if you want to run on your own machine then you cand do the following.
cp .env.example .env
Edit .env and set your API key:
OPENAI_API_KEY=...
OPENAI_MODEL=gpt-4.1-mini
PORT=3000
Development mode:
npm run devProduction mode:
npm startOpen:
http://localhost:3000
POST /api/plan- Builds itinerary draft from user trip preferences
POST /api/plan-stream- Streams planning activity events (
research,safety,composition) and final itinerary result
- Streams planning activity events (
POST /api/plan-sequential(NEW)- Streams sequential agent planning: flights → hotels → cars → events
- Each agent uses prior results for informed decision-making
POST /api/confirm-component- Confirms one component (
flight,hotel,carRental) by selected option ID
- Confirms one component (
POST /api/final-confirmation- Final yes/no itinerary approval
GET /api/health- Health check
Use the UI and test trips to cities like:
- Paris
- Milan
- Madrid
- Taipei
- Hong Kong
- London
This application is planning-only. It never purchases flights, hotels, rentals, or activities.