Skip to content

Commit 0090a21

Browse files
mjnoviceclaude
andcommitted
fix: address PR review comments on MemoryService
- Rename _ECS_BASE to _MEMORY_SPACES_BASE for clarity - Add full docstrings (Args/Returns) to all async methods to match their sync counterparts Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d066733 commit 0090a21

1 file changed

Lines changed: 62 additions & 8 deletions

File tree

packages/uipath-platform/src/uipath/platform/memory/_memory_service.py

Lines changed: 62 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
MemorySearchResponse,
2626
)
2727

28-
_ECS_BASE = "/ecs_/v2/episodicmemories"
28+
_MEMORY_SPACES_BASE = "/ecs_/v2/episodicmemories"
2929
_LLMOPS_AGENT_BASE = "/llmopstenant_/api/Agent/memory"
3030

3131

@@ -86,7 +86,17 @@ async def create_async(
8686
is_encrypted: Optional[bool] = None,
8787
folder_key: Optional[str] = None,
8888
) -> EpisodicMemoryIndex:
89-
"""Asynchronously create a new episodic memory index."""
89+
"""Asynchronously create a new episodic memory index.
90+
91+
Args:
92+
name: The name of the memory index (max 128 chars).
93+
description: Optional description (max 1024 chars).
94+
is_encrypted: Whether the index should be encrypted.
95+
folder_key: The folder key for the operation.
96+
97+
Returns:
98+
EpisodicMemoryIndex: The created memory index.
99+
"""
90100
spec = self._create_spec(name, description, is_encrypted, folder_key)
91101
response = (
92102
await self.request_async(
@@ -137,7 +147,18 @@ async def list_async(
137147
skip: Optional[int] = None,
138148
folder_key: Optional[str] = None,
139149
) -> EpisodicMemoryListResponse:
140-
"""Asynchronously list episodic memory indexes."""
150+
"""Asynchronously list episodic memory indexes.
151+
152+
Args:
153+
filter: OData $filter expression.
154+
orderby: OData $orderby expression.
155+
top: Maximum number of results.
156+
skip: Number of results to skip.
157+
folder_key: The folder key for the operation.
158+
159+
Returns:
160+
EpisodicMemoryListResponse: The list of memory indexes.
161+
"""
141162
spec = self._list_spec(filter, orderby, top, skip, folder_key)
142163
response = (
143164
await self.request_async(
@@ -187,7 +208,19 @@ async def search_async(
187208
request: MemorySearchRequest,
188209
folder_key: Optional[str] = None,
189210
) -> MemorySearchResponse:
190-
"""Asynchronously search episodic memory via LLMOps."""
211+
"""Asynchronously search episodic memory via LLMOps.
212+
213+
Returns search results with scores and a systemPromptInjection
214+
string ready for the agent loop.
215+
216+
Args:
217+
memory_space_id: The GUID of the memory space (ECS index).
218+
request: The search request payload.
219+
folder_key: The folder key for the operation.
220+
221+
Returns:
222+
MemorySearchResponse: Results, metadata, and system prompt injection.
223+
"""
191224
spec = self._search_spec(memory_space_id, folder_key)
192225
response = (
193226
await self.request_async(
@@ -237,7 +270,19 @@ async def escalation_search_async(
237270
request: MemorySearchRequest,
238271
folder_key: Optional[str] = None,
239272
) -> EscalationMemorySearchResponse:
240-
"""Asynchronously search escalation memory."""
273+
"""Asynchronously search escalation memory for previously resolved outcomes.
274+
275+
Allows agents to recall past escalation resolutions to avoid
276+
re-escalating for similar situations.
277+
278+
Args:
279+
memory_space_id: The GUID of the memory space (ECS index).
280+
request: The search request payload (same as regular search).
281+
folder_key: The folder key for the operation.
282+
283+
Returns:
284+
EscalationMemorySearchResponse: Matched escalation outcomes.
285+
"""
241286
spec = self._escalation_search_spec(memory_space_id, folder_key)
242287
response = (
243288
await self.request_async(
@@ -281,7 +326,16 @@ async def escalation_ingest_async(
281326
request: EscalationMemoryIngestRequest,
282327
folder_key: Optional[str] = None,
283328
) -> None:
284-
"""Asynchronously ingest a resolved escalation outcome."""
329+
"""Asynchronously ingest a resolved escalation outcome into memory.
330+
331+
Persists the outcome so future agent runs can recall it
332+
without re-escalating.
333+
334+
Args:
335+
memory_space_id: The GUID of the memory space (ECS index).
336+
request: The escalation ingest payload.
337+
folder_key: The folder key for the operation.
338+
"""
285339
spec = self._escalation_ingest_spec(memory_space_id, folder_key)
286340
await self.request_async(
287341
spec.method,
@@ -334,7 +388,7 @@ def _create_spec(
334388
)
335389
return RequestSpec(
336390
method="POST",
337-
endpoint=Endpoint(f"{_ECS_BASE}/create"),
391+
endpoint=Endpoint(f"{_MEMORY_SPACES_BASE}/create"),
338392
json=body.model_dump(by_alias=True, exclude_none=True),
339393
headers={**header_folder(folder_key, None)},
340394
)
@@ -359,7 +413,7 @@ def _list_spec(
359413
params["$skip"] = skip
360414
return RequestSpec(
361415
method="GET",
362-
endpoint=Endpoint(_ECS_BASE),
416+
endpoint=Endpoint(_MEMORY_SPACES_BASE),
363417
params=params,
364418
headers={**header_folder(folder_key, None)},
365419
)

0 commit comments

Comments
 (0)