Skip to content

Conversation

@mekkiamiri
Copy link

@mekkiamiri mekkiamiri commented Dec 6, 2025

This pull requests, adds support to spring boot starter.
In addition, i added an example to show how to use the starter.
This starter integrates the Google Agent Development Kit (ADK) into Spring Boot applications.
It provides auto-configuration for :

  • BaseArtifactService and Storage
  • BaseMemoryService
  • RunConfig
  • BaseSessionService

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @mekkiamiri, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request delivers a new Spring Boot Starter for the Google Agent Development Kit (ADK), streamlining the process of building agent-powered applications within the Spring ecosystem. It encapsulates the setup of essential ADK components, offering flexible configuration options for various service implementations. The inclusion of a dedicated sample application provides a practical guide for developers to quickly adopt and utilize the starter.

Highlights

  • New Spring Boot Starter: Introduced adk-spring-boot-starter to simplify integration of the Google Agent Development Kit (ADK) with Spring Boot applications.
  • Auto-Configuration: The starter provides auto-configuration for core ADK services including Artifacts, Session, Memory, and RunConfig, making them easily injectable as Spring beans.
  • Configurable Services: ADK services can be configured via application.yaml to use different implementations, such as GcsArtifactService for artifacts and VertexAiSessionService for sessions, or default in-memory versions.
  • New Sample Application: A new sample Spring Boot application (spring-boot-adk-template) has been added to demonstrate the usage and verification of the ADK Spring Boot Starter.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new Spring Boot starter for the Google Agent Development Kit (ADK), which is a valuable addition for easier integration. The auto-configuration logic is generally well-structured. My review focuses on several critical dependency versioning issues in the pom.xml files that could lead to build failures. I've also provided suggestions to improve the auto-configuration classes by adhering more closely to Spring best practices, such as proper dependency injection and failing fast on unsupported configurations. The sample application is a helpful example, and I've included some refactoring suggestions to enhance it as a template.


<properties>
<java.version>21</java.version>
<spring-boot.version>4.0.0</spring-boot.version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The spring-boot.version is set to 4.0.0, which is not a stable Spring Boot release. Further down, spring-boot-dependencies is imported with version 3.3.0. This inconsistency can cause dependency conflicts and build issues. Please align the versions to a stable release, like 3.3.0.

Suggested change
<spring-boot.version>4.0.0</spring-boot.version>
<spring-boot.version>3.3.0</spring-boot.version>

<dependency>
<groupId>com.google.adk</groupId>
<artifactId>adk-spring-boot-starter</artifactId>
<version>0.3.0</version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The version for the adk-spring-boot-starter dependency is hardcoded to 0.3.0. The starter module in this same project has version 0.4.1-SNAPSHOT. This mismatch will likely cause build failures when building from the project root.

To ensure the sample app uses the starter built in the same project, you should align the versions. The correct version should be 0.4.1-SNAPSHOT.

Suggested change
<version>0.3.0</version>
<version>0.4.1-SNAPSHOT</version>

Comment on lines +39 to +45
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>3.3.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

A BOM (Bill of Materials) like spring-boot-dependencies should be imported in a <dependencyManagement> section, not directly in <dependencies>. This allows it to manage dependency versions without adding the BOM as a direct dependency.

Once moved, you can remove the explicit <version> tags from the other Spring Boot dependencies as they will be managed by the BOM.

Comment on lines +28 to +34
public BaseArtifactService artifactService(AdkArtifactProperties properties) {
if (properties.isGcsEnabled()) {
Storage storage = StorageOptions.getDefaultInstance().getService();
return new GcsArtifactService(properties.getBucketName(), storage);
}
return new InMemoryArtifactService();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The artifactService bean creates its own Storage instance via StorageOptions.getDefaultInstance().getService(), which ignores the googleCloudStorage bean defined above. This prevents users from customizing or mocking the Storage bean.

The artifactService bean should instead receive the Storage bean via dependency injection. Since the Storage bean is conditional, you can use an ObjectProvider to safely inject it.

    public BaseArtifactService artifactService(AdkArtifactProperties properties, org.springframework.beans.factory.ObjectProvider<Storage> storageProvider) {
        if (properties.isGcsEnabled()) {
            return new GcsArtifactService(properties.getBucketName(), storageProvider.getObject());
        }
        return new InMemoryArtifactService();
    }

Comment on lines +17 to +20
public BaseMemoryService memoryService(AdkMemoryProperties properties) {
// VertexAiMemoryService does not exist yet, defaulting to InMemory
return new InMemoryMemoryService();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

If a user configures adk.memory.type=VERTEX_AI, it is silently ignored, and the InMemoryMemoryService is created. This can be misleading.

It's better to fail fast in case of an unsupported configuration. I suggest checking the property and throwing a BeanCreationException if VERTEX_AI is selected, making the failure explicit.

    public BaseMemoryService memoryService(AdkMemoryProperties properties) {
        if (properties.getType() == com.google.adk.autoconfigure.properties.AdkMemoryProperties.Type.VERTEX_AI) {
            throw new org.springframework.beans.factory.BeanCreationException("Vertex AI memory service is not yet supported. Please use IN_MEMORY type.");
        }
        // Only InMemoryMemoryService is supported for now.
        return new InMemoryMemoryService();
    }

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>4.0.0</version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The spring-boot-starter-parent version is set to 4.0.0, which is not a stable release. It's recommended to use the latest stable version, for example 3.3.0, to ensure stability and avoid issues with pre-release software.

Suggested change
<version>4.0.0</version>
<version>3.3.0</version>

Comment on lines +24 to +32
public Runner runner(BaseArtifactService artifactService, BaseSessionService sessionService,
BaseMemoryService memoryService) {
return new Runner(
llmAgent(),
"appName",
artifactService,
sessionService,
memoryService);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There are a couple of improvements that can be made to this bean definition to follow best practices:

  1. Dependency Injection: Instead of calling the llmAgent() method directly, it's more idiomatic in Spring to declare LlmAgent as a method parameter. This makes the dependency explicit.

  2. Externalize Configuration: The appName is hardcoded to "appName". This should be externalized to a configuration file. You can inject the application name from application.yaml using @Value("${spring.application.name}").

    public Runner runner(LlmAgent llmAgent, BaseArtifactService artifactService, BaseSessionService sessionService,
                         BaseMemoryService memoryService, org.springframework.beans.factory.annotation.Value("${spring.application.name}") String appName) {
        return new Runner(
                llmAgent,
                appName,
                artifactService,
                sessionService,
                memoryService);
    }

@mekkiamiri mekkiamiri force-pushed the feat-spring-boot-starter branch from 4984c40 to 4f3123c Compare December 6, 2025 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant