feat: add multi-model support and environment variable API keys#106
Merged
Conversation
Features: - Add separate planning_model and implementation_model for all providers - Support GOOGLE_API_KEY, ANTHROPIC_API_KEY, OPENAI_API_KEY env vars - Environment variables take precedence over mcp_agent.secrets.yaml - Add .env.example template for easy setup Refactoring: - Add shared get_api_keys() and load_api_config() in llm_utils.py - DRY up duplicated config loading code in workflow files - Use lazy imports for anthropic/openai to make them optional - Remove hardcoded brave search server, use config-based search Config changes: - Add planning_model/implementation_model options for google, anthropic, openai - Add mcp_agent.secrets.yaml to .gitignore (use .env instead) - Ignore deepcode_lab/, and logs/
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.
Description
This PR adds support for using different LLM models for planning vs code implementation phases, along with environment variable support for API keys. It also refactors duplicated code into shared utility functions.
Related Issues
Changes Made
Features
planning_modelandimplementation_modelconfig options for all providers (Google, Anthropic, OpenAI)GOOGLE_API_KEY,ANTHROPIC_API_KEY,OPENAI_API_KEYenvironment variablesmcp_agent.secrets.yamlvalues.env.exampletemplate for easy setupRefactoring
get_api_keys()andload_api_config()functions inutils/llm_utils.pyanthropicandopenaipackages to make them optional dependenciesbravesearch server references, use config-basedsearch_server_namesConfig Changes
planning_modelandimplementation_modeloptions for google, anthropic, and openai sectionsmcp_agent.secrets.yamlto.gitignore(users should use.envinstead)Checklist
Additional Notes
Breaking Changes: None. All changes are backward compatible - existing configurations continue to work.
Migration: Users can optionally:
.env.exampleto.envand add their API keys thereplanning_modelandimplementation_modelto their config if they want different models for each phaseExample config:
google:
default_model: "gemini-3-pro-preview"
planning_model: "gemini-3-pro-preview" # Used for analysis
implementation_model: "gemini-2.5-flash" # Used for code generation