Skip to content

Commit 9e46c46

Browse files
committed
add load functions from class
1 parent 3faaaa4 commit 9e46c46

File tree

7 files changed

+66
-44
lines changed

7 files changed

+66
-44
lines changed

src/backend/kernel_agents/generic_agent.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from kernel_agents.agent_base import BaseAgent
88
from context.cosmos_memory_kernel import CosmosMemoryContext
99
from models.messages_kernel import AgentType
10+
from src.backend.kernel_tools.generic_tools import GenericTools
1011

1112

1213
class GenericAgent(BaseAgent):
@@ -41,9 +42,12 @@ def __init__(
4142
"""
4243
# Load configuration if tools not provided
4344
if tools is None:
44-
# Load the generic tools configuration
45+
# Get tools directly from GenericTools class
46+
tools_dict = GenericTools.get_all_kernel_functions()
47+
tools = [KernelFunction.from_method(func) for func in tools_dict.values()]
48+
49+
# Load the generic tools configuration for system message
4550
config = self.load_tools_config("generic", config_path)
46-
tools = self.get_tools_from_config(kernel, "generic", config_path)
4751

4852
# Use system message from config if not explicitly provided
4953
if not system_message:

src/backend/kernel_agents/hr_agent.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
from kernel_agents.agent_base import BaseAgent
77
from context.cosmos_memory_kernel import CosmosMemoryContext
88
from models.messages_kernel import AgentType
9+
from src.backend.kernel_tools.hr_tools import HrTools
910

1011

1112
class HrAgent(BaseAgent):
1213
"""HR agent implementation using Semantic Kernel.
1314
1415
This agent provides HR-related functions such as onboarding, benefits management,
15-
and employee administration. All tools are loaded from hr_tools.json.
16+
and employee administration.
1617
"""
1718

1819
def __init__(
@@ -44,9 +45,12 @@ def __init__(
4445
"""
4546
# Load configuration if tools not provided
4647
if tools is None:
47-
# Load the HR tools configuration
48+
# Get tools directly from HrTools class
49+
tools_dict = HrTools.get_all_kernel_functions()
50+
tools = [KernelFunction.from_method(func) for func in tools_dict.values()]
51+
52+
# Load the HR tools configuration for system message
4853
config = self.load_tools_config("hr", config_path)
49-
tools = self.get_tools_from_config(kernel, "hr", config_path)
5054

5155
# Use system message from config if not explicitly provided
5256
if not system_message:

src/backend/kernel_agents/human_agent.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
ActionRequest,
1919
)
2020
from event_utils import track_event_if_configured
21+
from src.backend.kernel_tools.human_tools import HumanTools
2122

2223

2324
class HumanAgent(BaseAgent):
2425
"""Human agent implementation using Semantic Kernel.
2526
26-
This agent represents a human user in the system, receiving and processing
27-
feedback from humans and passing it to other agents for further action.
27+
This agent specializes in representing and assisting humans in the multi-agent system.
2828
"""
2929

3030
def __init__(
@@ -56,13 +56,23 @@ def __init__(
5656
"""
5757
# Load configuration if tools not provided
5858
if tools is None:
59+
# Get tools directly from HumanTools class
60+
tools_dict = HumanTools.get_all_kernel_functions()
61+
tools = [KernelFunction.from_method(func) for func in tools_dict.values()]
62+
63+
# Load the human tools configuration for system message
5964
config = self.load_tools_config("human", config_path)
60-
tools = self.get_tools_from_config(kernel, "human", config_path)
65+
66+
# Use system message from config if not explicitly provided
6167
if not system_message:
6268
system_message = config.get(
6369
"system_message",
64-
"You are representing a human user in the conversation. You handle interactions that require human feedback or input.",
70+
"You are an AI Agent. You represent a human employee in our organization. "
71+
"You can perform day-to-day activities and collaborate with other functional agents. "
72+
"When someone asks you to complete a task, summarize what was done.",
6573
)
74+
75+
# Use agent name from config if available
6676
agent_name = AgentType.HUMAN.value
6777

6878
super().__init__(

src/backend/kernel_agents/marketing_agent.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
from typing import List, Optional
22

33
import semantic_kernel as sk
4-
from context.cosmos_memory_kernel import CosmosMemoryContext
4+
from semantic_kernel.functions import KernelFunction
5+
56
from kernel_agents.agent_base import BaseAgent
6-
from src.backend.kernel_tools.marketing_tools import MarketingTools
7+
from context.cosmos_memory_kernel import CosmosMemoryContext
78
from models.messages_kernel import AgentType
8-
from semantic_kernel.functions import KernelFunction
9+
from src.backend.kernel_tools.marketing_tools import MarketingTools
910

1011

1112
class MarketingAgent(BaseAgent):
1213
"""Marketing agent implementation using Semantic Kernel.
1314
14-
This agent specializes in marketing strategies, campaign development,
15-
content creation, and market analysis. It can create effective marketing
16-
campaigns, analyze market trends, develop promotional content, and more.
17-
All tools are loaded from marketing_tools.json.
15+
This agent specializes in marketing, campaign management, and analyzing market data.
1816
"""
1917

2018
def __init__(
@@ -46,9 +44,12 @@ def __init__(
4644
"""
4745
# Load configuration if tools not provided
4846
if tools is None:
49-
# Load the marketing tools configuration
47+
# Get tools directly from MarketingTools class
48+
tools_dict = MarketingTools.get_all_kernel_functions()
49+
tools = [KernelFunction.from_method(func) for func in tools_dict.values()]
50+
51+
# Load the marketing tools configuration for system message
5052
config = self.load_tools_config("marketing", config_path)
51-
tools = self.get_tools(kernel, "marketing", config_path)
5253

5354
# Use system message from config if not explicitly provided
5455
if not system_message:
@@ -71,8 +72,3 @@ def __init__(
7172
client=client,
7273
definition=definition,
7374
)
74-
75-
# @property
76-
# def plugins(self):
77-
# """Get the plugins for the syntax checker agent."""
78-
# return ["marketing_functions", MarketingTools()]

src/backend/kernel_agents/procurement_agent.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
from typing import List, Optional
22

33
import semantic_kernel as sk
4-
from context.cosmos_memory_kernel import CosmosMemoryContext
4+
from semantic_kernel.functions import KernelFunction
5+
56
from kernel_agents.agent_base import BaseAgent
7+
from context.cosmos_memory_kernel import CosmosMemoryContext
68
from models.messages_kernel import AgentType
7-
from semantic_kernel.functions import KernelFunction
9+
from src.backend.kernel_tools.procurement_tools import ProcurementTools
810

911

1012
class ProcurementAgent(BaseAgent):
1113
"""Procurement agent implementation using Semantic Kernel.
1214
13-
This agent specializes in purchasing, vendor management, supply chain operations,
14-
and inventory control. It can create purchase orders, manage vendors, track orders,
15-
and ensure efficient procurement processes.
15+
This agent specializes in procurement, purchasing, vendor management, and inventory tasks.
1616
"""
1717

1818
def __init__(
@@ -44,9 +44,12 @@ def __init__(
4444
"""
4545
# Load configuration if tools not provided
4646
if tools is None:
47-
# Load the procurement tools configuration
47+
# Get tools directly from ProcurementTools class
48+
tools_dict = ProcurementTools.get_all_kernel_functions()
49+
tools = [KernelFunction.from_method(func) for func in tools_dict.values()]
50+
51+
# Load the procurement tools configuration for system message
4852
config = self.load_tools_config("procurement", config_path)
49-
tools = self.get_tools_from_config(kernel, "procurement", config_path)
5053

5154
# Use system message from config if not explicitly provided
5255
if not system_message:

src/backend/kernel_agents/product_agent.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
from typing import List, Optional
22

33
import semantic_kernel as sk
4-
from context.cosmos_memory_kernel import CosmosMemoryContext
4+
from semantic_kernel.functions import KernelFunction
5+
56
from kernel_agents.agent_base import BaseAgent
6-
from src.backend.kernel_tools.product_tools import ProductTools
7+
from context.cosmos_memory_kernel import CosmosMemoryContext
78
from models.messages_kernel import AgentType
8-
from semantic_kernel.functions import KernelFunction
9+
from src.backend.kernel_tools.product_tools import ProductTools
910

1011

1112
class ProductAgent(BaseAgent):
@@ -46,9 +47,12 @@ def __init__(
4647
"""
4748
# Load configuration if tools not provided
4849
if tools is None:
49-
# Load the product tools configuration
50+
# Get tools directly from ProductTools class
51+
tools_dict = ProductTools.get_all_kernel_functions()
52+
tools = [KernelFunction.from_method(func) for func in tools_dict.values()]
53+
54+
# Load the product tools configuration for system message
5055
config = self.load_tools_config("product", config_path)
51-
tools = self.get_tools_from_config(kernel, "product", config_path)
5256

5357
# Use system message from config if not explicitly provided
5458
if not system_message:
@@ -74,9 +78,8 @@ def __init__(
7478

7579
@property
7680
def plugins(self):
77-
"""Get the plugins for the syntax checker agent."""
81+
"""Get the plugins for the product agent."""
7882
return ProductTools.get_all_kernel_functions()
79-
# return ["marketing_functions", ProductTools()]
8083

8184
# Explicitly inherit handle_action_request from the parent class
8285
# This is not technically necessary but makes the inheritance explicit

src/backend/kernel_agents/tech_support_agent.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
from kernel_agents.agent_base import BaseAgent
77
from context.cosmos_memory_kernel import CosmosMemoryContext
88
from models.messages_kernel import AgentType
9+
from src.backend.kernel_tools.tech_support_tools import TechSupportTools
910

1011

1112
class TechSupportAgent(BaseAgent):
1213
"""Tech Support agent implementation using Semantic Kernel.
1314
14-
This agent specializes in IT troubleshooting, system administration, network issues,
15-
software installation, and general technical support. It can help with setting up software,
16-
accounts, devices, and other IT-related tasks.
15+
This agent specializes in technical support, IT administration, and equipment setup.
1716
"""
1817

1918
def __init__(
@@ -39,21 +38,24 @@ def __init__(
3938
tools: List of tools available to this agent (optional)
4039
system_message: Optional system message for the agent
4140
agent_name: Optional name for the agent (defaults to "TechSupportAgent")
42-
config_path: Optional path to the tech support tools configuration file
41+
config_path: Optional path to the Tech Support tools configuration file
4342
client: Optional client instance
4443
definition: Optional definition instance
4544
"""
4645
# Load configuration if tools not provided
4746
if tools is None:
48-
# Load the tech support tools configuration
47+
# Get tools directly from TechSupportTools class
48+
tools_dict = TechSupportTools.get_all_kernel_functions()
49+
tools = [KernelFunction.from_method(func) for func in tools_dict.values()]
50+
51+
# Load the tech support tools configuration for system message
4952
config = self.load_tools_config("tech_support", config_path)
50-
tools = self.get_tools_from_config(kernel, "tech_support", config_path)
5153

5254
# Use system message from config if not explicitly provided
5355
if not system_message:
5456
system_message = config.get(
5557
"system_message",
56-
"You are an AI Agent who is knowledgeable about Information Technology. You are able to help with setting up software, accounts, devices, and other IT-related tasks. If you need additional information from the human user asking the question in order to complete a request, ask before calling a function.",
58+
"You are a Tech Support agent. You can assist with technical issues, IT administration, equipment setup, and software/hardware troubleshooting. When asked to call a function, you should summarize back what was done.",
5759
)
5860

5961
# Use agent name from config if available

0 commit comments

Comments
 (0)