Skip to content

feat: add Agent Episodic Memory support (recall node)#793

Merged
mjnovice merged 1 commit intomainfrom
feat/memory-loop-integration-scaffold
Apr 24, 2026
Merged

feat: add Agent Episodic Memory support (recall node)#793
mjnovice merged 1 commit intomainfrom
feat/memory-loop-integration-scaffold

Conversation

@mjnovice
Copy link
Copy Markdown
Contributor

@mjnovice mjnovice commented Apr 21, 2026

Summary

  • Memory recall graph node: When MemoryConfig is passed to create_agent(), a MEMORY_RECALL node is inserted before INIT that queries the UiPath Memory service and stores the systemPromptInjection in graph state. The INIT node reads it and appends to the system prompt.
  • New types: MemoryConfig, AgentGraphNode.MEMORY_RECALL, InnerAgentGraphState.memory_injection
  • Dependency: bumps uipath-platform >= 0.1.31 for MemoryService types (depends on feat: scaffold MemoryService for Agent Episodic Memory (URT migration) uipath-python#1467)

Note: Escalation memory is not included in this PR. Only episodic memory recall is being changed.

Graph with memory enabled

START → MEMORY_RECALL → INIT → AGENT ↔ TOOLS → TERMINATE → END

Files changed

  • types.pyMemoryConfig dataclass, memory_injection field on inner state, MEMORY_RECALL node enum
  • memory_node.py — New: memory recall graph node
  • agent.pycreate_agent() accepts optional memory parameter
  • init_node.py — Reads memory_injection from state and appends to system prompt
  • __init__.py — Exports MemoryConfig

Relationship with UiPath/uipath-agents-python#374

This PR and UiPath/uipath-agents-python#374 together implement the full Agent Episodic Memory feature across both repos:

Concern This PR (uipath-langchain-python) UiPath/uipath-agents-python#374
Memory recall graph node Implements MEMORY_RECALL node, MemoryConfig, and INIT-node injection Resolves MemoryConfig from agent definition (isAgentMemoryEnabled + memorySpaceId) and passes it to create_agent()
Memory module memory_node.py — builds MemorySearchRequest, calls sdk.memory.search_async() memory.py — contains build_memory_search_request() and retrieve_memory_injection() helpers (to be replaced by the graph node from this PR)
Factory wiring Exposes MemoryConfig for callers to pass _get_memory_config() extracts memory settings from AgentDefinition and constructs MemoryConfig

Merge order: This PR should merge first (or concurrently with UiPath/uipath-python#1467). Then UiPath/uipath-agents-python#374 can be updated to:

  1. Remove the runtime-level _populate_memory_context() mutable-dict approach
  2. Instead, pass MemoryConfig to create_agent(memory=...) in graph.py
  3. Remove memory_context threading through the message factory

Both PRs depend on UiPath/uipath-python#1467 (uipath-platform >= 0.1.31) for the MemoryService types.

Test plan

E2E flow tested with https://github.com/UiPath/Agents/pull/5082/changes enabled
image

Ingestion
image

🤖 Generated with Claude Code

@mjnovice mjnovice force-pushed the feat/memory-loop-integration-scaffold branch from 18f228e to 44fd7e2 Compare April 21, 2026 23:56
Comment thread src/uipath_langchain/agent/tools/escalation_tool.py Outdated
Comment thread src/uipath_langchain/agent/tools/escalation_tool.py Outdated
Comment thread src/uipath_langchain/agent/tools/escalation_tool.py Outdated
Comment thread src/uipath_langchain/agent/tools/escalation_tool.py Outdated
Comment thread src/uipath_langchain/agent/tools/escalation_tool.py Outdated
Comment thread src/uipath_langchain/agent/react/types.py
Comment thread src/uipath_langchain/agent/react/memory_node.py Outdated
Comment thread src/uipath_langchain/agent/tools/escalation_tool.py Outdated
Comment thread src/uipath_langchain/agent/react/types.py
Comment thread src/uipath_langchain/agent/tools/escalation_tool.py Outdated
Comment thread src/uipath_langchain/agent/tools/escalation_tool.py
@mjnovice mjnovice requested a review from swathiJayav April 22, 2026 21:55
@mjnovice mjnovice force-pushed the feat/memory-loop-integration-scaffold branch from 3729ad9 to ce6a8ea Compare April 22, 2026 22:00
Comment thread src/uipath_langchain/agent/tools/escalation_tool.py Outdated
@mjnovice mjnovice requested a review from swathiJayav April 23, 2026 00:09
Comment thread src/uipath_langchain/agent/tools/escalation_tool.py Outdated
Comment thread src/uipath_langchain/agent/tools/escalation_tool.py Outdated
Comment thread src/uipath_langchain/agent/tools/escalation_tool.py Outdated
Comment thread src/uipath_langchain/agent/react/memory_node.py
Comment thread src/uipath_langchain/agent/react/init_node.py
Comment thread src/uipath_langchain/agent/react/memory_node.py Outdated
Comment thread src/uipath_langchain/agent/react/memory_node.py Outdated
Comment thread src/uipath_langchain/agent/react/memory_node.py Outdated
Comment thread src/uipath_langchain/agent/tools/escalation_tool.py Outdated
Comment thread tests/agent/tools/test_escalation_memory.py Outdated
Comment thread src/uipath_langchain/_utils/_otel.py Outdated
Comment thread src/uipath_langchain/agent/react/_memory_tracing.py Outdated
@mjnovice mjnovice changed the title feat: add Agent Episodic Memory support (recall node + escalation memory) feat: add Agent Episodic Memory support (recall node) Apr 24, 2026
@mjnovice mjnovice force-pushed the feat/memory-loop-integration-scaffold branch 2 times, most recently from efd5466 to 2d14753 Compare April 24, 2026 02:31
Comment thread src/uipath_langchain/agent/react/memory_node.py Outdated
Comment thread src/uipath_langchain/agent/react/memory_node.py Outdated
Comment thread src/uipath_langchain/agent/react/memory_node.py
Comment thread tests/agent/react/test_memory_node.py Outdated
Comment thread tests/agent/react/test_memory_node.py Outdated
Comment thread tests/agent/react/test_memory_node.py Outdated
Comment thread tests/agent/react/test_memory_node.py Outdated
@mjnovice mjnovice force-pushed the feat/memory-loop-integration-scaffold branch from 2d14753 to 8c8b6b1 Compare April 24, 2026 06:38
- Add MemoryConfig with field_weights, threshold, result_count,
  folder_path, memory_space_name
- Add memory_recall node that queries UiPath Memory service before INIT
- Emit OTel trace spans (Find previous memories, Apply dynamic few shot)
- Extract OTel helpers to _utils/_otel.py for reuse across tools
- Prefix key_path with field type (agent-input) matching backend
- Add definition_system_prompt to memory search request
- Filter empty string values in _build_search_fields

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mjnovice mjnovice force-pushed the feat/memory-loop-integration-scaffold branch from 8c8b6b1 to 4817a5e Compare April 24, 2026 06:42
@mjnovice mjnovice requested a review from andreitava-uip April 24, 2026 06:45
@mjnovice mjnovice merged commit 0e9d1a7 into main Apr 24, 2026
45 checks passed
@mjnovice mjnovice deleted the feat/memory-loop-integration-scaffold branch April 24, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants