This starter integrates the Google Agent Development Kit (ADK) into Spring Boot applications. It provides auto-configuration for core services like Artifacts, Session, and Memory management.
Add the following dependency to your pom.xml:
<dependency>
<groupId>com.google.adk</groupId>
<artifactId>adk-spring-boot-starter</artifactId>
<version>${adk-starter.version}</version>
</dependency>By default, the starter configures all services to use In-Memory implementations. This is great for local development and testing.
You can configure the behavior using application.yaml:
- Default:
InMemoryArtifactService - Production:
GcsArtifactService(Google Cloud Storage)
To enable GCS:
adk:
artifacts:
gcs-enabled: true
bucket-name: "my-agent-artifacts-bucket"- Default:
InMemorySessionService - Production:
VertexAiSessionService
To enable Vertex AI Sessions:
adk:
session:
type: VERTEX_AI
project-id: "my-gcp-project"
location: "us-central1"- Default:
InMemoryMemoryService
Currently, only In-Memory memory service is supported by default.
- Default Streaming Mode:
NONE
To enable streaming (e.g., SSE or BIDI):
adk:
run-config:
streaming-mode: SSE # Options: NONE, SSE, BIDINote: Other RunConfig options (like modalities, audio config) will be added in future versions.
The starter follows the Single Responsibility Principle by splitting configuration into:
AdkArtifactsAutoConfigurationAdkSessionAutoConfigurationAdkMemoryAutoConfigurationAdkRunConfigAutoConfiguration
Each has its own properties class (e.g., AdkArtifactProperties).
Simply inject the beans into your application:
@Service
public class MyAgentService {
private final Runner runner;
// Agent bean is no longer auto-configured by default.
// You must define your own Agent bean or use the Runner directly.
public MyAgentService(Runner runner) {
this.runner = runner;
}
// ... use runner
}