Skip to content

Conversation

@enyst
Copy link
Owner

@enyst enyst commented Dec 30, 2025

Mirror of upstream OpenHands#1544 for fork AI reviews.

@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 by enabling runtime switching of Large Language Models (LLMs) for agents within the system. It refines the underlying persistence mechanisms to ensure that LLM changes are correctly saved and restored across sessions, supporting both profile-based and inline LLM configurations. The changes include new API endpoints for both the SDK and the agent-server, along with updated documentation and examples, to provide a flexible and robust solution for dynamic LLM management.

Highlights

  • Runtime LLM Switching: Introduces the ability for agents to switch their primary Large Language Model (LLM) at runtime, with these changes being persisted across conversation sessions. This allows for dynamic adaptation of agent behavior without restarting the entire system.
  • Persistence Model Refinement: Updates the conversation persistence model to store LLMs either as profile_id references or as full inline payloads in base_state.json. It also ensures that inline LLMs can restore without external reconciliation by exposing secrets during snapshot writing.
  • New SDK and Agent-Server APIs: Adds new methods to the SDK (LocalConversation.switch_llm, LocalConversation.set_llm) and new API endpoints to the agent-server (POST /api/conversations/{conversation_id}/llm, POST /api/conversations/{conversation_id}/llm/switch) to facilitate LLM switching and updates.
  • Simplified Persistence Configuration: Removes the OPENHANDS_INLINE_CONVERSATIONS environment variable, streamlining the persistence logic and making LLM serialization behavior more explicit and controlled by the caller.
  • Agent Component Swapping: Adjusts the AgentBase model configuration to allow for component swapping (e.g., LLMs and tools) via cloning, improving flexibility during conversation restarts and updates.
  • Remote Client Guidance: Provides clear recommendations for remote clients (like the VS Code extension) on how to handle LLM profiles and switching, emphasizing the use of inline LLM payloads for remote updates.
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 significant and valuable feature: runtime LLM switching for agents. It's a large but well-executed change that simplifies the SDK by removing the previous complex agent reconciliation logic and the OPENHANDS_INLINE_CONVERSATIONS mechanism. The new approach to persistence and conversation restoration is more flexible and powerful. The changes are consistently applied across the SDK, agent-server, examples, and tests. The new documentation and examples are clear and helpful for understanding the new feature. I have a couple of suggestions to improve the maintainability of the new code, but overall, this is an excellent improvement.

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

enyst commented Dec 30, 2025

Addressed Gemini review: deduped agent-server LLM update wiring via helper and replaced hardcoded restore-time LLM overlay list with a module constant.

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