Skip to content

Conversation

@enyst
Copy link
Owner

@enyst enyst commented Dec 30, 2025

Mirror of OpenHands#1049 for AI review.

@coderabbitai
Copy link

coderabbitai bot commented Dec 30, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello @enyst, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant enhancement to the SDK by enabling the dynamic switching of Large Language Model (LLM) profiles during an ongoing conversation. This feature allows the agent's LLM configuration to be updated at runtime, providing greater flexibility. The changes ensure that these profile switches are correctly persisted across sessions when conversations are not inlined, and robustly prevent switching when inline persistence is active to maintain data consistency. A new example and thorough tests validate the functionality and its constraints.

Highlights

  • Runtime LLM Profile Switching: Introduced the capability to switch LLM profiles at runtime within an active conversation, allowing agents to dynamically change their underlying LLM configuration.
  • Persistence of LLM Profile Changes: Ensured that changes to the LLM profile are correctly persisted when OPENHANDS_INLINE_CONVERSATIONS is set to false, allowing conversations to be reloaded with the updated LLM.
  • Safeguards for Inline Conversations: Implemented a safeguard that prevents LLM profile switching when OPENHANDS_INLINE_CONVERSATIONS is true, as switching in this mode would break diff reconciliation and data integrity.
  • New Example and Tests: Added a new example (26_runtime_llm_switch.py) demonstrating the runtime LLM switching functionality, along with comprehensive unit tests covering successful switching, persistence, and error conditions.
  • Core SDK Enhancements: Modified AgentBase, LocalConversation, ConversationState, and LLMRegistry to support the new LLM switching mechanism, including methods for cloning agents with new LLMs and managing profile swaps.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a valuable feature for switching LLM profiles at runtime. The implementation is clean, follows good practices by separating concerns across Conversation, ConversationState, and LLMRegistry, and is thread-safe. The addition of a comprehensive example and thorough unit tests covering success and failure scenarios is commendable. I've identified one minor gap in test coverage for a specific failure case, which would further improve the robustness of this new functionality.

@enyst enyst force-pushed the agent-sdk-26-llm-switch branch from 6eb0d14 to dba84fb Compare December 30, 2025 00:31
@enyst
Copy link
Owner Author

enyst commented Dec 30, 2025

Addressed Gemini review: added missing-profile switch test (switch_llm should raise ValueError when profile_id does not exist).

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