joeyutong opened a new issue, #794:
URL: https://github.com/apache/flink-agents/issues/794

   ### Search before asking
   
   - [x] I searched in the 
[issues](https://github.com/apache/flink-agents/issues) and found nothing 
similar.
   
   ### Description
   
   The Memory documentation has several documentation and code-snippet issues 
that can mislead users or make examples fail when copied.
   
   1. Long-Term Memory context isolation is described more strongly than the 
current implementation guarantees.
   
      The docs state that each keyed partition maintains isolated memories and 
that using the same memory set name across partitions is safe. However, the 
runtime currently switches the long-term-memory context with 
`String.valueOf(key.hashCode())`, for example in `ActionTaskContextManager` and 
`PythonActionTask`. That means the documented isolation guarantee depends on 
the hash value rather than the full original key, and hash collisions could 
share the same Mem0 context.
   
      Suggested fix: either change the implementation to use a stable, 
collision-free key serialization for the LTM context, or soften the 
documentation to match the actual boundary and limitations.
   
   2. The Java Long-Term Memory complete example does not compile as written.
   
      It uses:
   
      ```java
      String userQuery = inputEvent.getInput();
      ```
   
      but `InputEvent#getInput()` returns `Object`. The example should use 
`String.valueOf(inputEvent.getInput())` or an explicit cast if the input type 
is known.
   
   3. The "Complete Example" section is not actually complete.
   
      The Python example class does not extend `Agent` and does not declare the 
chat model, embedding model, or vector store resources referenced by the 
configuration. The Java tab only shows an action method, not a complete agent 
or full resource/config wiring.
   
      Suggested fix: either rename the section to "Usage snippet" or make the 
examples genuinely runnable.
   
   4. The Java usage path for Mem0 Long-Term Memory has a runtime version 
constraint that is not documented.
   
      The runtime throws when Mem0 is configured together with Java actions and 
the Flink/Pemja version does not support the required async behavior. The 
Long-Term Memory page includes Java examples, so it should mention this 
prerequisite or limitation.
   
   5. The Java MemoryRef example in the Sensory & Short-Term Memory page casts 
`resolve(ctx)` directly to the user payload type.
   
      The example currently suggests:
   
      ```java
      processedData = (ProcessedData) myEvent.getValue().resolve(ctx);
      ```
   
      but Java `MemoryRef#resolve` returns a `MemoryObject`. The example should 
resolve the object and then read the value, for example:
   
      ```java
      processedData = (ProcessedData) 
myEvent.getValue().resolve(ctx).getValue();
      ```
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to