Backend service for the WanderAI travel planning assistant, built with Spring Boot and Langchain4j.
- Java Development Kit (JDK) 21
- Maven 3.9.9+ or use the included Maven wrapper
- API Keys:
- TripAdvisor API key
- Google Gemini API key
- Create a
.envfile in the root directory with:
TRIPADVISOR_API_KEY=your_tripadvisor_api_key
LLM_API_KEY_GEMINI=your_gemini_api_key- The application.properties file will automatically pick up these environment variables.
Using Maven wrapper (recommended):
./mvnw clean installUsing Maven directly:
mvn clean installUsing Maven wrapper:
./mvnw spring-boot:runUsing Maven:
mvn spring-boot:runUsing JAR file:
java -jar out/artifacts/travel.jarThe server will start on http://localhost:8080
- WebSocket endpoint:
/ws-chat - Health check:
GET /health
The backend uses STOMP protocol over WebSocket for real-time communication:
- Client connect endpoint:
/ws-chat - Message publish endpoint:
/app/chat.sendMessage - Client subscription topic:
/topic/reply/{sessionId}
src/main/java/com/planner/travel/
├── agentsystem/ # AI agent implementation
│ ├── agents/ # Agent implementations
│ ├── assistant/ # Agent assistants
│ ├── state/ # State management
│ └── tools/ # Agent tools
├── config/ # Configuration classes
├── controller/ # WebSocket controllers
└── util/ # Utility classes
ChatController: Handles WebSocket connections and message routingTravelPlannerWorkflow: Manages the agent system workflowSupervisorAgent: Main decision-making agentSearchAgent: Handles location searchesDetailsAgent: Retrieves detailed information
Build the Docker image:
docker build -t wanderai-backend .Run the container:
docker run -p 8080:8080 \
-e TRIPADVISOR_API_KEY=your_key \
-e LLM_API_KEY_GEMINI=your_key \
wanderai-backendThe application includes comprehensive error handling:
- WebSocket session management
- Graceful error responses to clients