Multi-agent Java sample with Spring AI and Azure Cosmos DB
A sample personal-shopping chatbot in Java that routes customer requests to separate product, sales and refund agents, using Spring AI, Azure OpenAI and Azure Cosmos DB for both transactional data and vector search.
This sample implements a multi-agent customer-service chatbot, inspired by OpenAI Swarm and LangGraph, using a custom orchestration layer built on Spring AI and Azure OpenAI. An orchestrator routes each request to one of three agents: a product agent that answers enquiries with retrieval-augmented generation, a sales agent that places orders, and a refund agent that manages refunds.
Azure Cosmos DB serves as both the transactional store, accessed through Spring Data, and the vector store for product search via its DiskANN index, so one database backs both operational data and RAG retrieval. Long-term chat memory is kept per user session through Spring AI's ChatMemory interface, and a plain HTML, CSS and JavaScript single-page front end talks to a Spring Boot REST API.