Automating Research with Spring AI: Inside the DeepResearch Java RAG System

The article introduces Spring AI Alibaba DeepResearch, a Java‑based system that automates end‑to‑end research by integrating multi‑agent workflows, configurable RAG pipelines, data ingestion, observability, and dynamic report generation, and provides detailed deployment and extension guidance.

Alibaba Cloud Developer
Alibaba Cloud Developer
Alibaba Cloud Developer
Automating Research with Spring AI: Inside the DeepResearch Java RAG System

Introduction

Spring AI Alibaba DeepResearch is a Java implementation of an automated research system that covers information collection, analysis, and structured report generation.

Core Capabilities

Multi‑round reasoning chain that automatically builds analysis processes.

Java technology stack for long‑running stable scenarios.

Seamless integration with Spring Boot, Spring Cloud and other Spring components.

Observability via Langfuse for clear call‑chain tracing.

Traceable output with source references.

Overall Architecture

The system consists of a graph of nodes, each handling a specific task.

System Node Diagram
System Node Diagram

Key Nodes

CoordinatorNode

: Determines task type and directs flow. RewriteAndMultiQueryNode: Optimizes and expands user queries. BackgroundInvestigationNode: Searches the web based on topic type. PlannerNode: Breaks tasks into steps. InformationNode: Checks if retrieved content is sufficient. HumanFeedbackNode: Allows user feedback. ResearchTeamNode: Executes researcher and coder nodes in parallel. ResearcherNode: Searches knowledge bases or the web. CoderNode: Runs Python tools for data analysis. RagNode: Retrieves relevant documents for a query. ReporterNode: Aggregates node outputs into a final report.

RAG Functionality

The RAG pipeline consists of two stages: document ingestion (loading, splitting, embedding, storing in a vector store) and retrieval‑generation (query embedding, similarity search, context creation, LLM response).

Supported features include multi‑source retrieval, hybrid strategies (API, Elasticsearch, file‑based), configurable fusion using Reciprocal Rank Fusion (RRF), query expansion, translation, and post‑processing.

Configuration

Enable/disable RAG with spring.ai.alibaba.deepresearch.rag.enabled.

Choose vector store type: simple (local) or elasticsearch.

Set up ingestion paths, cron schedules, and archive directories.

Implementation Details

RAG is built on Spring AI interfaces VectorStore and RetrievalAugmentationAdvisor. Data ingestion uses TikaDocumentReader and TokenTextSplitter. The HybridRagProcessor orchestrates multiple RetrievalStrategy implementations such as ProfessionalKbApiStrategy, ProfessionalKbEsStrategy, and UserFileRetrievalStrategy, merging results with RrfFusionStrategy.

Search Tools and MCP

Background investigation and researcher nodes can call external search services (Tavily, Serp, Baidu, Alibaba Cloud AI) and optionally the JinaCrawler for link extraction. Search results are filtered using a JSON‑based whitelist/blacklist with a weight ranging from -1 to 1.

The system supports Model Context Protocol (MCP) integration via static mcp-config.json or dynamic request‑time configuration, enabling custom services for researcher and coder nodes.

Report Generation and Management

After a workflow finishes, the final conclusion is stored as a report. Reports can be exported as Markdown or PDF, viewed as interactive HTML, and managed through a RESTful API (create, retrieve, delete, export, download).

Report storage is abstracted by ReportService with two implementations: ReportRedisService (Redis backend) and ReportMemoryService (in‑memory for development). Export uses commonmark-java to convert Markdown to HTML and openhtmltopdf to generate PDFs.

Continuous Conversation

The system tracks sessionId and threadId to provide context across multiple user turns. SessionContextService retrieves recent history and injects it into LLM calls for coherent multi‑turn interactions.

Deployment Options

Two deployment methods are described:

Docker multi‑stage build that packages the frontend (Node.js, pnpm) and backend (Dragonwell JDK 17, Maven) into a runtime image with Nginx and Supervisor, using Redis and Elasticsearch as middleware.

IDE backend launch + Docker middleware + local frontend development with Vite proxy configuration.

Configuration files ( .env, application.yml) specify API keys, export paths, and service toggles.

Community and Contribution

The project is open source on GitHub (https://github.com/alibaba/spring-ai-alibaba) and welcomes PRs, issues, and feature requests. A list of contributors with their GitHub profiles is provided.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

JavaRAGspring-aiAI workflowDeepResearch
Alibaba Cloud Developer
Written by

Alibaba Cloud Developer

Alibaba's official tech channel, featuring all of its technology innovations.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.