-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Condenser Interface and Defaults #5306
base: main
Are you sure you want to change the base?
Conversation
- Add abstract Condenser base class - Add NoopCondenser, RecentEventsCondenser, and LLMCondenser implementations - Add configuration system using pydantic models - Make NoopCondenser the default - Add comprehensive unit tests
- Replace const parameter with Literal type in condenser configs - Update from_config to check type field directly - Fix Event creation in LLMCondenser to use direct attribute assignment - Update memory module imports
…ndling - Move condenser_config.py from memory/ to core/config/ - Rename AgentConfig.condenser_config to condenser - Add proper handling of Pydantic models in env var loading - Add test for condenser config loading - Add example of LLM condenser config in config.toml
from openhands.core.config.llm_config import LLMConfig | ||
|
||
|
||
class CondenserConfig(BaseModel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small detail, you may want to check this bit, the other config classes are dataclasses instead of BaseModel. Some bunch of utility code works with them as dataclasses and assumes they all are, I think - stuff like ensure that their values are loaded correctly etc, e.g.
OpenHands/openhands/core/config/utils.py
Line 42 in f0ca223
for field_name, field_type in sub_config.__annotations__.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll double-check. Easy enough to change to data classes if needed!
This is exciting and beautiful ❤️ |
End-user friendly description of the problem this fixes or functionality that this introduces
Give a summary of what the PR does, explaining any non-trivial design decisions
This PR adds an abstract memory condenser interface, provides a few default condenser implementations, and updates the CodeActAgent to use the configured condenser during inference.
Condensers exist to reduce the size of the state that must be considered during an agent's
step
function. They provide acondense: list[Event] -> list[Event]
function that can perform an arbitrary transformation on thehistory
of a state before it is seen by an agent, including:LLMCondenser
),NoOpCondenser
).This does not change the underlying state, but can be used by agents as a form of attention and to manage the size of the context in long-running jobs. For an example, see the implementation in
CodeActAgent
-- the default condenser is theNoOpCondenser
, so while the agent is "using the condenser" there is no visible change unless otherwise configured. Currently, condensers must be set by manually initializing anAgentConfig
object.The intent of this PR is to lay the groundwork for an evaluation framework that will let us assess the efficacy of different condenser implementations and, if warranted, support switching between condensers with simple configuration options.
Link of any specific issues this addresses