def _initialize_agent_with_plugin()

in Semantic_Kernel/multi_agent/sk_multi_agent_implementation.py [0:0]


    def _initialize_agent_with_plugin(self, service_id: str, agent_name: str, instructions: str) -> Kernel:
        """
        Initialize a chat completion agent with the given service ID, agent name, and instructions.
        """
        kernel = Kernel()
        try:
            kernel.add_service(AzureChatCompletion(service_id=service_id))
            kernel.add_plugin(self.multi_agent_plugin, plugin_name="MultiAgentToolsPlugin")
            settings = kernel.get_prompt_execution_settings_from_service_id(service_id=service_id)
            settings.function_choice_behavior = FunctionChoiceBehavior.Auto()

            sk_agent = ChatCompletionAgent(
                id=service_id,
                kernel=kernel,
                name=agent_name,
                instructions=instructions
                
            )
            return sk_agent
        except Exception as e:
            raise RuntimeError(f"Error initializing agent: {e}")