From 7a104a74fe59cfa77a307a07a1dfedd989c21a87 Mon Sep 17 00:00:00 2001 From: Ari Webb Date: Mon, 19 Jan 2026 15:27:40 -0800 Subject: [PATCH] fix: allow conversation_search time only queries [LET-7094] (#8939) fix: allow conversation_search time only queries --- letta/functions/function_sets/base.py | 8 ++++++-- letta/services/tool_executor/core_tool_executor.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/letta/functions/function_sets/base.py b/letta/functions/function_sets/base.py index 02db2c20..8b907889 100644 --- a/letta/functions/function_sets/base.py +++ b/letta/functions/function_sets/base.py @@ -85,7 +85,7 @@ def send_message(self: "Agent", message: str) -> Optional[str]: def conversation_search( self: "Agent", - query: str, + query: Optional[str] = None, roles: Optional[List[Literal["assistant", "user", "tool"]]] = None, limit: Optional[int] = None, start_date: Optional[str] = None, @@ -95,7 +95,7 @@ def conversation_search( Search prior conversation history using hybrid search (text + semantic similarity). Args: - query (str): String to search for using both text matching and semantic similarity. + query (Optional[str]): String to search for using both text matching and semantic similarity. If not provided, returns messages based on other filters (time range, roles). roles (Optional[List[Literal["assistant", "user", "tool"]]]): Optional list of message roles to filter by. limit (Optional[int]): Maximum number of results to return. Uses system default if not specified. start_date (Optional[str]): Filter results to messages created on or after this date (INCLUSIVE). When using date-only format (e.g., "2024-01-15"), includes messages starting from 00:00:00 of that day. ISO 8601 format: "YYYY-MM-DD" or "YYYY-MM-DDTHH:MM". Examples: "2024-01-15" (from start of Jan 15), "2024-01-15T14:30" (from 2:30 PM on Jan 15). @@ -123,6 +123,10 @@ def conversation_search( # Search with limit conversation_search(query="debugging", limit=10) + # Time-range only search (no query) + conversation_search(start_date="2024-01-15", end_date="2024-01-20") + # Returns all messages from Jan 15 through Jan 20 + Returns: str: Query result string containing matching messages with timestamps and content. """ diff --git a/letta/services/tool_executor/core_tool_executor.py b/letta/services/tool_executor/core_tool_executor.py index a8d0edfc..24fea8d1 100644 --- a/letta/services/tool_executor/core_tool_executor.py +++ b/letta/services/tool_executor/core_tool_executor.py @@ -83,7 +83,7 @@ class LettaCoreToolExecutor(ToolExecutor): self, agent_state: AgentState, actor: User, - query: str, + query: Optional[str] = None, roles: Optional[List[Literal["assistant", "user", "tool"]]] = None, limit: Optional[int] = None, start_date: Optional[str] = None,