|
This version is still in development and is not considered stable yet. For the latest stable version, please use Spring AI 2.1.0! |
What is Spring AI
Spring AI is an application framework for building AI-powered applications with Spring. It provides portable abstractions for AI models, vector stores and tools, so the code you write does not depend on one provider.
| Spring AI addresses the fundamental challenge of AI integration: connecting your enterprise data and APIs with AI models. |
Spring AI sits between your application and the models. In one direction it gives a model the context it needs: your prompts, your documents and the memory of the conversation. In the other direction it brings the work of the model into your application: answers as Java types, and calls to your own methods and services.
What You Can Build
-
Assistants and chat applications that hold a conversation, using the ChatClient and session memory.
-
Question answering over your own documents, using retrieval augmented generation and a vector store.
-
Agents that take action, by letting the model call your Java methods as tools or reach external systems through the Model Context Protocol, with approval by a person where it matters.
-
Applications that return data, not prose, by mapping model output to Java types with structured output.
-
Applications that see, hear and speak, using multimodal input and the image and audio model APIs.
Building Blocks
The following map shows the parts of Spring AI. Green parts belong to Spring AI, and blue parts are projects of the Spring AI Community. A light-blue model provider is a community-maintained integration that its provider maintains in its own repository. Select a part to go to its documentation.
The table describes the main building blocks:
| Building block | What it does |
|---|---|
A fluent API for talking to a chat model, similar in style to |
|
Portable interfaces for chat, embedding, image, audio, moderation and decision models. Chat, text-to-speech and transcription models can also stream their output. |
|
Messages and templates for the text that is sent to a model. |
|
Interceptors around a model call that add memory, retrieval, tool calling, logging and other recurring patterns. |
|
Lets the model request the execution of your |
|
Client and server support for consuming MCP servers and exposing Spring services to the AI ecosystem, for both generations of the protocol, including the 2026-07-28 revision. |
|
Keeps a conversation across requests. Session memory stores it as a log of events, compacts it when it grows, and lets the model search it. |
|
Brings your data to the model, with an ETL pipeline for ingestion and a portable vector store API with metadata filters. |
|
Maps model output to Java types. |
|
Combines these blocks into applications in which the model decides what to do next, and into workflows of several model calls. |
|
Utilities for evaluating generated content and for running models and stores locally in tests. |
|
Metrics and traces for AI operations. |
|
Retries failed model calls, and blocks unwanted input with guardrails and moderation models. |
Spring Boot auto-configuration and starters are available for the model providers, the vector stores, MCP clients and servers, and session storage. See Modules and Starters.
Requirements
Spring AI requires Java 17 or later and Spring Boot 4. Project Setup lists the supported Spring Boot versions and the dependency management.
Supported Providers
Spring AI integrates with the major model providers, including Anthropic, OpenAI, Google, Amazon Bedrock, Mistral AI and Ollama, and with a wide range of vector stores. Each integration follows the same portable API, and also exposes the provider-specific options when you need them.
Projects maintained by the community extend Spring AI, for example with ready-made agent tools and with security for MCP. They are marked "(Community)" in these docs and listed under Community-Maintained Integrations.
Where to Go Next
-
Quickstart builds a first application in a few minutes.
-
The tutorials build on it: Chat with Your Documents, Give the Model Tools, A Conversational App with Sessions and Build and Use an MCP Server.
-
AI Concepts explains the ideas behind the API.
-
Choosing a Model Provider helps you pick a model to start with.
-
Upgrading to 2.1 describes what changed since 2.0, and Upgrade Notes covers the earlier releases.