Files
OpenHands/openhands/memory
openhands 6649be08a7 Fix circular import issue by extracting RecallType to standalone module
- Created new module openhands/events/recall_type.py with RecallType enum
- Removed RecallType from openhands/events/event.py to break circular dependency
- Updated all import statements across 13 files to use new module path
- Resolves circular import chain: sync/enrich_user_interaction_data.py ->
  integrations.github.data_collector -> ... -> openhands.events.event ->
  openhands.llm.metrics -> ... -> storage.conversation_callback ->
  openhands.events.observation.agent -> openhands.events.event (circular)

The RecallType enum now has minimal dependencies and can be imported
without triggering the heavy dependency chain that caused the circular import.

Co-authored-by: openhands <openhands@all-hands.dev>
2025-12-10 00:46:31 +00:00
..
2025-03-11 22:28:56 +00:00

Memory Component

  • Short Term History
  • Memory Condenser

Short Term History

  • Short term history filters the event stream and computes the messages that are injected into the context
  • It filters out certain events of no interest for the Agent, such as AgentChangeStateObservation or NullAction/NullObservation
  • When the context window or the token limit set by the user is exceeded, history starts condensing: chunks of messages into summaries.
  • Each summary is then injected into the context, in the place of the respective chunk it summarizes

Memory Condenser

  • Memory condenser is responsible for summarizing the chunks of events
  • It summarizes the earlier events first
  • It starts with the earliest agent actions and observations between two user messages
  • Then it does the same for later chunks of events between user messages
  • If there are no more agent events, it summarizes the user messages, this time one by one, if they're large enough and not immediately after an AgentFinishAction event (we assume those are tasks, potentially important)
  • Summaries are retrieved from the LLM as AgentSummarizeAction, and are saved in State.