Skip to content

feat(starters): add Ollama Spring Boot starter#2176

Open
Shaurya2k06 wants to merge 2 commits into
agentscope-ai:mainfrom
Shaurya2k06:ollamaspringbootstarter
Open

feat(starters): add Ollama Spring Boot starter#2176
Shaurya2k06 wants to merge 2 commits into
agentscope-ai:mainfrom
Shaurya2k06:ollamaspringbootstarter

Conversation

@Shaurya2k06

Copy link
Copy Markdown

AgentScope-Java Version

2.0.1-SNAPSHOT

Description

Adds agentscope-ollama-spring-boot-starter for Spring-managed Ollama Model auto-configuration, following the same pattern as the existing OpenAI, DashScope, Gemini, and Anthropic model starters.

Changes

New module: agentscope-ollama-spring-boot-starter

  • OllamaAutoConfiguration — creates an OllamaChatModel bean when agentscope.model.provider=ollama, with backoff when a user-defined Model bean already exists
  • OllamaProperties — binds agentscope.ollama.* (enabled, model-name, base-url)
  • OllamaChatModelBuilderCustomizer — hook for advanced builder customization
  • OllamaAutoConfigurationTest — 9 unit tests covering provider selection, property binding, disable flag, missing model name, bean backoff, generic AgentscopeAutoConfiguration integration, and customizer behavior
  • Spring registrationMETA-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

Reactor & distribution

  • Registered module in agentscope-spring-boot-starters/pom.xml
  • Added to agentscope-bom/pom.xml

Documentation (EN + ZH)

  • Updated Ollama integration guides with Spring Boot starter usage
  • Added agentscope-ollama-spring-boot-starter to model building-blocks and change-log tables
  • Removed all claims that an Ollama Spring Boot starter is unavailable

Example configuration

agentscope:
  model:
    provider: ollama
  ollama:
    enabled: true
    model-name: llama3
    # base-url: http://localhost:11434  # optional

Validation

Check Result
mvn spotless:apply on Ollama starter Pass
mvn spotless:check on Ollama starter Pass
mvn test on Ollama starter (9 tests) Pass — 9 run, 0 failures, 0 errors
JaCoCo coverage report (Ollama starter) Pass — 3 classes analyzed
.github/scripts/check-shade-and-bom-sync.sh Pass — module synced to BOM
git diff --check Pass — no whitespace/conflict issues
Stale "no Ollama starter" doc scan Pass — no remaining claims

Test command used:

mvn -pl agentscope-extensions/agentscope-spring-boot-starters/agentscope-ollama-spring-boot-starter test

Checklist

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test on Ollama starter module)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated
  • Code is ready for review

Closes

#2172

Signed-off-by: shaurya2k06 <shaurya2k06@gmail.com>
@Shaurya2k06 Shaurya2k06 requested review from a team and Copilot July 13, 2026 12:20
@CLAassistant

CLAassistant commented Jul 13, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Spring Boot starter module to auto-configure an Ollama-backed Model bean when agentscope.model.provider=ollama, aligning Ollama with the existing provider-specific starters and updating v2 documentation accordingly.

Changes:

  • Introduces agentscope-ollama-spring-boot-starter with OllamaAutoConfiguration, OllamaProperties, and OllamaChatModelBuilderCustomizer.
  • Registers the new starter in the starters aggregator POM and the AgentScope BOM for dependency management.
  • Updates EN/ZH v2 docs to document the new starter and removes “no Ollama starter” statements.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
docs/v2/zh/integration/model/ollama.md Documents Spring Boot usage for the new Ollama starter (ZH).
docs/v2/zh/docs/change-log.md Adds Ollama starter to the provider starter table (ZH).
docs/v2/zh/docs/building-blocks/model.md Adds Ollama starter/customizer to Spring Boot guidance and tables (ZH).
docs/v2/en/integration/model/ollama.md Documents Spring Boot usage for the new Ollama starter (EN).
docs/v2/en/docs/change-log.md Adds Ollama starter to the provider starter table (EN).
docs/v2/en/docs/building-blocks/model.md Adds Ollama starter/customizer to Spring Boot guidance and tables (EN).
agentscope-extensions/agentscope-spring-boot-starters/pom.xml Registers the new starter module in the starters reactor build.
agentscope-extensions/agentscope-spring-boot-starters/agentscope-ollama-spring-boot-starter/src/test/java/io/agentscope/spring/boot/ollama/OllamaAutoConfigurationTest.java Adds Spring Boot auto-config unit tests for the Ollama starter.
agentscope-extensions/agentscope-spring-boot-starters/agentscope-ollama-spring-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports Registers OllamaAutoConfiguration for Boot auto-configuration import.
agentscope-extensions/agentscope-spring-boot-starters/agentscope-ollama-spring-boot-starter/src/main/java/io/agentscope/spring/boot/ollama/OllamaProperties.java Adds agentscope.ollama.* configuration properties binding.
agentscope-extensions/agentscope-spring-boot-starters/agentscope-ollama-spring-boot-starter/src/main/java/io/agentscope/spring/boot/ollama/OllamaChatModelBuilderCustomizer.java Adds a hook interface for customizing the OllamaChatModel.Builder.
agentscope-extensions/agentscope-spring-boot-starters/agentscope-ollama-spring-boot-starter/src/main/java/io/agentscope/spring/boot/ollama/OllamaAutoConfiguration.java Adds conditional auto-configuration to create an OllamaChatModel bean.
agentscope-extensions/agentscope-spring-boot-starters/agentscope-ollama-spring-boot-starter/pom.xml Defines the new starter artifact and its dependencies.
agentscope-distribution/agentscope-bom/pom.xml Adds the new starter to the BOM for version alignment.

Comment on lines +43 to +47
/**
* Ollama model name, for example {@code llama3}.
*/
private String modelName = "llama3";

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Keeping the default to match other provider starters (OpenAI/Anthropic/Gemini/DashScope). Blank model-name still fails via trimToNull.

}

@Test
void shouldBindSupportedOllamaProperties() {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Matches sibling starter tests, which also set base-url but only assert modelName. Leaving as is for consistency.

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…me test

Rename the blank model-name failure test to match behavior with the default, and assert OllamaProperties getters so enabled/base-url binding is covered.

Signed-off-by: shaurya2k06 <shaurya2k06@gmail.com>
@Shaurya2k06

Copy link
Copy Markdown
Author

Hey @jujn , could I get a review for this? Let me know if there are issues needed to be fixed.

@jujn

jujn commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Hey @jujn , could I get a review for this? Let me know if there are issues needed to be fixed.

Thanks for your contribution! I expect to see it tomorrow.

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.

4 participants