Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Make LLM providers pluggable via auto-configuration#69

Open
MarcosLM11 wants to merge 1 commit into
ClawRunr:mainfrom
MarcosLM11:feat/pluggable-providers
Open

Make LLM providers pluggable via auto-configuration#69
MarcosLM11 wants to merge 1 commit into
ClawRunr:mainfrom
MarcosLM11:feat/pluggable-providers

Conversation

@MarcosLM11

Copy link
Copy Markdown

Closes #17

What

Make the providers/* modules self-register from the classpath the same way
the plugins/* modules do, instead of depending on the app's component scan.

Each provider now contributes its AgentOnboardingProvider through a Spring
Boot @AutoConfiguration class listed in the module's
META-INF/spring/…AutoConfiguration.imports. The ChatModel side was already
auto-configured by the Spring AI starters, so no change was needed there.

Changes

  • anthropic: AnthropticClaudeCodeConfiguration @Configuration
    @AutoConfiguration; onboarding provider moved to a @Bean in a new
    AnthropicAgentAutoConfiguration (keeps the Claude Code token condition).
  • openai / ollama / google: drop @Component, add a small per-module
    @AutoConfiguration + .imports.
  • Remove dead AgentProvider: it was never injected or called; its
    isConfigured stub returned false and getDefaultChatModel() would have
    thrown on an empty list. Active-model selection is handled centrally by
    spring.ai.model.chat.
  • Tests: one test per provider asserting the bean registers via the
    auto-config and that the .imports file names it — currently the only guard
    for provider discovery, since OnboardingControllerTest mocks
    AgentOnboardingProviders.
  • Docs: update AGENTS.md wording.

Notes

  • No behavior change: providers are discovered exactly as before, just wired via
    auto-configuration. spring.ai.model.chat still selects the active model.
  • Ollama needs no api-key gating — like the others, its ChatModel only loads
    when spring.ai.model.chat=ollama.
  • Scope is classpath pluggability (parity with plugins). Runtime provider jars
    are intentionally left out.

Testing

./gradlew compileJava test — all modules green.

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
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.

Feature - refactor so providers are pluggable

1 participant