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
- 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/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.