def custom_selector_func()

in orchestration/strategies/classic_rag_agent_strategy.py [0:0]


        def custom_selector_func(messages):
            """
            Selects the next agent based on the source of the last message.
            
            Transition Rules:
               user -> assistant
               assistant -> None (SelectorGroupChat will handle transition)
            """
            last_msg = messages[-1]
            if last_msg.source == "user":
                return "main_assistant"
            if last_msg.source == "main_assistant" and isinstance(last_msg, ToolCallSummaryMessage):
                return "main_assistant"
            if last_msg.source in ["main_assistant"]:
                return "chat_closure"                 
            return None