Problem:
The Evolving Agents Toolkit (EAT) currently uses SmartContext for transient, task-specific context. It lacks a persistent, queryable long-term memory system that allows agents (especially SystemAgent) to learn from past workflows, decisions, and outcomes. This limits their ability to build cumulative knowledge and improve planning based on historical experience. The user desires a "smart memory based on agent goals, capabilities, and previous workflow tasks," a "smart list of messages," and a "mini database that is a memory and context that has database capabilities," all implemented following EAT's philosophy where "all is an agent or a tool."
Proposed Solution:
Implement an advanced "Smart Memory" system as an ecosystem of specialized agents and tools. This system will manage persistent storage (in MongoDB) of agent experiences and contextual facts. Core agents like SystemAgent will interact with this memory ecosystem via dedicated tools to retrieve relevant historical information, build richer contexts for sub-tasks, and record new learnings.
Key New Agents and Tools:
-
MemoryManagerAgent (New Agent):
- Purpose: The central agent responsible for orchestrating the storage and retrieval of long-term memories and contextual facts. It acts as an interface to the underlying MongoDB memory collections.
- LLM: Can be a relatively simple LLM, primarily focused on understanding requests for its tools.
- Capabilities (exposed via
SmartAgentBus):
store_agent_experience: Allows other agents to submit structured data about a completed task/workflow to be stored.
retrieve_relevant_experiences: Allows agents to query for past experiences relevant to a current goal or task.
summarize_message_history: (Could be a capability) Takes a list of messages and a target goal, returns a concise summary.
- (Optional)
store_contextual_fact, retrieve_contextual_facts.
- Internal Tools (not directly exposed, used by
MemoryManagerAgent itself):
MongoExperienceStoreTool: Interacts with the eat_agent_experiences MongoDB collection (CRUD operations, embedding generation for queryable fields if not handled by direct Mongo write).
MongoFactStoreTool (Optional): Interacts with eat_contextual_facts.
SemanticExperienceSearchTool: Performs semantic searches over the eat_agent_experiences collection using embedded fields.
MessageSummarizationTool: Uses an LLM to summarize message lists.
-
ContextBuilderTool (New Tool for SystemAgent and other complex agents):
- Purpose: Dynamically constructs an optimized
SmartContext object to be passed to another agent for a specific sub-task. This tool encapsulates the logic of assembling relevant information.
- Functionality (invoked by
SystemAgent):
- Receives: target agent details, assigned sub-task/goal description, current broad workflow context (e.g.,
SystemAgent's SmartContext).
- Uses
RequestAgentTool (from SmartAgentBus tools) to call MemoryManagerAgent.retrieve_relevant_experiences with the sub-task/goal.
- Uses
RequestAgentTool to call MemoryManagerAgent.summarize_message_history (if needed) on the current long message history, tailored to the sub-task.
- Queries
SmartLibrary (using SearchComponentTool) for components relevant to the sub-task, potentially using context from retrieved experiences.
- Assembles a new, lean
SmartContext instance containing:
- The specific
current_task description for the recipient.
- Summaries of highly relevant past experiences from
MemoryManagerAgent.
- The "smart list of messages" (summarized history).
- Pointers/metadata of necessary components from
SmartLibrary.
- Returns the populated
SmartContext object (or its JSON representation).
-
ExperienceRecorderTool (New Tool for SystemAgent and other agents):
- Purpose: Facilitates the recording of completed tasks/workflows as structured experiences.
- Functionality (invoked by
SystemAgent after a significant task/workflow):
- Receives: summary of the goal, components involved, input context summary, key decisions, final outcome, output summary, and any feedback.
- Structures this data into the format expected by
MemoryManagerAgent.store_agent_experience.
- Uses
RequestAgentTool to call MemoryManagerAgent.store_agent_experience to persist the memory.
MongoDB Collections (Managed by MemoryManagerAgent's internal tools):
eat_agent_experiences: (As defined in the previous version of this issue) Stores records of completed tasks/workflows with embeddable fields for semantic search.
experience_id, primary_goal_description (embedded), sub_task_description (embedded), initiating_agent_id, involved_components, input_context_summary (embedded), key_decisions_made, final_outcome, output_summary (embedded), feedback_signals, timestamp.
- (Optional)
eat_contextual_facts: For atomic learned facts.
Workflow:
SystemAgent Planning:
- When
SystemAgent receives a new complex goal, it can use ContextBuilderTool to query for relevant past experiences related to this goal before generating a detailed plan.
- The
ContextBuilderTool internally calls MemoryManagerAgent.retrieve_relevant_experiences.
- The retrieved experiences inform
SystemAgent's decision on component selection, workflow structure, etc.
SystemAgent Task Delegation:
- When
SystemAgent delegates a sub-task to a worker agent (via SmartAgentBus.request_capability), it first uses ContextBuilderTool.
ContextBuilderTool crafts a tailored SmartContext for the worker agent, including relevant past experiences and a summarized message history related to the sub-task.
- Worker Agent Execution:
- The worker agent receives this rich, relevant
SmartContext.
SystemAgent Recording Experience:
- After a workflow (or a significant part of it) is completed,
SystemAgent uses ExperienceRecorderTool.
ExperienceRecorderTool formats the outcome and calls MemoryManagerAgent.store_agent_experience to save the learning.
Tasks:
- Define Schemas: Finalize MongoDB document structures for
eat_agent_experiences (and eat_contextual_facts if pursued).
- Implement
MemoryManagerAgent:
- Develop its internal tools (
MongoExperienceStoreTool, SemanticExperienceSearchTool, MessageSummarizationTool).
- Define its
AgentMeta and capabilities for the SmartAgentBus.
- Implement its
ReActAgent logic to handle requests for its capabilities by calling its internal tools.
- Implement
ContextBuilderTool:
- Develop the logic as described above, ensuring it interacts with
MemoryManagerAgent (via bus) and SmartLibrary.
- Implement
ExperienceRecorderTool:
- Develop logic to structure data and call
MemoryManagerAgent (via bus).
- Integrate Tools with
SystemAgent:
- Add
ContextBuilderTool and ExperienceRecorderTool to SystemAgent's available tools.
- Modify
SystemAgent's main ReAct loop:
- To use
ContextBuilderTool during planning and before delegating tasks.
- To use
ExperienceRecorderTool after completing significant tasks.
- Register
MemoryManagerAgent: Ensure MemoryManagerAgent is created and registered on the SmartAgentBus during EAT initialization.
- Testing: Create multi-step scenarios to test:
MemoryManagerAgent's ability to store and retrieve experiences.
ContextBuilderTool's effectiveness in creating relevant, lean contexts.
ExperienceRecorderTool's ability to correctly log experiences.
SystemAgent's improved planning and context passing due to the new memory ecosystem.
- Documentation: Update
ARCHITECTURE.md describing the new Smart Memory agent-tool ecosystem.
Acceptance Criteria:
MemoryManagerAgent is functional and registered on the SmartAgentBus, managing experience data in MongoDB.
ContextBuilderTool and ExperienceRecorderTool are implemented and usable by SystemAgent.
SystemAgent demonstrates use of these tools to:
- Retrieve relevant past experiences to inform its current planning.
- Construct and pass tailored
SmartContext (with summarized messages and relevant experience insights) to sub-agents.
- Record outcomes of its orchestrations into the persistent memory via
MemoryManagerAgent.
- The "smart list of messages" (summarized message history) functionality is evident in the context passed between agents.
- The "mini-database" capability (querying
eat_agent_experiences) is demonstrable through MemoryManagerAgent.retrieve_relevant_experiences.
- The entire system adheres to the "everything is an agent or a tool" philosophy for memory management.
Potential Challenges:
- Defining effective prompts and logic for
MemoryManagerAgent's internal tools (especially MessageSummarizationTool and SemanticExperienceSearchTool).
- Ensuring the
ContextBuilderTool doesn't become a bottleneck; its operations (multiple LLM calls, bus requests) need to be efficient.
- The complexity of
SystemAgent's ReAct loop increases with the integration of these new memory tools.
- Robustly defining what constitutes a "significant task" worthy of being recorded as an experience.
Problem:
The Evolving Agents Toolkit (EAT) currently uses
SmartContextfor transient, task-specific context. It lacks a persistent, queryable long-term memory system that allows agents (especiallySystemAgent) to learn from past workflows, decisions, and outcomes. This limits their ability to build cumulative knowledge and improve planning based on historical experience. The user desires a "smart memory based on agent goals, capabilities, and previous workflow tasks," a "smart list of messages," and a "mini database that is a memory and context that has database capabilities," all implemented following EAT's philosophy where "all is an agent or a tool."Proposed Solution:
Implement an advanced "Smart Memory" system as an ecosystem of specialized agents and tools. This system will manage persistent storage (in MongoDB) of agent experiences and contextual facts. Core agents like
SystemAgentwill interact with this memory ecosystem via dedicated tools to retrieve relevant historical information, build richer contexts for sub-tasks, and record new learnings.Key New Agents and Tools:
MemoryManagerAgent(New Agent):SmartAgentBus):store_agent_experience: Allows other agents to submit structured data about a completed task/workflow to be stored.retrieve_relevant_experiences: Allows agents to query for past experiences relevant to a current goal or task.summarize_message_history: (Could be a capability) Takes a list of messages and a target goal, returns a concise summary.store_contextual_fact,retrieve_contextual_facts.MemoryManagerAgentitself):MongoExperienceStoreTool: Interacts with theeat_agent_experiencesMongoDB collection (CRUD operations, embedding generation for queryable fields if not handled by direct Mongo write).MongoFactStoreTool(Optional): Interacts witheat_contextual_facts.SemanticExperienceSearchTool: Performs semantic searches over theeat_agent_experiencescollection using embedded fields.MessageSummarizationTool: Uses an LLM to summarize message lists.ContextBuilderTool(New Tool forSystemAgentand other complex agents):SmartContextobject to be passed to another agent for a specific sub-task. This tool encapsulates the logic of assembling relevant information.SystemAgent):SystemAgent'sSmartContext).RequestAgentTool(fromSmartAgentBustools) to callMemoryManagerAgent.retrieve_relevant_experienceswith the sub-task/goal.RequestAgentToolto callMemoryManagerAgent.summarize_message_history(if needed) on the current long message history, tailored to the sub-task.SmartLibrary(usingSearchComponentTool) for components relevant to the sub-task, potentially using context from retrieved experiences.SmartContextinstance containing:current_taskdescription for the recipient.MemoryManagerAgent.SmartLibrary.SmartContextobject (or its JSON representation).ExperienceRecorderTool(New Tool forSystemAgentand other agents):SystemAgentafter a significant task/workflow):MemoryManagerAgent.store_agent_experience.RequestAgentToolto callMemoryManagerAgent.store_agent_experienceto persist the memory.MongoDB Collections (Managed by
MemoryManagerAgent's internal tools):eat_agent_experiences: (As defined in the previous version of this issue) Stores records of completed tasks/workflows with embeddable fields for semantic search.experience_id,primary_goal_description(embedded),sub_task_description(embedded),initiating_agent_id,involved_components,input_context_summary(embedded),key_decisions_made,final_outcome,output_summary(embedded),feedback_signals,timestamp.eat_contextual_facts: For atomic learned facts.Workflow:
SystemAgentPlanning:SystemAgentreceives a new complex goal, it can useContextBuilderToolto query for relevant past experiences related to this goal before generating a detailed plan.ContextBuilderToolinternally callsMemoryManagerAgent.retrieve_relevant_experiences.SystemAgent's decision on component selection, workflow structure, etc.SystemAgentTask Delegation:SystemAgentdelegates a sub-task to a worker agent (viaSmartAgentBus.request_capability), it first usesContextBuilderTool.ContextBuilderToolcrafts a tailoredSmartContextfor the worker agent, including relevant past experiences and a summarized message history related to the sub-task.SmartContext.SystemAgentRecording Experience:SystemAgentusesExperienceRecorderTool.ExperienceRecorderToolformats the outcome and callsMemoryManagerAgent.store_agent_experienceto save the learning.Tasks:
eat_agent_experiences(andeat_contextual_factsif pursued).MemoryManagerAgent:MongoExperienceStoreTool,SemanticExperienceSearchTool,MessageSummarizationTool).AgentMetaand capabilities for theSmartAgentBus.ReActAgentlogic to handle requests for its capabilities by calling its internal tools.ContextBuilderTool:MemoryManagerAgent(via bus) andSmartLibrary.ExperienceRecorderTool:MemoryManagerAgent(via bus).SystemAgent:ContextBuilderToolandExperienceRecorderTooltoSystemAgent's available tools.SystemAgent's main ReAct loop:ContextBuilderToolduring planning and before delegating tasks.ExperienceRecorderToolafter completing significant tasks.MemoryManagerAgent: EnsureMemoryManagerAgentis created and registered on theSmartAgentBusduring EAT initialization.MemoryManagerAgent's ability to store and retrieve experiences.ContextBuilderTool's effectiveness in creating relevant, lean contexts.ExperienceRecorderTool's ability to correctly log experiences.SystemAgent's improved planning and context passing due to the new memory ecosystem.ARCHITECTURE.mddescribing the new Smart Memory agent-tool ecosystem.Acceptance Criteria:
MemoryManagerAgentis functional and registered on theSmartAgentBus, managing experience data in MongoDB.ContextBuilderToolandExperienceRecorderToolare implemented and usable bySystemAgent.SystemAgentdemonstrates use of these tools to:SmartContext(with summarized messages and relevant experience insights) to sub-agents.MemoryManagerAgent.eat_agent_experiences) is demonstrable throughMemoryManagerAgent.retrieve_relevant_experiences.Potential Challenges:
MemoryManagerAgent's internal tools (especiallyMessageSummarizationToolandSemanticExperienceSearchTool).ContextBuilderTooldoesn't become a bottleneck; its operations (multiple LLM calls, bus requests) need to be efficient.SystemAgent's ReAct loop increases with the integration of these new memory tools.