@@ -329,18 +329,19 @@ async def human_clarification_endpoint(
329329 )
330330 raise HTTPException (status_code = 400 , detail = "no user" )
331331
332- # Get the agents for this session
333- agents = await get_agents (human_clarification .session_id , user_id )
334-
335- # Send the clarification to the planner agent
336- planner_agent = agents [AgentType .PLANNER .value ]
332+ kernel , memory_store = await initialize_runtime_and_context (
333+ human_clarification .session_id , user_id
334+ )
335+ agents = await AgentFactory .create_all_agents (
336+ session_id = human_clarification .session_id , user_id = user_id
337+ )
337338
338- # Convert clarification to JSON for proper processing
339- human_clarification_json = human_clarification . json ()
339+ # Send the feedback to the human agent
340+ human_agent = agents [ AgentType . HUMAN . value ]
340341
341- # Use the planner to handle the clarification
342- await planner_agent .handle_human_clarification (
343- KernelArguments ( human_clarification_json = human_clarification_json )
342+ # Use the human agent to handle the feedback
343+ await human_agent .handle_human_clarification (
344+ human_clarification = human_clarification
344345 )
345346
346347 track_event_if_configured (
@@ -523,7 +524,9 @@ async def get_plans(
523524 raise HTTPException (status_code = 400 , detail = "no user" )
524525
525526 # Initialize memory context
526- memory_store = CosmosMemoryContext (session_id or "" , user_id )
527+ kernel , memory_store = await initialize_runtime_and_context (
528+ session_id or "" , user_id
529+ )
527530
528531 if session_id :
529532 plan = await memory_store .get_plan_by_session (session_id = session_id )
@@ -615,7 +618,7 @@ async def get_steps_by_plan(plan_id: str, request: Request) -> List[Step]:
615618 raise HTTPException (status_code = 400 , detail = "no user" )
616619
617620 # Initialize memory context
618- memory_store = CosmosMemoryContext ("" , user_id )
621+ kernel , memory_store = await initialize_runtime_and_context ("" , user_id )
619622 steps = await memory_store .get_steps_for_plan (plan_id = plan_id )
620623 return steps
621624
@@ -681,7 +684,9 @@ async def get_agent_messages(session_id: str, request: Request) -> List[AgentMes
681684 raise HTTPException (status_code = 400 , detail = "no user" )
682685
683686 # Initialize memory context
684- memory_store = CosmosMemoryContext (session_id , user_id )
687+ kernel , memory_store = await initialize_runtime_and_context (
688+ session_id or "" , user_id
689+ )
685690 agent_messages = await memory_store .get_data_by_type ("agent_message" )
686691 return agent_messages
687692
@@ -712,7 +717,7 @@ async def delete_all_messages(request: Request) -> Dict[str, str]:
712717 raise HTTPException (status_code = 400 , detail = "no user" )
713718
714719 # Initialize memory context
715- memory_store = CosmosMemoryContext ( session_id = "" , user_id = user_id )
720+ kernel , memory_store = await initialize_runtime_and_context ( "" , user_id )
716721
717722 logging .info ("Deleting all plans" )
718723 await memory_store .delete_all_items ("plan" )
@@ -773,7 +778,7 @@ async def get_all_messages(request: Request):
773778 raise HTTPException (status_code = 400 , detail = "no user" )
774779
775780 # Initialize memory context
776- memory_store = CosmosMemoryContext ( session_id = "" , user_id = user_id )
781+ kernel , memory_store = await initialize_runtime_and_context ( "" , user_id )
777782 message_list = await memory_store .get_all_items ()
778783 return message_list
779784
0 commit comments