Skip to content

java-client: extend LongTermMemoryService to take TagFilters as params#310

Open
lygaret wants to merge 2 commits into
redis:mainfrom
lygaret:feat/java-tagfilter-searchrequest
Open

java-client: extend LongTermMemoryService to take TagFilters as params#310
lygaret wants to merge 2 commits into
redis:mainfrom
lygaret:feat/java-tagfilter-searchrequest

Conversation

@lygaret

@lygaret lygaret commented Jun 12, 2026

Copy link
Copy Markdown

currently, namespace, userId, sessionId, topics, and entities are hard coded into the LongTermMemoryService's search request as strings (for eq),or lists-of-strings (for any).

replace them with a new TagFilter class, which mirrors the filter definitions in the server and other client just encodes the query into the JSON the server

see: agent-memory-server/agent_memory_server/models.py SearchRequest
see: agent-memory-client/agent-memory-client-js/src/models.ts SearchRequestParams


Note

Medium Risk
Search filter getters now return TagFilter instead of String/List, which can break compile-time callers; runtime search behavior changes only when callers opt into new operators, with string/list paths preserved.

Overview
Adds a TagFilter model aligned with the server API (eq, ne, any, all, startswith) and wires it through long-term memory search instead of hard-coded eq / any maps in the service layer.

SearchRequest now stores user_id, session_id, namespace, topics, and entities as TagFilter values. Builders and string/list setters still accept plain String and List<String> (mapped to eq and any), and overloads accept full TagFilter instances for richer queries (e.g. userId(TagFilter.any(...)), namespace(TagFilter.startsWith(...)), topics(TagFilter.all(...))). LongTermMemoryService.searchLongTermMemories puts those objects on the JSON payload directly so Jackson emits the correct operator shapes; default namespace uses TagFilter.eq when applied.

Unit tests cover TagFilter serialization/validation and search request bodies for backward-compatible and new filter forms.

Reviewed by Cursor Bugbot for commit 4cb29ce. Bugbot is set up for automated code reviews on this repo. Configure here.

@lygaret lygaret changed the title extends LongTermMemoryService to take TagFilters as params java-client: extend LongTermMemoryService to take TagFilters as params Jun 12, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 457057f. Configure here.

@jit-ci

jit-ci Bot commented Jun 12, 2026

Copy link
Copy Markdown

Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset.

In case there are security findings, they will be communicated to you as a comment inside the PR.

Hope you’ll enjoy using Jit.

Questions? Comments? Want to learn more? Get in touch with us.

lygaret added 2 commits June 27, 2026 15:55
currently, `namespace`, `userId`, `sessionId`, `topics`, and `entities` are hard coded
into the LongTermMemoryService's search request as strings (for `eq`),or lists-of-strings (for `any`).

replace them with a new `TagFilter` class, which mirrors the filter definitions in the server and
other client just encodes the query into the JSON the server

see: agent-memory-server/agent_memory_server/models.py SearchRequest
see: agent-memory-client/agent-memory-client-js/src/models.ts SearchRequestParams
upstream will fail these requests, and the other clients perform this same validation
@lygaret lygaret force-pushed the feat/java-tagfilter-searchrequest branch from 457057f to 4cb29ce Compare June 30, 2026 05:58
@lygaret

lygaret commented Jun 30, 2026

Copy link
Copy Markdown
Author

Hello! I'm sorry I let this get stale, but I've addressed the cursor feedback, and am wondering what I'd need to do to help get this moving forward?

I'm building an agent layer on top of the java client right now, and have a handful of (backwards compatible) improvements I'm hoping to help bring upstream: this, #326, and possibly one bringing ETag based conditional write support to PUT /working-memory, but that one would be server-side, and I'm not sure how kosher that would be without discussion.

Re:

Medium Risk
Search filter getters now return TagFilter instead of String/List, which can break compile-time callers; runtime search behavior changes only when callers opt into new operators, with string/list paths preserved.

I understand the callout, and would agree this would be worth a (minor-)version bump, but imo, the java client is still pre-release versioned, and geting from a Builder seems much less of a thing than setting.

Anyway, thank you for the project!

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.

1 participant