Skip to content

Commit 65ae681

Browse files
committed
Fix MemoryAPIClient initialization to use MemoryClientConfig
The agent-memory-client API requires a MemoryClientConfig object, not direct keyword arguments. Updated memory_client.py to: - Import MemoryClientConfig - Create config object with base_url and default_namespace - Pass config to MemoryAPIClient constructor This fixes the TypeError: MemoryAPIClient.__init__() got an unexpected keyword argument 'base_url'
1 parent 3f7ed02 commit 65ae681

File tree

1 file changed

+6
-4
lines changed
  • python-recipes/context-engineering/reference-agent/redis_context_course

1 file changed

+6
-4
lines changed

python-recipes/context-engineering/reference-agent/redis_context_course/memory_client.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from typing import List, Dict, Any, Optional
1111
from datetime import datetime
1212

13-
from agent_memory_client import MemoryAPIClient
13+
from agent_memory_client import MemoryAPIClient, MemoryClientConfig
1414
from agent_memory_client.models import (
1515
MemoryRecord,
1616
MemoryMessage,
@@ -43,12 +43,14 @@ def __init__(
4343
"""
4444
self.user_id = user_id
4545
self.namespace = namespace
46-
46+
4747
# Get base URL from environment or use default
4848
if base_url is None:
4949
base_url = os.getenv("AGENT_MEMORY_URL", "http://localhost:8000")
50-
51-
self.client = MemoryAPIClient(base_url=base_url)
50+
51+
# Create config and client
52+
config = MemoryClientConfig(base_url=base_url, default_namespace=namespace)
53+
self.client = MemoryAPIClient(config=config)
5254

5355
# ==================== Working Memory ====================
5456

0 commit comments

Comments
 (0)