{"id":29222775,"url":"https://github.com/anup4khandelwal/travel-planner-agent","last_synced_at":"2026-04-21T22:36:06.424Z","repository":{"id":301734361,"uuid":"1009168005","full_name":"anup4khandelwal/travel-planner-agent","owner":"anup4khandelwal","description":"Multi-agent conversational travel planner with TypeScript, LangChain, and Ollama","archived":false,"fork":false,"pushed_at":"2025-06-28T14:24:23.000Z","size":144,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-28T14:27:14.806Z","etag":null,"topics":["ai","chatbot","langchain","travel","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anup4khandelwal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-26T17:27:13.000Z","updated_at":"2025-06-28T14:24:26.000Z","dependencies_parsed_at":"2025-06-28T14:27:23.696Z","dependency_job_id":"1f1e91cf-483f-420d-aa4a-d506709d09bb","html_url":"https://github.com/anup4khandelwal/travel-planner-agent","commit_stats":null,"previous_names":["anup4khandelwal/travel-planner-agent"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/anup4khandelwal/travel-planner-agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anup4khandelwal%2Ftravel-planner-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anup4khandelwal%2Ftravel-planner-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anup4khandelwal%2Ftravel-planner-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anup4khandelwal%2Ftravel-planner-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anup4khandelwal","download_url":"https://codeload.github.com/anup4khandelwal/travel-planner-agent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anup4khandelwal%2Ftravel-planner-agent/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263256546,"owners_count":23438262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","chatbot","langchain","travel","typescript"],"created_at":"2025-07-03T04:02:13.984Z","updated_at":"2026-04-21T22:36:01.382Z","avatar_url":"https://github.com/anup4khandelwal.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Travel Planner Agent 🌍✈️🏨\n\nA multi-agent conversational travel planner built with TypeScript, LangGraph, and Gemma3. This system provides a seamless, stateful chat interface for searching and booking flights and hotels through natural language queries.\n\n## 🏗️ Architecture\n\n```mermaid\nflowchart TD\n    User[👤 User] --\u003e ClassifierAgent[🎯 Intent Classifier]\n    ClassifierAgent --\u003e DialogManager[🧠 Dialog Manager]\n    DialogManager --\u003e|slots incomplete| FollowUpAgent[❓ Follow-up Agent]\n    DialogManager --\u003e|slots complete, intent Flight| FlightSearchAgent[✈️ Flight Search Agent]\n    DialogManager --\u003e|slots complete, intent Hotel| HotelSearchAgent[🏨 Hotel Search Agent]\n    DialogManager --\u003e|intent Other| FallbackAgent[🤖 Fallback Agent]\n    FlightSearchAgent --\u003e ResponseStreamer[📡 Response Streamer]\n    HotelSearchAgent --\u003e ResponseStreamer\n    FallbackAgent --\u003e ResponseStreamer\n    ResponseStreamer --\u003e User\n    \n    subgraph \"Core Components\"\n        SessionManager[💾 Session Manager]\n        EntityExtractor[🔍 Entity Extractor]\n    end\n    \n    DialogManager \u003c--\u003e SessionManager\n    DialogManager \u003c--\u003e EntityExtractor\n```\n\n## 🚀 Features\n\n- **🎯 Intent Classification**: Automatically detects Flight, Hotel, Both, or Other intents\n- **🔍 Entity Extraction**: Extracts structured data (cities, dates, passengers) using Zod validation\n- **💬 Conversational Flow**: Maintains context and asks follow-up questions for missing information\n- **🔄 Multi-Agent Orchestration**: Uses LangGraph pattern for agent coordination\n- **📡 Real-time Streaming**: Server-Sent Events (SSE) for responsive user experience\n- **💾 Session Management**: Stateful conversations with multi-user support\n- **🛡️ Type Safety**: Full TypeScript implementation with Zod schema validation\n- **🧪 Mock Search APIs**: Realistic flight and hotel search results for testing\n\n## 🛠️ Tech Stack\n\n- **Language**: TypeScript (\u003e=4.x)\n- **Agent Framework**: LangGraph.js\n- **LLM Model**: Gemma3:latest (via Ollama)\n- **Web Framework**: Fastify\n- **Schema Validation**: Zod\n- **Runtime**: Node.js 18+\n- **Testing**: Jest + Supertest\n\n## 📋 Prerequisites\n\n1. **Node.js 18+** installed\n2. **Ollama** installed and running\n3. **Gemma3 model** pulled in Ollama\n\n### Setting up Ollama and Gemma3\n\n```bash\n# Install Ollama (macOS)\nbrew install ollama\n\n# Start Ollama service\nollama serve\n\n# Pull Gemma3 model (in another terminal)\nollama pull gemma3:latest\n```\n\n## 🚀 Quick Start\n\n### 1. Clone and Install Dependencies\n\n```bash\ncd travel-agent\nnpm install\n```\n\n### 2. Build the Project\n\n```bash\nnpm run build\n```\n\n### 3. Start Development Server\n\n```bash\nnpm run dev\n```\n\n### 4. Access the Application\n\n- **Demo Interface**: http://localhost:3000\n- **Health Check**: http://localhost:3000/health\n- **API Endpoint**: POST http://localhost:3000/api/chat\n\n## 📡 API Reference\n\n### Chat Endpoint\n\n**POST** `/api/chat`\n\nSend a message to the travel planner agent.\n\n**Request Body:**\n```json\n{\n  \"userId\": \"string\",\n  \"message\": \"string\"\n}\n```\n\n**Response:** Server-Sent Events stream\n\n**Example:**\n```bash\ncurl -X POST http://localhost:3000/api/chat \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"userId\": \"user123\", \"message\": \"Find flights from NYC to LA\"}'\n```\n\n### Session Management\n\n**GET** `/api/session/:userId` - Get session information\n**DELETE** `/api/session/:userId` - Clear user session\n\n### Health Check\n\n**GET** `/health` - Server health and active sessions count\n\n## 🎯 Usage Examples\n\n### Flight Search\n```\nUser: \"I need a flight from New York to Los Angeles\"\nAgent: \"When would you like to depart?\"\nUser: \"December 25th\"\nAgent: \"How many passengers will be traveling?\"\nUser: \"2 passengers\"\nAgent: [Returns flight search results]\n```\n\n### Hotel Search\n```\nUser: \"Book me a hotel in Paris\"\nAgent: \"When would you like to check in?\"\nUser: \"January 15th for 3 nights\"\nAgent: \"How many guests will be staying?\"\nUser: \"2 guests\"\nAgent: [Returns hotel search results]\n```\n\n### Combined Trip Planning\n```\nUser: \"Plan a trip to Tokyo with flights and hotel\"\nAgent: \"I can help you plan a complete trip! Where would you like to fly from?\"\nUser: \"San Francisco, departing March 10th, returning March 17th, for 2 people\"\nAgent: [Returns both flight and hotel results]\n```\n\n## 🧪 Testing\n\n### Run All Tests\n```bash\nnpm test\n```\n\n### Run Tests in Watch Mode\n```bash\nnpm run test:watch\n```\n\n### Test Coverage\nThe test suite covers:\n- Intent classification accuracy\n- Entity extraction validation\n- Session state management\n- API endpoint functionality\n- Error handling scenarios\n\n## 🏗️ Project Structure\n\n```\nsrc/\n├── agents/                 # AI Agents\n│   ├── intent-classifier.ts\n│   ├── entity-extractor.ts\n│   ├── search-agents.ts\n│   └── fallback-agent.ts\n├── core/                   # Core Components\n│   ├── dialog-manager.ts\n│   └── session-manager.ts\n├── types/                  # Type Definitions\n│   └── schemas.ts\n├── __tests__/             # Test Files\n│   ├── dialog-manager.test.ts\n│   └── server.test.ts\n├── server.ts              # Fastify Server\n└── index.ts               # Application Entry Point\n\npublic/\n└── index.html             # Demo Frontend\n\n```\n\n## 🔧 Configuration\n\n### Environment Variables\n\n```bash\n# Server Configuration\nPORT=3000                  # Server port (default: 3000)\nNODE_ENV=development       # Environment mode\n\n# LLM Configuration (choose one)\nLLM_PROVIDER=ollama        # Use 'ollama' for local or 'openai' for cloud\nLLM_MODEL=gemma2:2b        # Model name\n\n# Ollama Configuration (if using LLM_PROVIDER=ollama)\nOLLAMA_BASE_URL=http://localhost:11434\n\n# OpenAI Configuration (if using LLM_PROVIDER=openai)\nOPENAI_API_KEY=sk-your-key-here\n```\n\n### LLM Configuration\n\nThe system supports two LLM providers:\n\n**Local Ollama (Development)**:\n- Install and run Ollama locally\n- Pull the model: `ollama pull gemma2:2b`\n- Set `LLM_PROVIDER=ollama`\n\n**OpenAI (Production/Cloud)**:\n- Get API key from [platform.openai.com](https://platform.openai.com)\n- Set `LLM_PROVIDER=openai` and `OPENAI_API_KEY=your-key`\n- Recommended for cloud deployments\n\n## 🚀 Deployment\n\nThis application can be deployed in several ways. Choose the option that best fits your needs.\n\n### Local Production Build\n```bash\n# Build the TypeScript code\nnpm run build\n\n# Start the production server\nnpm start\n\n# Required environment variables:\n# PORT=3001 (optional, defaults to 3000)\n# OLLAMA_BASE_URL=http://localhost:11434 (required for LLM functionality)\n```\n\n### Docker Deployment\n\nThe project includes a complete Docker setup for easy deployment.\n\n#### Option 1: Using Docker Compose (Recommended)\n\n```bash\n# Start both the application and Ollama\ndocker-compose up -d\n\n# Pull the Gemma3 model in Ollama\ndocker-compose exec ollama ollama pull gemma3:latest\n\n# View logs\ndocker-compose logs -f\n\n# Stop the services\ndocker-compose down\n```\n\n#### Option 2: Using Docker Directly\n\n```bash\n# Build the Docker image\ndocker build -t travel-planner-agent .\n\n# Run the container\ndocker run -p 3001:3001 -e OLLAMA_BASE_URL=http://host.docker.internal:11434 travel-planner-agent\n```\n\n### Cloud Deployment Options\n\n\u003e 📖 **Quick Start**: See [QUICK_DEPLOY.md](./QUICK_DEPLOY.md) for step-by-step deployment instructions\n\n#### Railway (Recommended)\n\n1. Go to [railway.app](https://railway.app) and connect your GitHub repo\n2. Set environment variables:\n   ```\n   NODE_ENV=production\n   LLM_PROVIDER=openai\n   OPENAI_API_KEY=sk-your-key-here\n   LLM_MODEL=gpt-3.5-turbo\n   ```\n3. Deploy automatically from GitHub\n\n#### Vercel\n\n1. Install Vercel CLI: `npm install -g vercel`\n2. Deploy: `vercel --prod`\n3. Set environment variables via Vercel dashboard\n\n#### Render (Free Tier Available)\n\n1. Create Web Service at [render.com](https://render.com)\n2. Connect GitHub repository\n3. Build command: `npm install \u0026\u0026 npm run build`\n4. Start command: `npm start`\n5. Add environment variables in Render dashboard\n5. Add environment variables:\n   - `PORT=3001`\n   - `OLLAMA_BASE_URL=\u003cyour-ollama-endpoint\u003e`\n\n#### AWS Elastic Beanstalk Deployment\n\n1. Create a `.ebextensions` folder with configuration files\n2. Use the AWS Elastic Beanstalk CLI to deploy:\n   ```bash\n   eb init\n   eb create travel-planner-env\n   eb deploy\n   ```\n\n### Important Deployment Notes\n\n1. **Ollama Requirement**: This application requires access to an Ollama instance with the `gemma3:latest` model\n2. **Environment Variables**: Make sure to set `OLLAMA_BASE_URL` to point to your Ollama instance\n3. **Resource Requirements**: Ensure your deployment environment has sufficient resources for running LLM inference\n\n## 🔍 Monitoring\n\n### Health Check\nMonitor application health at `/health` endpoint:\n\n```json\n{\n  \"status\": \"healthy\",\n  \"timestamp\": \"2024-01-15T10:30:00.000Z\",\n  \"activeSessions\": 42\n}\n```\n\n### Performance Metrics\n- **Intent Classification**: ~200ms median response time\n- **Concurrent Sessions**: Supports 1000+ active sessions\n- **Memory Usage**: Optimized for production workloads\n\n## 🛡️ Security\n\n- **Input Validation**: All inputs validated using Zod schemas\n- **CORS Protection**: Configured for allowed origins\n- **Session Isolation**: User sessions are completely isolated\n- **No Data Persistence**: Sessions stored in memory (Redis recommended for production)\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 📝 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 🙏 Acknowledgments\n\n- Built following the Travel Planner Agent PRD specifications\n- Powered by LangGraph.js for multi-agent orchestration\n- Uses Gemma3 for natural language understanding\n- Inspired by modern conversational AI patterns\n\n---\n\n**🚀 Ready to plan your next adventure? Start the server and begin chatting!**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanup4khandelwal%2Ftravel-planner-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanup4khandelwal%2Ftravel-planner-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanup4khandelwal%2Ftravel-planner-agent/lists"}