Skip to content

Commit 0d9ef34

Browse files
committed
Remove unnecessary comments
1 parent 592ecf0 commit 0d9ef34

File tree

6 files changed

+84
-17
lines changed

6 files changed

+84
-17
lines changed

agent_memory_server/cli.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ def schedule_task(task_path: str, args: list[str]):
215215
sys.exit(1)
216216

217217
async def setup_and_run_task():
218-
# Initialize Redis connection
219218
await get_redis_conn()
220219

221220
# Import the task function
@@ -284,8 +283,6 @@ async def _ensure_stream_and_group():
284283
raise
285284

286285
async def _run_worker():
287-
# Ensure Redis stream/consumer group exists before starting worker
288-
# Index will be created automatically when needed
289286
await _ensure_stream_and_group()
290287
await get_redis_conn()
291288
await Worker.run(

agent_memory_server/long_term_memory.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -611,9 +611,6 @@ async def compact_long_term_memories(
611611
index_name = Keys.search_index_name()
612612
logger.info(f"Using index '{index_name}' for semantic duplicate compaction.")
613613

614-
# Index will be created automatically when we add memories if it doesn't exist
615-
# No need to check or create it explicitly
616-
617614
# Get all memories using the vector store adapter
618615
try:
619616
# Convert filters to adapter format

agent_memory_server/main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ async def lifespan(app: FastAPI):
7575
)
7676

7777
# Set up Redis connection if long-term memory is enabled
78-
# The VectorStore adapter will create the index automatically when needed
7978
if settings.long_term_memory:
8079
await get_redis_conn()
8180

agent_memory_server/mcp.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,9 @@ async def call_tool(self, name, arguments):
158158
return await super().call_tool(name, arguments)
159159

160160
async def run_sse_async(self):
161-
"""Start SSE server. Index will be created automatically when needed."""
161+
"""Start SSE server."""
162162
from agent_memory_server.utils.redis import get_redis_conn
163163

164-
# Initialize Redis connection
165164
await get_redis_conn()
166165

167166
# Run the SSE server using our custom implementation
@@ -173,10 +172,9 @@ async def run_sse_async(self):
173172
).serve()
174173

175174
async def run_stdio_async(self):
176-
"""Start STDIO MCP server. Index will be created automatically when needed."""
175+
"""Start STDIO MCP server."""
177176
from agent_memory_server.utils.redis import get_redis_conn
178177

179-
# Initialize Redis connection
180178
await get_redis_conn()
181179
return await super().run_stdio_async()
182180

docker-compose-task-workers.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
services:
2+
# For testing a production-like setup, you can run this API and the
3+
# task-worker container. This API container does NOT use --no-worker, so when
4+
# it starts background work, the task-worker will process those tasks.
5+
api:
6+
build:
7+
context: .
8+
dockerfile: Dockerfile
9+
ports:
10+
- "8000:8000"
11+
environment:
12+
- REDIS_URL=redis://redis:6379
13+
- PORT=8000
14+
# Add your API keys here or use a .env file
15+
- OPENAI_API_KEY=${OPENAI_API_KEY}
16+
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
17+
# Optional configurations with defaults
18+
- LONG_TERM_MEMORY=True
19+
- GENERATION_MODEL=gpt-4o-mini
20+
- EMBEDDING_MODEL=text-embedding-3-small
21+
- ENABLE_TOPIC_EXTRACTION=True
22+
- ENABLE_NER=True
23+
depends_on:
24+
- redis
25+
volumes:
26+
- ./agent_memory_server:/app/agent_memory_server
27+
healthcheck:
28+
test: [ "CMD", "curl", "-f", "http://localhost:8000/v1/health" ]
29+
interval: 30s
30+
timeout: 10s
31+
retries: 3
32+
command: ["agent-memory", "api", "--host", "0.0.0.0", "--port", "8000"]
33+
34+
35+
mcp:
36+
build:
37+
context: .
38+
dockerfile: Dockerfile
39+
environment:
40+
- REDIS_URL=redis://redis:6379
41+
- PORT=9050
42+
# Add your API keys here or use a .env file
43+
- OPENAI_API_KEY=${OPENAI_API_KEY}
44+
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
45+
ports:
46+
- "9050:9000"
47+
depends_on:
48+
- redis
49+
command: ["agent-memory", "mcp", "--mode", "sse"]
50+
51+
task-worker:
52+
build:
53+
context: .
54+
dockerfile: Dockerfile
55+
environment:
56+
- REDIS_URL=redis://redis:6379
57+
# Add your API keys here or use a .env file
58+
- OPENAI_API_KEY=${OPENAI_API_KEY}
59+
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
60+
# Optional configurations with defaults
61+
depends_on:
62+
- redis
63+
command: ["agent-memory", "task-worker"]
64+
volumes:
65+
- ./agent_memory_server:/app/agent_memory_server
66+
restart: unless-stopped
67+
68+
redis:
69+
image: redis:8
70+
ports:
71+
- "16380:6379" # Redis port
72+
volumes:
73+
- redis_data:/data
74+
command: redis-server --save "30 1" --loglevel warning --appendonly no --stop-writes-on-bgsave-error no
75+
healthcheck:
76+
test: [ "CMD", "redis-cli", "ping" ]
77+
interval: 30s
78+
timeout: 10s
79+
retries: 3
80+
81+
volumes:
82+
redis_data:

tests/test_memory_compaction.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@ async def test_hash_deduplication_integration(
126126
# Clear all data to ensure clean test environment
127127
await async_redis_client.flushdb()
128128

129-
# Index will be created automatically when we add memories
130-
131129
# Stub merge to return first memory unchanged
132130
async def dummy_merge(memories, llm_client=None):
133131
memory = memories[0]
@@ -226,8 +224,6 @@ async def test_semantic_deduplication_integration(
226224
# Clear all data to ensure clean test environment
227225
await async_redis_client.flushdb()
228226

229-
# Index will be created automatically when we add memories
230-
231227
# Stub merge to return first memory
232228
async def dummy_merge(memories, llm_client=None):
233229
memory = memories[0]
@@ -302,8 +298,6 @@ async def test_full_compaction_integration(
302298
# Clear all data to ensure clean test environment
303299
await async_redis_client.flushdb()
304300

305-
# Index will be created automatically when we add memories
306-
307301
async def dummy_merge(memories, llm_client=None):
308302
memory = memories[0]
309303
memory.memory_hash = generate_memory_hash(memory)

0 commit comments

Comments
 (0)