Skip to content

Multi-Provider Model Routing for Agents#24

Merged
Mitriyweb merged 4 commits into
mainfrom
multi-provider-routing-1032649554769087595
Jun 9, 2026
Merged

Multi-Provider Model Routing for Agents#24
Mitriyweb merged 4 commits into
mainfrom
multi-provider-routing-1032649554769087595

Conversation

@Mitriyweb

Copy link
Copy Markdown
Owner

This PR introduces a multi-provider model routing system to the agent-team project. Agents can now be configured to use different LLM providers (Claude, Gemini, Ollama, OpenAI) via their YAML frontmatter or through a central configuration file. The primary Claude provider maintains its full-featured agent loop using the Anthropic Agent SDK, while other providers use a standardized completion interface. The system includes robust resolution logic that prioritizes runtime options, then agent frontmatter, and finally central configuration defaults, with full support for stage-aware model overrides.


PR created automatically by Jules for task 1032649554769087595 started by @Mitriyweb

- Introduced pluggable provider abstraction with `ModelProvider` interface.
- Added concrete implementations for Claude, Gemini, Ollama, and OpenAI.
- Created central `lib/providers.config.ts` for default model selection.
- Refactored `runAgent` to support config-driven provider and model resolution.
- Maintained legacy support for full agent loops with the Claude provider via SDK.
- Enhanced logging to include `[provider:model]` prefix for all agent calls.
- Updated stage-aware routing to correctly fallback to frontmatter-defined stages.
- Verified all changes with comprehensive unit and E2E tests.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Mitriyweb and others added 3 commits June 7, 2026 08:07
- Introduced pluggable provider abstraction for Claude, Gemini, Ollama, and OpenAI.
- Added `lib/providers.config.ts` as the single point of configuration.
- Refactored `runAgent` to use `resolveProvider` and respect config defaults.
- Fixed stage-aware routing regression.
- Improved logging to show resolved [provider:model].
- Fixed linting issues (converted static class to functions, fixed 'any' types).
- Added `openai` to trustedPackages to satisfy CI checks.
- Comprehensive unit and E2E testing.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
- Introduced pluggable provider abstraction for Claude, Gemini, Ollama, and OpenAI.
- Added `lib/providers.config.ts` as the single point of configuration.
- Refactored `runAgent` to use `resolveProvider` and respect config defaults.
- Fixed stage-aware routing regression in `runAgent`.
- Improved logging to show resolved [provider:model].
- Converted `ProviderRegistry` class to `resolveProvider` function to satisfy linting.
- Fixed TypeScript errors when mocking `global.fetch` in tests.
- Added `openai` to trustedPackages in `package.json`.
- Verified all 98 tests pass locally with full type checking.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
- Introduced pluggable provider abstraction for Claude, Gemini, Ollama, and OpenAI.
- Added central `lib/providers.config.ts` for unified model management.
- Refactored `runAgent` to support config-driven provider and model resolution.
- Fixed stage-aware routing regression.
- Improved logging with `[provider:model]` prefix.
- Converted `ProviderRegistry` to `resolveProvider` function for better lint compliance.
- Fixed TypeScript errors in test mocks for `fetch`.
- Pinned `@google/generative-ai` and `openai` versions and added `openai` to `trustedPackages`.
- Verified all 98 tests pass locally with full type checking.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@Mitriyweb
Mitriyweb merged commit 0171873 into main Jun 9, 2026
2 checks passed
@Mitriyweb
Mitriyweb deleted the multi-provider-routing-1032649554769087595 branch June 9, 2026 04:44
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