Conversation
This commit updates the test suite by adding mock memory space to the `test_add_memory` function in `test_agent_memory_system.py`, improving the test's reliability. In `test_converter.py`, mocks for `SentenceTransformer` are introduced to ensure consistent behavior during tests, and error handling is refined to provide clearer messages. Additionally, minor formatting adjustments are made in `test_redis_stm_integration.py` to enhance code readability and maintainability.
This commit improves the formatting of logging messages in `converter.py` for better readability. It also updates the import order in `core.py` to maintain consistency and clarity. Additionally, the `store_memory_vectors` method in `space.py` is modified to create a memory entry before storing it, enhancing the memory management process. Lastly, a temporary placeholder for the Redis client is added in `vector_store.py` to facilitate future adaptations.
This commit modifies the `MemorySpace` class in `space.py` to initialize the vector store with a `None` Redis client, reflecting a temporary change. In `vector_store.py`, the placeholder for the Redis client is removed. Additionally, the test suite in `test_vector_store.py` is updated to replace calls to `hset` with `hset_dict`, ensuring that the tests accurately reflect the current implementation of the Redis client interactions.
…emory management This commit removes the dependency on BaseAgent in SimpleAgent, simplifying its structure. The MemoryEnhancedAgent is updated to utilize MemorySpace for storing and retrieving states and actions, enhancing memory management. Additionally, the act method now returns actions as integers instead of ActionResult objects, streamlining the interaction with the environment. Configuration for memory management is also improved, including adjustments to memory limits and cleanup intervals.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors agent behavior and the memory system to use the new MemorySpace API with a text embedding engine, removes legacy memory hooks, and updates related tests.
- Replace BaseAgent/hooks and ActionResult with direct MemorySpace calls in
SimpleAgentandMemoryEnhancedAgent. - Switch from autoencoder embeddings to
all-MiniLM-L6-v2, updateMemoryConfig, and improveVectorStoreusage. - Update tests to use
mock_memory_space, asserthset_dict, and addSentenceTransformermocks.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_agent_memory_system.py | Inject mock_memory_space into test_add_memory |
| tests/storage/test_redis_stm_integration.py | Tweak formatting, add trailing commas, and remove TTL integration test |
| tests/embeddings/test_vector_store.py | Change assertions from hset to hset_dict |
| tests/converter/test_converter.py | Import numpy, mock SentenceTransformer, and improve exception matching |
| memory/space.py | Initialize vector_store with None and call store_memory_vectors |
| memory/embeddings/vector_store.py | Replace hset(mapping=…) with hset_dict(key, {…}) |
| memory/core.py | Reorder import of MemorySpace |
| main_demo.py | Remove hooks, refactor agents, but mis-import MemorySpace and omit AgentMemorySystem |
| converter/converter.py | Reformat logger.info call |
Comments suppressed due to low confidence (4)
main_demo.py:484
AgentMemorySystemis referenced but not imported; addfrom memory.core import AgentMemorySystemat the top.
memory_system = AgentMemorySystem.get_instance(memory_config)
tests/storage/test_redis_stm_integration.py:211
- The
test_ttl_integrationtest was removed, which drops verification of TTL behavior. Consider restoring or replacing it to ensure TTL enforcement is still tested.
def test_clear_integration(stm_store):
memory/space.py:103
- Setting
redis_client=Nonedisables Redis-backed vector indices; restore passingself.stm_store.redisso similarity search works as intended.
redis_client=None,
main_demo.py:18
- Importing
MemorySpacefrommemory.configis incorrect; it should befrom memory.space import MemorySpace.
MemorySpace,
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant refactoring and enhancements to the memory system and agent behavior in the
main_demo.pyand related files. The changes primarily focus on removing memory hooks in favor of direct API calls, improving memory storage and retrieval mechanisms, and simplifying the agent's design. Additionally, the memory system has been updated to use a text embedding engine for similarity search, replacing the previous autoencoder-based approach.Agent Refactoring and Simplification:
BaseAgentand memory hooks inSimpleAgentandMemoryEnhancedAgent. The agents now directly interact with theMemorySpaceAPI for memory operations. ([[1]](https://github.com/Dooders/AgentMemory/pull/158/files#diff-027a4c3fec037b2898f5d4c2806d4c46169c7e0614326265af8079d5e309f943L109-R125),[[2]](https://github.com/Dooders/AgentMemory/pull/158/files#diff-027a4c3fec037b2898f5d4c2806d4c46169c7e0614326265af8079d5e309f943L185-R230),[[3]](https://github.com/Dooders/AgentMemory/pull/158/files#diff-027a4c3fec037b2898f5d4c2806d4c46169c7e0614326265af8079d5e309f943L314-R319),[[4]](https://github.com/Dooders/AgentMemory/pull/158/files#diff-027a4c3fec037b2898f5d4c2806d4c46169c7e0614326265af8079d5e309f943L363-R365))actandupdate_q_valuemethods to return actions as integers and store data directly in the memory system without intermediate structures likeActionResult. ([[1]](https://github.com/Dooders/AgentMemory/pull/158/files#diff-027a4c3fec037b2898f5d4c2806d4c46169c7e0614326265af8079d5e309f943L185-R230),[[2]](https://github.com/Dooders/AgentMemory/pull/158/files#diff-027a4c3fec037b2898f5d4c2806d4c46169c7e0614326265af8079d5e309f943L385-R394),[[3]](https://github.com/Dooders/AgentMemory/pull/158/files#diff-027a4c3fec037b2898f5d4c2806d4c46169c7e0614326265af8079d5e309f943L422-R419))Transition to Direct Memory API:
AgentMemorySystemwithMemorySpacefor memory operations, including storing and retrieving states, actions, and interactions. ([[1]](https://github.com/Dooders/AgentMemory/pull/158/files#diff-027a4c3fec037b2898f5d4c2806d4c46169c7e0614326265af8079d5e309f943L264-R267),[[2]](https://github.com/Dooders/AgentMemory/pull/158/files#diff-027a4c3fec037b2898f5d4c2806d4c46169c7e0614326265af8079d5e309f943L281-R286),[[3]](https://github.com/Dooders/AgentMemory/pull/158/files#diff-027a4c3fec037b2898f5d4c2806d4c46169c7e0614326265af8079d5e309f943L363-R365),[[4]](https://github.com/Dooders/AgentMemory/pull/158/files#diff-027a4c3fec037b2898f5d4c2806d4c46169c7e0614326265af8079d5e309f943L422-R419))[[1]](https://github.com/Dooders/AgentMemory/pull/158/files#diff-027a4c3fec037b2898f5d4c2806d4c46169c7e0614326265af8079d5e309f943L297-R302),[[2]](https://github.com/Dooders/AgentMemory/pull/158/files#diff-027a4c3fec037b2898f5d4c2806d4c46169c7e0614326265af8079d5e309f943L327-R329))Memory System Enhancements:
all-MiniLM-L6-v2) for similarity search, replacing the autoencoder-based embedding approach. This simplifies the configuration and improves performance. ([[1]](https://github.com/Dooders/AgentMemory/pull/158/files#diff-027a4c3fec037b2898f5d4c2806d4c46169c7e0614326265af8079d5e309f943L520-R528),[[2]](https://github.com/Dooders/AgentMemory/pull/158/files#diff-027a4c3fec037b2898f5d4c2806d4c46169c7e0614326265af8079d5e309f943L487-R483))MemoryConfigto disable compression and enable embedding engine features. ([[1]](https://github.com/Dooders/AgentMemory/pull/158/files#diff-027a4c3fec037b2898f5d4c2806d4c46169c7e0614326265af8079d5e309f943L520-R528),[[2]](https://github.com/Dooders/AgentMemory/pull/158/files#diff-027a4c3fec037b2898f5d4c2806d4c46169c7e0614326265af8079d5e309f943L437-R433))Codebase Maintenance:
[[1]](https://github.com/Dooders/AgentMemory/pull/158/files#diff-228c3aa759730f754280b9d86104ccd989f185366b8dc92ce074fbcd2567633aL30-R31),[[2]](https://github.com/Dooders/AgentMemory/pull/158/files#diff-d715af4d9a26d06811a229c7834b5bf0a970245b0d6288af996836decdc17afdL174-R176))hset_dictfor better readability and maintainability. ([memory/embeddings/vector_store.pyL307-R309](https://github.com/Dooders/AgentMemory/pull/158/files#diff-197c99f539096b052a0d0ada1cac9a275bfebaf125a769e7039bce4a82a32cb0L307-R309))Miscellaneous:
run_experimentlogic to align with the new memory system and agent design, ensuring compatibility and improved learning rates for memory-enabled agents. ([main_demo.pyL579-R568](https://github.com/Dooders/AgentMemory/pull/158/files#diff-027a4c3fec037b2898f5d4c2806d4c46169c7e0614326265af8079d5e309f943L579-R568))