You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: Offload base64 image data from AgentStateStore to reduce history retrieval overhead #2852
Problem
When AgentStateStore stores an ImageBlock that contains a base64-encoded image (transmitted in that format), it writes the full base64 string into stateData. This string is often very large, which significantly increases the time spent on retrieving or parsing historical messages.
Solution
Offload the base64-encoded image string to a new field or a separate table, and replace it with a placeholder in the original ImageBlock. Then, in the method that assembles historical messages for the model, add a step to restore the base64 data from the offloaded storage. This way, for routine history-reading operations, developers can choose not to query the base64 data.
Feasibility: Feasible but broad. Verified on current main: Base64Source.data (Base64Source.java:44) stores the full base64 string inline, and the entire serialization chain — Msg → AgentState → AgentStateStore.save() → JSON — writes it verbatim. No offloading or placeholder mechanism exists anywhere in the persistence path. SessionTranscriptWriter (line 344) already demonstrates the pattern of recording only block type names rather than image data.
Scope: Core changes needed in Base64Source / ImageBlock (placeholder + reference key), the state save/load path in ReActAgent and StateBackedMemory (offload before save, restore before model assembly), and potentially a new offload storage abstraction. All AgentStateStore implementations (JDBC, MongoDB, Redis, PostgreSQL, etc.) would benefit transparently if the offload happens before the store call.
Compatibility: The ImageBlock / Base64Source wire format is part of the public message model. Any placeholder scheme must round-trip correctly with existing persisted state that contains inline base64 data (backwards-compatible deserialization).
Activity
oss-maintainer commentedon Sep 14, 2026
Issue Evaluation
Category:
enhancement| Area:area/core/memory| Status: EvaluatedFeasibility: Feasible but broad. Verified on current
main:Base64Source.data(Base64Source.java:44) stores the full base64 string inline, and the entire serialization chain —Msg→AgentState→AgentStateStore.save()→ JSON — writes it verbatim. No offloading or placeholder mechanism exists anywhere in the persistence path.SessionTranscriptWriter(line 344) already demonstrates the pattern of recording only block type names rather than image data.Scope: Core changes needed in
Base64Source/ImageBlock(placeholder + reference key), the state save/load path inReActAgentandStateBackedMemory(offload before save, restore before model assembly), and potentially a new offload storage abstraction. AllAgentStateStoreimplementations (JDBC, MongoDB, Redis, PostgreSQL, etc.) would benefit transparently if the offload happens before the store call.Compatibility: The
ImageBlock/Base64Sourcewire format is part of the public message model. Any placeholder scheme must round-trip correctly with existing persisted state that contains inline base64 data (backwards-compatible deserialization).Automated evaluation by github-manager-bot