Optimize User Memories
Optimize all memories for a user with the summarize strategy. The operation combines the user’s memories into one summary. Set apply=false to preview the result without saving it. Specify a custom model as provider:model_id, for example openai:gpt-5.4-mini, anthropic:claude-sonnet-4-6, or google:gemini-3.5-flash. If omitted, Agno v2.7.4 uses MemoryManager’s default model, gpt-4o.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Database ID to use for optimization
Table to use for optimization
Body
Schema for memory optimization request
User ID to optimize memories for
Model in provider:model_id format. Current examples include openai:gpt-5.4-mini, anthropic:claude-sonnet-4-6, and google:gemini-3.5-flash. If omitted, Agno v2.7.4 uses MemoryManager's default model, gpt-4o.
If True, apply optimization changes to database. If False, return preview only without saving.
Response
Memories optimized successfully
Schema for memory optimization response
List of optimized memory objects
Number of memories before optimization
x >= 0Number of memories after optimization
x >= 0Token count before optimization
x >= 0Token count after optimization
x >= 0Number of tokens saved through optimization
x >= 0Percentage of token reduction achieved
0 <= x <= 100