{"slug": "a-travel-itinerary-planner-agent-in-typescript-with-hazeljs", "title": "A Travel Itinerary Planner Agent in Typescript with HazelJS", "summary": "A developer built an intelligent travel itinerary planner using HazelJS, an AI-native framework. The planner uses multiple agents with RAG capabilities to extract travel profiles, research destinations, and build personalized itineraries. The project demonstrates HazelJS's agent orchestration and production-ready patterns.", "body_md": "In this post, we'll build an intelligent travel itinerary planner using HazelJS. This agent helps users discover destinations, create personalized itineraries, and get logistics suggestions—all while demonstrating HazelJS's powerful agent orchestration, RAG capabilities, and production-ready patterns.\n\nOur travel itinerary planner handles the complete travel planning workflow:\n\nHazelJS provides a production-ready framework for building AI-native applications. For this project, we leverage:\n\n`@Agent`\n\n, `@Tool`\n\n, and `@Delegate`\n\ndecorators\n\n```\ntravel-itinerary-agent/\n├── src/\n│   ├── agents/              # Agent implementations\n│   │   ├── travel-intake.agent.ts\n│   │   ├── destination-research.agent.ts\n│   │   ├── itinerary-builder.agent.ts\n│   │   ├── logistics.agent.ts\n│   │   └── travel-advisor.agent.ts\n│   ├── providers/           # LLM and embedding providers\n│   │   ├── travel-planning-llm.provider.ts\n│   │   └── local-embedding.provider.ts\n│   ├── data/                # Travel fixtures\n│   │   └── travel-fixtures.ts\n│   ├── travel/              # Controllers and services\n│   │   ├── travel.controller.ts\n│   │   └── travel-kb.service.ts\n│   ├── app.module.ts\n│   ├── health.controller.ts\n│   └── index.ts\n├── package.json\n├── tsconfig.json\n└── README.md\n```\n\nThe [TravelIntakeAgent] extracts structured information from natural language:\n\n```\n@Agent({\n  name: 'TravelIntakeAgent',\n  description: 'Extracts destination, dates, budget, interests, travel style, and group size.',\n  systemPrompt: 'You are a travel intake specialist. Extract the traveler profile before any itinerary is created.',\n  maxSteps: 4,\n  temperature: 0,\n})\n@Service()\nexport class TravelIntakeAgent {\n  @Tool({\n    name: 'extractTravelProfile',\n    description: 'Extract structured travel planning information from a user request.',\n    parameters: [\n      { name: 'message', type: 'string', description: 'The raw user request', required: true },\n      { name: 'userId', type: 'string', description: 'User id when available', required: false },\n    ],\n  })\n  async extractTravelProfile(input: { message: string; userId?: string }) {\n    const destination = this.extractDestination(input.message);\n    const days = this.extractDays(input.message);\n    const budget = this.extractBudget(input.message);\n    const interests = this.extractInterests(input.message);\n    const travelStyle = this.extractTravelStyle(input.message);\n\n    return {\n      userId: input.userId ?? 'traveler-demo',\n      destination,\n      days,\n      budget,\n      interests,\n      travelStyle,\n      // ... more fields\n    };\n  }\n}\n```\n\nThe [DestinationResearchAgent] uses RAG to find destinations semantically:\n\n```\n@Agent({\n  name: 'DestinationResearchAgent',\n  description: 'Retrieves destination information from the knowledge base based on interests, budget, and season.',\n  systemPrompt: 'You are a destination research specialist. Use retrieved context only and cite source ids.',\n  enableRAG: true,\n  ragTopK: 3,\n  maxSteps: 4,\n  temperature: 0,\n})\n@Service()\nexport class DestinationResearchAgent {\n  constructor(private readonly knowledgeBase: TravelKnowledgeBaseService) {}\n\n  @Tool({\n    name: 'searchDestinations',\n    description: 'Search destinations based on interests, budget, season, and travel style.',\n    parameters: [\n      { name: 'query', type: 'string', description: 'The destination search query', required: true },\n      { name: 'topK', type: 'number', description: 'Number of destinations to retrieve', required: false },\n    ],\n  })\n  async searchDestinations(input: { query: string; topK?: number }) {\n    return this.knowledgeBase.answer(input.query, input.topK ?? 3);\n  }\n}\n```\n\nThe [ItineraryBuilderAgent] creates realistic daily itineraries:\n\n```\n@Agent({\n  name: 'ItineraryBuilderAgent',\n  description: 'Creates realistic daily itineraries with balanced activities and travel time.',\n  systemPrompt: 'You are an itinerary planning specialist. Create balanced plans with variety, rest periods, and logical routing.',\n  maxSteps: 5,\n  temperature: 0,\n})\n@Service()\nexport class ItineraryBuilderAgent {\n  @Tool({\n    name: 'createItinerary',\n    description: 'Create a day-by-day itinerary from travel constraints and interests.',\n    parameters: [\n      { name: 'destination', type: 'string', description: 'Destination city or country', required: true },\n      { name: 'days', type: 'number', description: 'Number of days to plan', required: true },\n      { name: 'budget', type: 'number', description: 'Total trip budget', required: true },\n      { name: 'interests', type: 'array', description: 'Travel interests and preferences', required: true },\n    ],\n  })\n  async createItinerary(input: {\n    destination: string;\n    days: number;\n    budget: number;\n    interests: string[];\n  }) {\n    const filteredAttractions = this.filterAttractions(input.interests);\n    const itinerary = Array.from({ length: input.days }, (_, index) => {\n      const day = index + 1;\n      const date = this.getDateForDay(day);\n      const dayActivities = this.selectActivitiesForDay(filteredAttractions, input.budget / input.days, day);\n\n      return {\n        day,\n        date,\n        activities: dayActivities.activities,\n        estimatedCost: dayActivities.estimatedCost,\n        notes: this.generateDayNotes(day, input.days, input.destination),\n      };\n    });\n\n    return {\n      destination: input.destination,\n      days: input.days,\n      budget: input.budget,\n      interests: input.interests,\n      itinerary,\n      tripSummary: this.calculateTripSummary(itinerary),\n      travelTips: this.generateTravelTips(input.destination),\n    };\n  }\n}\n```\n\nThe [LogisticsAgent] provides practical suggestions for flights, accommodations, and transportation:\n\n```\n@Agent({\n  name: 'LogisticsAgent',\n  description: 'Suggests flights, accommodations, and transportation options based on budget and travel style.',\n  systemPrompt: 'You are a logistics specialist. Provide practical suggestions for flights, hotels, and local transportation.',\n  maxSteps: 4,\n  temperature: 0,\n})\n@Service()\nexport class LogisticsAgent {\n  @Tool({\n    name: 'suggestLogistics',\n    description: 'Generate logistics suggestions for flights, accommodation, and transportation.',\n    parameters: [\n      { name: 'destination', type: 'string', description: 'Destination city or country', required: true },\n      { name: 'days', type: 'number', description: 'Number of days of travel', required: true },\n      { name: 'budget', type: 'number', description: 'Total trip budget', required: true },\n      { name: 'travelStyle', type: 'string', description: 'Travel style (budget, balanced, luxury, adventure, relaxed)', required: true },\n    ],\n  })\n  async suggestLogistics(input: {\n    destination: string;\n    days: number;\n    budget: number;\n    travelStyle: string;\n  }) {\n    const suggestions = this.generateSuggestions(input.destination, input.days, input.budget, input.travelStyle);\n\n    return {\n      destination: input.destination,\n      days: input.days,\n      budget: input.budget,\n      travelStyle: input.travelStyle,\n      suggestions,\n      totalEstimatedLogisticsCost: suggestions.reduce((sum, s) => sum + s.estimatedCost, 0),\n      bookingTimeline: this.generateBookingTimeline(input.days),\n    };\n  }\n}\n```\n\nThe [TravelAdvisorAgent] orchestrates the workflow using delegation:\n\n```\n@Agent({\n  name: 'TravelAdvisorAgent',\n  description: 'Coordinates travel intake, destination research, itinerary building, and logistics suggestions.',\n  systemPrompt: 'You are the travel advisor orchestrator. Extract constraints, retrieve destinations, build itineraries, and suggest logistics.',\n  maxSteps: 8,\n  temperature: 0,\n})\n@Service()\nexport class TravelAdvisorAgent {\n  @Delegate({\n    agent: 'TravelIntakeAgent',\n    description: 'Extract destination, dates, budget, interests, and travel style from a user request.',\n    inputField: 'input',\n  })\n  async analyzeTravelRequest(input: string): Promise<string> {\n    return '';\n  }\n\n  @Delegate({\n    agent: 'DestinationResearchAgent',\n    description: 'Retrieve destinations based on interests, budget, and season.',\n    inputField: 'input',\n  })\n  async getDestinations(input: string): Promise<string> {\n    return '';\n  }\n\n  @Delegate({\n    agent: 'ItineraryBuilderAgent',\n    description: 'Build a day-by-day itinerary from the user request.',\n    inputField: 'input',\n  })\n  async buildItinerary(input: string): Promise<string> {\n    return '';\n  }\n\n  @Delegate({\n    agent: 'LogisticsAgent',\n    description: 'Suggest logistics for flights, accommodation, and transportation.',\n    inputField: 'input',\n  })\n  async suggestLogistics(input: string): Promise<string> {\n    return '';\n  }\n}\n```\n\nWe use `MemoryVectorStore`\n\nand `RAGPipeline`\n\nfor semantic destination search:\n\n```\n@Service()\nexport class TravelKnowledgeBaseService {\n  private readonly embeddings = new LocalTravelEmbeddingProvider();\n  private readonly vectorStore = new MemoryVectorStore(this.embeddings);\n  private readonly rag = new RAGPipeline({\n    vectorStore: this.vectorStore,\n    embeddingProvider: this.embeddings,\n    topK: 3,\n  });\n\n  async answer(query: string, topK = 3) {\n    const sources = await this.rag.retrieve(query, { topK }, RetrievalStrategy.HYBRID);\n    return {\n      answer: sources.map((source) => source.content).join('\\n\\n'),\n      sources: sources.map((source) => ({\n        id: source.id,\n        score: Number(source.score.toFixed(3)),\n        country: source.metadata?.country,\n        region: source.metadata?.region,\n        bestSeason: source.metadata?.bestSeason,\n        averageDailyCost: source.metadata?.averageDailyCost,\n        tags: source.metadata?.tags,\n      })),\n    };\n  }\n}\n```\n\nThe `AgentModule`\n\nis configured with production-ready features:\n\n```\n@HazelModule({\n  imports: [\n    ConfigModule.forRoot({ envFilePath: ['.env', '.env.local'], isGlobal: true }),\n    CacheModule.forRoot({ strategy: 'memory', isGlobal: true }),\n    InspectorModule.forRoot({ inspectorBasePath: '/__hazel', developmentOnly: true }),\n    GuardrailsModule.forRoot({\n      redactPIIByDefault: true,\n      blockInjectionByDefault: true,\n      blockToxicityByDefault: true,\n    }),\n    AIModule,\n    RAGModule,\n    AgentModule.forRoot({\n      runtime: {\n        llmProvider: new TravelPlanningLocalLLMProvider(),\n        defaultMaxSteps: 8,\n        defaultTimeout: 15000,\n        enableObservability: true,\n        enableMetrics: true,\n        enableRetry: true,\n        enableCircuitBreaker: true,\n        rateLimitPerMinute: 120,\n      },\n    }),\n  ],\n  controllers: [HealthController, TravelController],\n  providers: [\n    TravelKnowledgeBaseService,\n    TravelIntakeAgent,\n    DestinationResearchAgent,\n    ItineraryBuilderAgent,\n    LogisticsAgent,\n    TravelAdvisorAgent,\n  ],\n})\nexport class AppModule {}\n# Install dependencies\nnpm install --legacy-peer-deps\n\n# Build the project\nnpm run build\n\n# Run eval tests\nnpm run eval\n\n# Start development server\nnpm run dev\n# Health check\ncurl http://localhost:3000/health\n\n# Travel intake\ncurl -s -X POST http://localhost:3000/travel/intake \\\n  -H 'content-type: application/json' \\\n  -d '{\"message\":\"Planning a 5-day trip to Tokyo in June. Budget $2000. Love food, anime, and temples.\",\"userId\":\"traveler-1\"}'\n\n# Destination research with RAG\ncurl -s -X POST http://localhost:3000/travel/destinations \\\n  -H 'content-type: application/json' \\\n  -d '{\"message\":\"Find destinations with temples and anime culture\"}'\n\n# Supervisor orchestration\ncurl -s -X POST http://localhost:3000/travel/supervisor \\\n  -H 'content-type: application/json' \\\n  -d '{\"message\":\"Planning a 5-day trip to Tokyo in June. Budget $2000. Love food, anime, and temples. Prefer walking over taxis.\",\"userId\":\"traveler-1\"}'\n```\n\nAccess the built-in inspector at `http://localhost:3000/__hazel`\n\nfor:\n\nFor a production deployment, you would:\n\nBoth projects demonstrate the same HazelJS patterns but for different domains:\n\n| Feature | Meal Planning Agent | Travel Itinerary Agent |\n|---|---|---|\n| Domain | Food & nutrition | Travel & destinations |\n| Knowledge Base | Recipe database | Destination database |\n| Output | Meal plans, shopping lists | Itineraries, logistics |\n| Similarities | Multi-agent, RAG, supervisor | Multi-agent, RAG, supervisor |\n\nThis consistency shows how HazelJS patterns scale across different use cases while maintaining code structure and best practices.\n\nThis travel itinerary planner demonstrates how HazelJS enables building sophisticated AI applications with production-ready patterns. The combination of multi-agent orchestration, RAG, and resilience features makes it easy to create reliable, observable, and scalable AI-native applications for travel planning.\n\nComplete project: [Travel Planner](https://github.com/nisafatimaa/travel-itinerary-agent)\n\nTry it out and explore how HazelJS can accelerate your AI development!", "url": "https://wpnews.pro/news/a-travel-itinerary-planner-agent-in-typescript-with-hazeljs", "canonical_source": "https://dev.to/nisa_fatima_bcd75fa085b76/a-travel-itinerary-planner-agent-in-typescript-with-hazeljs-1i6o", "published_at": "2026-06-14 17:57:56+00:00", "updated_at": "2026-06-14 18:10:59.244161+00:00", "lang": "en", "topics": ["ai-agents", "large-language-models", "natural-language-processing", "developer-tools", "generative-ai"], "entities": ["HazelJS", "TravelIntakeAgent", "DestinationResearchAgent", "ItineraryBuilderAgent", "TravelKnowledgeBaseService"], "alternates": {"html": "https://wpnews.pro/news/a-travel-itinerary-planner-agent-in-typescript-with-hazeljs", "markdown": "https://wpnews.pro/news/a-travel-itinerary-planner-agent-in-typescript-with-hazeljs.md", "text": "https://wpnews.pro/news/a-travel-itinerary-planner-agent-in-typescript-with-hazeljs.txt", "jsonld": "https://wpnews.pro/news/a-travel-itinerary-planner-agent-in-typescript-with-hazeljs.jsonld"}}