Make LLM providers pluggable via auto-configuration#69
Open
MarcosLM11 wants to merge 1 commit into
Open
Conversation
Register each provider's AgentOnboardingProvider through a Spring Boot @autoConfiguration class listed in the module's AutoConfiguration.imports, mirroring the plugin modules. Providers now self-register from the classpath independently of the app's component scan, instead of relying on @component being reachable under the shared ai.javaclaw package. - anthropic: AnthropticClaudeCodeConfiguration @configuration -> @autoConfiguration; onboarding provider moved to a @bean in AnthropicAgentAutoConfiguration - openai/ollama/google: drop @component, add per-module @autoConfiguration + imports - Remove dead AgentProvider (unused; isConfigured stub returned false and getDefaultChatModel would throw). Model selection is handled centrally by spring.ai.model.chat. - Add per-provider tests asserting the bean registers and the imports file names the auto-config (the only guard for provider discovery, since OnboardingControllerTest mocks AgentOnboardingProviders) - Update AGENTS.md wording
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #17
What
Make the
providers/*modules self-register from the classpath the same waythe
plugins/*modules do, instead of depending on the app's component scan.Each provider now contributes its
AgentOnboardingProviderthrough a SpringBoot
@AutoConfigurationclass listed in the module'sMETA-INF/spring/…AutoConfiguration.imports. TheChatModelside was alreadyauto-configured by the Spring AI starters, so no change was needed there.
Changes
AnthropticClaudeCodeConfiguration@Configuration→@AutoConfiguration; onboarding provider moved to a@Beanin a newAnthropicAgentAutoConfiguration(keeps the Claude Code token condition).@Component, add a small per-module@AutoConfiguration+.imports.AgentProvider: it was never injected or called; itsisConfiguredstub returnedfalseandgetDefaultChatModel()would havethrown on an empty list. Active-model selection is handled centrally by
spring.ai.model.chat.auto-config and that the
.importsfile names it — currently the only guardfor provider discovery, since
OnboardingControllerTestmocksAgentOnboardingProviders.AGENTS.mdwording.Notes
auto-configuration.
spring.ai.model.chatstill selects the active model.ChatModelonly loadswhen
spring.ai.model.chat=ollama.are intentionally left out.
Testing
./gradlew compileJava test— all modules green.