Skip to content

Commit 837f131

Browse files
committed
fix agents names
1 parent a044c88 commit 837f131

17 files changed

+69
-85
lines changed

src/backend/app_kernel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
)
3838
from utils_kernel import initialize_runtime_and_context, get_agents, rai_success
3939
from event_utils import track_event_if_configured
40-
from models.agent_types import AgentType
40+
from models.messages_kernel import AgentType
4141
from kernel_agents.agent_factory import AgentFactory
4242

4343
# # Check if the Application Insights Instrumentation Key is set in the environment variables

src/backend/kernel_agents/agent_factory.py

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from semantic_kernel.agents.azure_ai.azure_ai_agent import AzureAIAgent
99
import inspect
1010

11-
from models.agent_types import AgentType
1211
from kernel_agents.agent_base import BaseAgent
1312
# Import the new AppConfig instance
1413
from app_config import config
@@ -25,7 +24,7 @@
2524
from kernel_agents.group_chat_manager import GroupChatManager
2625
from semantic_kernel.prompt_template.prompt_template_config import PromptTemplateConfig
2726
from context.cosmos_memory_kernel import CosmosMemoryContext
28-
from models.messages_kernel import PlannerResponsePlan
27+
from models.messages_kernel import PlannerResponsePlan, AgentType
2928

3029
from azure.ai.projects.models import (
3130
ResponseFormatJsonSchema,
@@ -46,21 +45,21 @@ class AgentFactory:
4645
AgentType.TECH_SUPPORT: TechSupportAgent,
4746
AgentType.GENERIC: GenericAgent,
4847
AgentType.HUMAN: HumanAgent,
49-
AgentType.PLANNER: PlannerAgent, # Add PlannerAgent
48+
AgentType.PLANNER: PlannerAgent,
5049
AgentType.GROUP_CHAT_MANAGER: GroupChatManager, # Add GroupChatManager
5150
}
5251

5352
# Mapping of agent types to their string identifiers (for automatic tool loading)
5453
_agent_type_strings: Dict[AgentType, str] = {
55-
AgentType.HR: "hr",
56-
AgentType.MARKETING: "marketing",
57-
AgentType.PRODUCT: "product",
58-
AgentType.PROCUREMENT: "procurement",
59-
AgentType.TECH_SUPPORT: "tech_support",
60-
AgentType.GENERIC: "generic",
61-
AgentType.HUMAN: "human",
62-
AgentType.PLANNER: "planner", # Add planner
63-
AgentType.GROUP_CHAT_MANAGER: "group_chat_manager", # Add group_chat_manager
54+
AgentType.HR: AgentType.HR.value,
55+
AgentType.MARKETING: AgentType.MARKETING.value,
56+
AgentType.PRODUCT: AgentType.PRODUCT.value,
57+
AgentType.PROCUREMENT: AgentType.PROCUREMENT.value,
58+
AgentType.TECH_SUPPORT:AgentType.TECH_SUPPORT.value,
59+
AgentType.GENERIC: AgentType.GENERIC.value,
60+
AgentType.HUMAN: AgentType.HUMAN.value,
61+
AgentType.PLANNER: AgentType.PLANNER.value,
62+
AgentType.GROUP_CHAT_MANAGER: AgentType.GROUP_CHAT_MANAGER.value,
6463
}
6564

6665
# System messages for each agent type
@@ -255,23 +254,14 @@ async def _load_tools_for_agent(cls, kernel: Kernel, agent_type: str) -> List[Ke
255254
except Exception as e:
256255
logger.warning(f"Error loading tools for {agent_type}: {e}")
257256

258-
# Return an empty list for agents without tools rather than attempting a fallback
259-
# Special handling for group_chat_manager which typically doesn't need tools
260-
if "group_chat_manager" in agent_type:
261-
logger.info(f"No tools needed for {agent_type}. Returning empty list.")
262-
return []
263-
257+
264258
# For other agent types, try to create a simple fallback tool
265259
try:
266260
# Use PromptTemplateConfig to create a simple tool
267261

268262

269263
# Simple minimal prompt
270-
prompt = f"""You are a helpful assistant specialized in {agent_type} tasks.
271-
272-
User query: {{$input}}
273-
274-
Provide a helpful response."""
264+
prompt = f"""You are a helpful assistant specialized in {agent_type} tasks. User query: {{$input}} Provide a helpful response."""
275265

276266
# Create a prompt template config
277267
prompt_config = PromptTemplateConfig(

src/backend/kernel_agents/generic_agent.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from kernel_agents.agent_base import BaseAgent
88
from context.cosmos_memory_kernel import CosmosMemoryContext
9+
from models.messages_kernel import AgentType
910

1011
class GenericAgent(BaseAgent):
1112
"""Generic agent implementation using Semantic Kernel."""
@@ -18,7 +19,7 @@ def __init__(
1819
memory_store: CosmosMemoryContext,
1920
tools: Optional[List[KernelFunction]] = None,
2021
system_message: Optional[str] = None,
21-
agent_name: str = "GenericAgent",
22+
agent_name: str = AgentType.GENERIC.value,
2223
config_path: Optional[str] = None,
2324
client=None,
2425
definition=None,
@@ -51,7 +52,7 @@ def __init__(
5152
"the user's task. Summarize back to the user what was done.")
5253

5354
# Use agent name from config if available
54-
agent_name = config.get("agent_name", agent_name)
55+
agent_name = AgentType.GENERIC.value
5556

5657
# Call the parent initializer
5758
super().__init__(

src/backend/kernel_agents/group_chat_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __init__(self):
4343
InputTask,
4444
Plan,
4545
)
46-
from models.agent_types import AgentType
46+
from models.messages_kernel import AgentType
4747
from event_utils import track_event_if_configured
4848

4949

src/backend/kernel_agents/hr_agent.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from kernel_agents.agent_base import BaseAgent
77
from context.cosmos_memory_kernel import CosmosMemoryContext
8+
from models.messages_kernel import AgentType
89

910
class HrAgent(BaseAgent):
1011
"""HR agent implementation using Semantic Kernel.
@@ -21,7 +22,7 @@ def __init__(
2122
memory_store: CosmosMemoryContext,
2223
tools: Optional[List[KernelFunction]] = None,
2324
system_message: Optional[str] = None,
24-
agent_name: str = "HrAgent",
25+
agent_name: str = AgentType.HR.value,
2526
config_path: Optional[str] = None,
2627
client=None,
2728
definition=None,
@@ -54,7 +55,7 @@ def __init__(
5455
)
5556

5657
# Use agent name from config if available
57-
agent_name = config.get("agent_name", agent_name)
58+
agent_name = AgentType.HUMAN.value
5859

5960
super().__init__(
6061
agent_name=agent_name,

src/backend/kernel_agents/human_agent.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from kernel_agents.agent_base import BaseAgent
99
from context.cosmos_memory_kernel import CosmosMemoryContext
10-
from models.messages_kernel import HumanFeedback, Step, StepStatus, AgentMessage, ActionRequest
10+
from models.messages_kernel import AgentType, HumanFeedback, Step, StepStatus, AgentMessage, ActionRequest
1111
from event_utils import track_event_if_configured
1212

1313
class HumanAgent(BaseAgent):
@@ -25,7 +25,7 @@ def __init__(
2525
memory_store: CosmosMemoryContext,
2626
tools: Optional[List[KernelFunction]] = None,
2727
system_message: Optional[str] = None,
28-
agent_name: str = "HumanAgent",
28+
agent_name: str = AgentType.HUMAN.value,
2929
config_path: Optional[str] = None,
3030
client=None,
3131
definition=None,
@@ -53,7 +53,7 @@ def __init__(
5353
"system_message",
5454
"You are representing a human user in the conversation. You handle interactions that require human feedback or input."
5555
)
56-
agent_name = config.get("agent_name", agent_name)
56+
agent_name = AgentType.HUMAN.value
5757

5858
super().__init__(
5959
agent_name=agent_name,

src/backend/kernel_agents/marketing_agent.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from kernel_agents.agent_base import BaseAgent
77
from context.cosmos_memory_kernel import CosmosMemoryContext
8+
from models.messages_kernel import AgentType
89

910
class MarketingAgent(BaseAgent):
1011
"""Marketing agent implementation using Semantic Kernel.
@@ -23,7 +24,7 @@ def __init__(
2324
memory_store: CosmosMemoryContext,
2425
tools: Optional[List[KernelFunction]] = None,
2526
system_message: Optional[str] = None,
26-
agent_name: str = "MarketingAgent",
27+
agent_name: str = AgentType.MARKETING.value,
2728
config_path: Optional[str] = None,
2829
client=None,
2930
definition=None,
@@ -56,7 +57,7 @@ def __init__(
5657
)
5758

5859
# Use agent name from config if available
59-
agent_name = config.get("agent_name", agent_name)
60+
agent_name = AgentType.MARKETING.value
6061

6162
super().__init__(
6263
agent_name=agent_name,

src/backend/kernel_agents/procurement_agent.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from kernel_agents.agent_base import BaseAgent
77
from context.cosmos_memory_kernel import CosmosMemoryContext
8+
from models.messages_kernel import AgentType
89

910
class ProcurementAgent(BaseAgent):
1011
"""Procurement agent implementation using Semantic Kernel.
@@ -22,7 +23,7 @@ def __init__(
2223
memory_store: CosmosMemoryContext,
2324
tools: Optional[List[KernelFunction]] = None,
2425
system_message: Optional[str] = None,
25-
agent_name: str = "ProcurementAgent",
26+
agent_name: str = AgentType.PROCUREMENT.value,
2627
config_path: Optional[str] = None,
2728
client=None,
2829
definition=None,
@@ -55,7 +56,7 @@ def __init__(
5556
)
5657

5758
# Use agent name from config if available
58-
agent_name = config.get("agent_name", agent_name)
59+
agent_name = AgentType.PROCUREMENT.value
5960

6061
super().__init__(
6162
agent_name=agent_name,

src/backend/kernel_agents/product_agent.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from kernel_agents.agent_base import BaseAgent
77
from context.cosmos_memory_kernel import CosmosMemoryContext
8+
from models.messages_kernel import AgentType
89

910
class ProductAgent(BaseAgent):
1011
"""Product agent implementation using Semantic Kernel.
@@ -23,7 +24,7 @@ def __init__(
2324
memory_store: CosmosMemoryContext,
2425
tools: Optional[List[KernelFunction]] = None,
2526
system_message: Optional[str] = None,
26-
agent_name: str = "ProductAgent",
27+
agent_name: str = AgentType.PRODUCT.value,
2728
config_path: Optional[str] = None,
2829
client=None,
2930
definition=None,
@@ -56,7 +57,7 @@ def __init__(
5657
)
5758

5859
# Use agent name from config if available
59-
agent_name = config.get("agent_name", agent_name)
60+
agent_name = AgentType.PRODUCT.value
6061

6162
super().__init__(
6263
agent_name=agent_name,

src/backend/kernel_agents/tech_support_agent.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from kernel_agents.agent_base import BaseAgent
77
from context.cosmos_memory_kernel import CosmosMemoryContext
8+
from models.messages_kernel import AgentType
89

910
class TechSupportAgent(BaseAgent):
1011
"""Tech Support agent implementation using Semantic Kernel.
@@ -22,7 +23,7 @@ def __init__(
2223
memory_store: CosmosMemoryContext,
2324
tools: Optional[List[KernelFunction]] = None,
2425
system_message: Optional[str] = None,
25-
agent_name: str = "TechSupportAgent",
26+
agent_name: str = AgentType.TECH_SUPPORT.value,
2627
config_path: Optional[str] = None,
2728
client=None,
2829
definition=None,
@@ -55,7 +56,7 @@ def __init__(
5556
)
5657

5758
# Use agent name from config if available
58-
agent_name = config.get("agent_name", agent_name)
59+
agent_name = AgentType.TECH_SUPPORT.value
5960

6061
super().__init__(
6162
agent_name=agent_name,

0 commit comments

Comments
 (0)