@@ -80,17 +80,17 @@ def _ensure_plan_dict(content: Any) -> Dict[str, Any]:
8080@tool
8181def memory_log (
8282 action : Literal ["store_plan" , "get_plan" , "list" , "store" ],
83- content : Optional [str ] = None ,
83+ content : Optional [dict [ str , Any ] ] = None ,
8484 category : Literal ["plan" , "finding" , "reflection" , "note" ] = "note" ,
8585 metadata : Optional [str ] = "{}" ,
8686) -> str :
8787 """Memory log tool for LangGraph.
8888
8989 Args:
9090 action (Literal["store_plan", "get_plan", "list", "store"]): The action to perform.
91- content (Optional[str], optional): The content to store. Defaults to None.
91+ content (Optional[dict[ str, Any] ], optional): The content to store. Defaults to None.
9292 category (Literal["plan", "finding", "reflection", "note"], optional): The category of the content. Defaults to "note".
93- metadata (Optional[str] , optional): The metadata of the content, should be a JSON string . Defaults to "{}" .
93+ metadata (Optional[dict[ str, Any]] , optional): The metadata of the content. Defaults to {} .
9494
9595 Returns:
9696 The JSON string describing the outcome of the memory operation.
@@ -103,9 +103,8 @@ def memory_log(
103103 if action == "store_plan" :
104104 if content is None :
105105 raise ValueError ("content is required for store_plan action" )
106- plan_dict = _ensure_plan_dict (content )
107- save_plan (plan_dict , state = state , store = store )
108- return json .dumps ({"status" : "plan_stored" , "plan" : plan_dict })
106+ save_plan (content , state = state , store = store )
107+ return json .dumps ({"status" : "plan_stored" , "plan" : content })
109108
110109 if action == "get_plan" :
111110 plan_payload = load_plan (state = state , store = store )
@@ -122,7 +121,7 @@ def memory_log(
122121 entry = {
123122 "timestamp" : datetime .utcnow ().isoformat (),
124123 "category" : category ,
125- "content" : str ( content ) ,
124+ "content" : content ,
126125 "metadata" : metadata ,
127126 }
128127 stored_entry = append_memory_entry (entry , state = state , store = store )
0 commit comments