1- import logging
21import json
2+ import logging
33import os
4- from typing import Any , Dict , List , Mapping , Optional , Callable , Awaitable
4+ from typing import Any , Awaitable , Callable , Dict , List , Mapping , Optional , Union
55
66import semantic_kernel as sk
7+ from semantic_kernel .agents .azure_ai .azure_ai_agent import AzureAIAgent
78from semantic_kernel .functions import KernelFunction
8- from semantic_kernel .functions .kernel_function_decorator import kernel_function
99from semantic_kernel .functions .kernel_arguments import KernelArguments
10- from semantic_kernel .agents . azure_ai . azure_ai_agent import AzureAIAgent
10+ from semantic_kernel .functions . kernel_function_decorator import kernel_function
1111
1212# Updated imports for compatibility
1313try :
1414 # Try importing from newer structure first
15- from semantic_kernel .contents import ChatMessageContent , ChatHistory
15+ from semantic_kernel .contents import ChatHistory , ChatMessageContent
1616except ImportError :
1717 # Fall back to older structure for compatibility
1818 class ChatMessageContent :
@@ -30,7 +30,10 @@ def __init__(self):
3030 self .messages = []
3131
3232
33+ # Import the new AppConfig instance
34+ from app_config import config
3335from context .cosmos_memory_kernel import CosmosMemoryContext
36+ from event_utils import track_event_if_configured
3437from models .messages_kernel import (
3538 ActionRequest ,
3639 ActionResponse ,
@@ -39,10 +42,6 @@ def __init__(self):
3942 StepStatus ,
4043)
4144
42- # Import the new AppConfig instance
43- from app_config import config
44- from event_utils import track_event_if_configured
45-
4645# Default formatting instructions used across agents
4746DEFAULT_FORMATTING_INSTRUCTIONS = "Instructions: returning the output of this function call verbatim to the user in markdown. Then write AGENT SUMMARY: and then include a summary of what you did."
4847
@@ -77,6 +76,8 @@ def __init__(
7776 client: The client required by AzureAIAgent
7877 definition: The definition required by AzureAIAgent
7978 """
79+ # Add plugins if not already set
80+ # if not self.plugins:
8081 # If agent_type is provided, load tools from config automatically
8182 if agent_type and not tools :
8283 tools = self .get_tools_from_config (kernel , agent_type )
@@ -94,6 +95,7 @@ def __init__(
9495 super ().__init__ (
9596 kernel = kernel ,
9697 deployment_name = None , # Set as needed
98+ plugins = None , # Use the loaded plugins,
9799 endpoint = None , # Set as needed
98100 api_version = None , # Set as needed
99101 token = None , # Set as needed
@@ -120,6 +122,15 @@ def __init__(
120122 # Register the handler functions
121123 self ._register_functions ()
122124
125+ # @property
126+ # def plugins(self) -> Optional[dict[str, Callable]]:
127+ # """Get the plugins for this agent.
128+
129+ # Returns:
130+ # A list of plugins, or None if not applicable.
131+ # """
132+ # return None
133+
123134 def _default_system_message (self , agent_name = None ) -> str :
124135 name = agent_name or getattr (self , "_agent_name" , "Agent" )
125136 return f"You are an AI assistant named { name } . Help the user by providing accurate and helpful information."
@@ -202,7 +213,9 @@ async def handle_action_request(self, action_request: ActionRequest) -> str:
202213
203214 # Call the agent to handle the action
204215 async_generator = self ._agent .invoke (
205- f"{ action_request .action } \n \n Please perform this action"
216+ # messages=f"{json.dumps(self._chat_history)}\n\n
217+ messages = f"{ action_request .action } \n \n Please perform this action"
218+ # messages=action_request.action
206219 )
207220
208221 response_content = ""
@@ -477,7 +490,7 @@ def get_tools_from_config(
477490 plugin_name = f"{ agent_type } _plugin"
478491
479492 # Early return if no tools defined - prevent empty iteration
480- if not config .get ("tools" ):
493+ if not config .get ("tools" ): # or agent_type == "Product_Agent":
481494 logging .info (
482495 f"No tools defined for agent type '{ agent_type } '. Returning empty list."
483496 )
0 commit comments