@@ -169,7 +169,7 @@ async def handle_human_feedback(self, human_feedback: HumanFeedback) -> str:
169169
170170 return "Human feedback processed successfully"
171171
172- async def provide_clarification (
172+ async def handle_human_clarification (
173173 self , human_clarification : HumanClarification
174174 ) -> str :
175175 """Provide clarification on a plan.
@@ -196,7 +196,16 @@ async def provide_clarification(
196196 # Update the plan with the clarification
197197 plan .human_clarification_response = clarification_text
198198 await self ._memory_store .update_plan (plan )
199-
199+ await self ._memory_store .add_item (
200+ AgentMessage (
201+ session_id = human_clarification .session_id ,
202+ user_id = self ._user_id ,
203+ plan_id = "" ,
204+ content = f"{ human_clarification .human_clarification } " ,
205+ source = AgentType .HUMAN .value ,
206+ step_id = "" ,
207+ )
208+ )
200209 # Track the event
201210 track_event_if_configured (
202211 "Human Agent - Provided clarification for plan" ,
@@ -205,7 +214,26 @@ async def provide_clarification(
205214 "user_id" : self ._user_id ,
206215 "plan_id" : plan .id ,
207216 "clarification" : clarification_text ,
217+ "source" : AgentType .HUMAN .value ,
218+ },
219+ )
220+ await self ._memory_store .add_item (
221+ AgentMessage (
222+ session_id = session_id ,
223+ user_id = self ._user_id ,
224+ plan_id = "" ,
225+ content = "Thanks. The plan has been updated." ,
226+ source = AgentType .PLANNER .value ,
227+ step_id = "" ,
228+ )
229+ )
230+ track_event_if_configured (
231+ "Planner - Updated with HumanClarification and added into the cosmos" ,
232+ {
233+ "session_id" : session_id ,
234+ "user_id" : self ._user_id ,
235+ "content" : "Thanks. The plan has been updated." ,
236+ "source" : AgentType .PLANNER .value ,
208237 },
209238 )
210-
211239 return f"Clarification provided for plan { plan .id } "
0 commit comments