Skip to content

Commit fc6f820

Browse files
committed
chore: add integ test for creating/updating memories with indexed keys
1 parent dd00d31 commit fc6f820

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

tests_integ/memory/test_memory_client.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import pytest
1919

2020
from bedrock_agentcore.memory import MemoryClient
21+
from bedrock_agentcore.memory.models import IndexedKey, MetadataValueType
2122

2223
from .helpers import poll_until
2324

@@ -103,6 +104,34 @@ def test_stream_delivery_create_and_update(self):
103104
)
104105
assert response["memory"]["streamDeliveryResources"] == updated_config
105106

107+
def test_indexed_keys_create_and_update(self):
108+
"""Create memory with indexed_keys, then add another via update_memory passthrough."""
109+
initial_keys = [
110+
IndexedKey.build("priority", MetadataValueType.NUMBER),
111+
IndexedKey.build("agent_type", MetadataValueType.STRING),
112+
]
113+
114+
memory = self.client.create_memory_and_wait(
115+
name=f"{self.test_prefix}_indexed",
116+
strategies=[],
117+
indexed_keys=initial_keys,
118+
)
119+
120+
memory_id = memory["id"]
121+
self.__class__.memory_ids.append(memory_id)
122+
123+
assert memory.get("indexedKeys") == initial_keys
124+
125+
added_key = IndexedKey.build("region", MetadataValueType.STRING)
126+
response = self.client.update_memory(
127+
memory_id=memory_id,
128+
client_token=str(uuid.uuid4()),
129+
add_indexed_keys=[added_key],
130+
)
131+
132+
updated_keys = response["memory"]["indexedKeys"]
133+
assert {k["key"] for k in updated_keys} == {"priority", "agent_type", "region"}
134+
106135
# --- Data Plane Tests (order 1-10) ---
107136

108137
@pytest.mark.order(1)

0 commit comments

Comments
 (0)