feat: add escalation memory cache and ingest#805
Conversation
|
Transferring review comments from @andreitava-uip on #793 that apply to escalation memory (now in this PR):
|
|
Another comment from @andreitava-uip on #793:
|
|
Another comment from @andreitava-uip on #793:
|
8c8b6b1 to
4817a5e
Compare
4938bc0 to
7bd14ea
Compare
|
|
||
| def _get_escalation_memory_settings( | ||
| resource: AgentEscalationResourceConfig, | ||
| ) -> dict[str, Any] | None: |
There was a problem hiding this comment.
this can't return a class?
| "Ingested escalation outcome into memory space '%s'", memory_space_id | ||
| ) | ||
| except Exception: | ||
| set_span_attribute("savedToMemory", False) |
There was a problem hiding this comment.
span needs to be set to error state? error message on span?
| settings=settings, | ||
| ) | ||
| ) | ||
| if not fields: |
There was a problem hiding this comment.
Throw validation error if no fields are set
| if response.results and response.results[0].answer: | ||
| cached = response.results[0].answer | ||
| _escalation_logger.info( | ||
| "Escalation memory cache hit for space '%s'", memory_space_id |
There was a problem hiding this comment.
Add customMetric for AppInsights, MemoryCacheHit, MemoryCacheMiss (matching Temporal-based execution)
Adds memory integration to the escalation tool: - Before creating HITL task: escalation_search_async() checks for cached answer - Cache hit returns cached result immediately, skipping human escalation - After human resolution: escalation_ingest_async() persists outcome - Gated by isAgentMemoryEnabled + memorySpaceId on the escalation resource - Search settings (threshold, searchMode, fieldSettings) read from resource config - Span attributes (fromMemory, savedToMemory) for trace observability Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When no fieldSettings are configured in the agent definition, field_weights should be None (search all fields with default weights) rather than raising a validation error. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This reverts commit f6751d3.
e923f4e to
8fb6534
Compare
| try: | ||
| cached_result = await retriever.aretrieve(serialized_input) | ||
| except ValueError: | ||
| raise |
There was a problem hiding this comment.
When will we have this ValueError? Should raise or swallow it?
|



Depends on #793
Summary
_check_escalation_memory_cache) before HITL task creation — cache hit skips human escalation_ingest_escalation_memory) after human resolution to persist for future recallisAgentMemoryEnabled+memorySpaceIdon the escalation resource configfromMemory,savedToMemory) for trace observabilitycompleted_by_useremail for memory ingestuserIdTest plan
tests/agent/tools/test_escalation_memory.py— 7 tests for cache check, ingest, and space ID resolutiontests/agent/tools/test_escalation_tool.py— all 37 tests passtests/agent/tools/test_ixp_escalation_tool.py— all 16 tests pass🤖 Generated with Claude Code