Skip to content

Commit bd69e74

Browse files
authored
Merge pull request #140 from Dooders/agent-farm-converter
Agent farm converter
2 parents d4960bd + 052b7a0 commit bd69e74

File tree

7 files changed

+1817250
-76
lines changed

7 files changed

+1817250
-76
lines changed

converter/converter.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,10 @@ def from_agent_farm(db_path: str, config: Optional[Dict] = None) -> AgentMemoryS
102102
logger.info(f"Successfully imported {len(all_memories)} total memories")
103103

104104
# Create memory system configuration
105-
memory_config = MemoryConfig(
106-
use_mock_redis=True, logging_level="INFO"
107-
)
105+
memory_config = MemoryConfig(use_mock_redis=True, logging_level="INFO")
108106

109107
# Create and configure memory system
110-
memory_system = AgentMemorySystem(memory_config)
111-
108+
memory_system = AgentMemorySystem.get_instance(memory_config)
112109
# Add agents and their memories to the system
113110
for agent in imported_agents:
114111
# Add agent's memories
@@ -138,9 +135,9 @@ def from_agent_farm(db_path: str, config: Optional[Dict] = None) -> AgentMemoryS
138135

139136
# Check if all memories were imported
140137
total_memories = sum(
141-
agent.stm_store.count(str(agent.agent_id)) +
142-
agent.im_store.count(str(agent.agent_id)) +
143-
agent.ltm_store.count() # SQLiteLTMStore doesn't take agent_id
138+
agent.stm_store.count(str(agent.agent_id))
139+
+ agent.im_store.count(str(agent.agent_id))
140+
+ agent.ltm_store.count() # SQLiteLTMStore doesn't take agent_id
144141
for agent in memory_system.agents.values()
145142
)
146143
if total_memories != len(all_memories):

memory/config/memory_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def __init__(self, **kwargs):
1313
self.db = 0 # Redis DB number
1414
self.namespace = "agent-stm"
1515
self.password = None
16-
self.use_mock = False
16+
self.use_mock = True
1717
self.test_mode = False # Whether to run in test mode
1818

1919
# Update with any provided values
@@ -34,7 +34,7 @@ def __init__(self, **kwargs):
3434
self.db = 1 # Redis DB number
3535
self.namespace = "agent-im"
3636
self.password = None
37-
self.use_mock = False
37+
self.use_mock = True
3838
self.test_mode = False # Whether to run in test mode
3939

4040
# Update with any provided values
@@ -52,7 +52,7 @@ def __init__(self, **kwargs):
5252
self.compression_level = 1
5353
self.batch_size = 100
5454
self.table_prefix = "ltm"
55-
self.use_mock = False
55+
self.use_mock = True
5656

5757
# Whitelist settings
5858
self.whitelist_enabled = True

memory/utils/serialization.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,8 @@ def load_memory_system_from_json(filepath: str, use_mock_redis: bool = False):
471471

472472

473473
# Determine the tier for the memory
474-
tier = memory_copy.get("tier")
474+
metadata = memory_copy.get("metadata", {})
475+
tier = metadata.get("current_tier") or metadata.get("tier")
475476
if tier == "stm":
476477
vector_store.store_memory_vectors(memory_copy, tier="stm")
477478
memory_agent.stm_store.store(agent_id, memory_copy)

run_converter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def main():
2929
"--output",
3030
"-o",
3131
type=str,
32+
default="validation/memory_samples/agent_farm_memories.json",
3233
help="Path to save the memory system JSON file (optional)",
3334
)
3435
parser.add_argument(

tests/config/test_config_classes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_default_values(self):
2424
assert config.db == 0
2525
assert config.namespace == "agent-stm"
2626
assert config.password is None
27-
assert config.use_mock is False
27+
assert config.use_mock is True
2828

2929
def test_custom_values(self):
3030
"""Test that custom values are set correctly."""
@@ -70,7 +70,7 @@ def test_default_values(self):
7070
assert config.db == 1
7171
assert config.namespace == "agent-im"
7272
assert config.password is None
73-
assert config.use_mock is False
73+
assert config.use_mock is True
7474

7575
def test_custom_values(self):
7676
"""Test that custom values are set correctly."""
@@ -104,7 +104,7 @@ def test_default_values(self):
104104
assert config.compression_level == 1
105105
assert config.batch_size == 100
106106
assert config.table_prefix == "ltm"
107-
assert config.use_mock is False
107+
assert config.use_mock is True
108108

109109
def test_custom_values(self):
110110
"""Test that custom values are set correctly."""

0 commit comments

Comments
 (0)