Skip to content

Conversation

@tode-rl
Copy link

@tode-rl tode-rl commented Nov 4, 2025

Add ability to switch between OpenAI and Anthropic models during a session with the /model slash command. Model choice is persisted in config.json and restored in future sessions.

Changes:

  • config.py: Add SessionState.preferred_provider field, refactor create_model() with force_provider parameter, add helper functions (_create_openai_model, _create_anthropic_model, _show_api_key_error), add load_agent_config() and save_agent_config() for persistence
  • commands.py: Add /model command handler that returns dict signal for agent recreation, change return type to str | bool | dict
  • main.py: Update simple_cli() and main() to return dict | None for special actions, add model switching loop in cli_main() that recreates agent on provider change, load config at startup and save on model switch
  • README.md: Document /model command, add Model Switching section, update Agent Storage to mention config.json, update module documentation

Model switching recreates the agent and clears conversation history while preserving memories and custom instructions.

Add ability to switch between OpenAI and Anthropic models during a session
with the /model slash command. Model choice is persisted in config.json
and restored in future sessions.

Changes:
- config.py: Add SessionState.preferred_provider field, refactor
  create_model() with force_provider parameter, add helper functions
  (_create_openai_model, _create_anthropic_model, _show_api_key_error),
  add load_agent_config() and save_agent_config() for persistence
- commands.py: Add /model command handler that returns dict signal for
  agent recreation, change return type to str | bool | dict
- main.py: Update simple_cli() and main() to return dict | None for
  special actions, add model switching loop in cli_main() that recreates
  agent on provider change, load config at startup and save on model switch
- README.md: Document /model command, add Model Switching section, update
  Agent Storage to mention config.json, update module documentation

Model switching recreates the agent and clears conversation history while
preserving memories and custom instructions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
def create_model():
def _create_openai_model():
"""Create an OpenAI model instance."""
model_name = os.environ.get("OPENAI_MODEL", "gpt-5-mini")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't want a lot of different env variables for specifying model preferences

Would DEEPAGENTS_MODEL= work?

tode-rl and others added 4 commits November 5, 2025 08:31
Add ability to switch between OpenAI and Anthropic models during a session
with the /model slash command. Model choice is persisted in config.json
and restored in future sessions.

Changes:
- config.py: Add SessionState.preferred_provider field, refactor
  create_model() with force_provider parameter, add helper functions
  (_create_openai_model, _create_anthropic_model, _show_api_key_error),
  add load_agent_config() and save_agent_config() for persistence
- commands.py: Add /model command handler that returns dict signal for
  agent recreation, change return type to str | bool | dict
- main.py: Update simple_cli() and main() to return dict | None for
  special actions, add model switching loop in cli_main() that recreates
  agent on provider change, load config at startup and save on model switch
- README.md: Document /model command, add Model Switching section, update
  Agent Storage to mention config.json, update module documentation

Model switching recreates the agent and clears conversation history while
preserving memories and custom instructions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Add ability to switch between OpenAI and Anthropic providers during a session
with the /provider slash command. Provider choice is persisted in config.json
and restored in future sessions.

Changes:
- config.py: Add SessionState.preferred_provider field, refactor
  create_model() with force_provider parameter, add helper functions
  (_create_openai_model, _create_anthropic_model, _show_api_key_error),
  add load_agent_config() and save_agent_config() for persistence.
  Hard-code specific models: gpt-5-mini for OpenAI and
  claude-sonnet-4-5-20250929 for Anthropic (no environment variable overrides)
- commands.py: Add /provider command handler that returns dict signal for
  agent recreation, change return type to str | bool | dict
- main.py: Update simple_cli() and main() to return dict | None for
  special actions, add provider switching loop in cli_main() that recreates
  agent on provider change, load config at startup and save on provider switch
- README.md: Document /provider command, add Provider Switching section, update
  Agent Storage to mention config.json, update module documentation

Provider switching recreates the agent and clears conversation history while
preserving memories and custom instructions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@tode-rl tode-rl changed the title feat: add model selection and persistence feat: add provider selection and persistence Nov 5, 2025
@tode-rl
Copy link
Author

tode-rl commented Nov 5, 2025

I thought /provider made a bit more sense, /model can come later with local configs

@tode-rl tode-rl marked this pull request as ready for review November 5, 2025 22:00
@tode-rl tode-rl requested a review from eyurtsev November 5, 2025 22:03
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.

2 participants