Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/backend/agents/base_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
Step,
StepStatus,
)
from models.messages_kernel import AgentType
from src.backend.event_utils import track_event_if_configured


Expand Down Expand Up @@ -76,7 +77,7 @@ async def handle_action_request(
AssistantMessage(content=message.action, source="GroupChatManager"),
UserMessage(
content=f"{step.human_feedback}. Now make the function call",
source="HumanAgent",
source=AgentType.HUMAN.value,
),
]
)
Expand Down
6 changes: 3 additions & 3 deletions src/backend/agents/group_chat_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
Step,
StepStatus,
)

from models.messages_kernel import AgentType
from src.backend.event_utils import track_event_if_configured


Expand Down Expand Up @@ -57,7 +57,7 @@ async def handle_input_task(
user_id=self._user_id,
plan_id="",
content=f"{message.description}",
source="HumanAgent",
source=AgentType.HUMAN.value,
step_id="",
)
)
Expand All @@ -68,7 +68,7 @@ async def handle_input_task(
"session_id": message.session_id,
"user_id": self._user_id,
"content": message.description,
"source": "HumanAgent",
"source": AgentType.HUMAN.value,
},
)

Expand Down
5 changes: 3 additions & 2 deletions src/backend/agents/human.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
Step,
)
from src.backend.event_utils import track_event_if_configured
from models.messages_kernel import AgentType


@default_subscription
Expand Down Expand Up @@ -52,7 +53,7 @@ async def handle_step_feedback(
user_id=self.user_id,
plan_id=step.plan_id,
content=f"Received feedback for step: {step.action}",
source="HumanAgent",
source=AgentType.HUMAN.value,
step_id=message.step_id,
)
)
Expand All @@ -64,7 +65,7 @@ async def handle_step_feedback(
"user_id": self.user_id,
"plan_id": step.plan_id,
"content": f"Received feedback for step: {step.action}",
"source": "HumanAgent",
"source": AgentType.HUMAN.value,
"step_id": message.step_id,
},
)
Expand Down
6 changes: 3 additions & 3 deletions src/backend/agents/planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
StepStatus,
HumanFeedbackStatus,
)

from models.messages_kernel import AgentType
from src.backend.event_utils import track_event_if_configured


Expand Down Expand Up @@ -133,7 +133,7 @@ async def handle_plan_clarification(
user_id=self._user_id,
plan_id="",
content=f"{message.human_clarification}",
source="HumanAgent",
source=AgentType.HUMAN.value,
step_id="",
)
)
Expand All @@ -144,7 +144,7 @@ async def handle_plan_clarification(
"session_id": message.session_id,
"user_id": self._user_id,
"content": f"{message.human_clarification}",
"source": "HumanAgent",
"source": AgentType.HUMAN.value,
},
)

Expand Down
2 changes: 1 addition & 1 deletion src/backend/app_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ async def approve_step_endpoint(
agents = await get_agents(human_feedback.session_id, user_id)

# Send the approval to the group chat manager
group_chat_manager = agents["GroupChatManager"]
group_chat_manager = agents[AgentType.GROUP_CHAT_MANAGER.value]

# Handle the approval
human_feedback_json = human_feedback.json()
Expand Down
26 changes: 10 additions & 16 deletions src/backend/models/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@
from enum import Enum
from typing import Literal, Optional

from autogen_core.components.models import (
AssistantMessage,
FunctionExecutionResultMessage,
LLMMessage,
SystemMessage,
UserMessage,
)
from .messages_kernel import AgentType
from pydantic import BaseModel, Field


Expand All @@ -23,15 +17,15 @@ class DataType(str, Enum):
class BAgentType(str, Enum):
"""Enumeration of agent types."""

human_agent = "HumanAgent"
hr_agent = "HrAgent"
marketing_agent = "MarketingAgent"
procurement_agent = "ProcurementAgent"
product_agent = "ProductAgent"
generic_agent = "GenericAgent"
tech_support_agent = "TechSupportAgent"
group_chat_manager = "GroupChatManager"
planner_agent = "PlannerAgent"
AgentType.HUMAN.value = "HumanAgent"
AgentType.HR.value = "HrAgent"
AgentType.MARKETING.value = "MarketingAgent"
AgentType.PROCUREMENT.value = "ProcurementAgent"
AgentType.PRODUCT.value = "ProductAgent"
AgentType.GENERIC.value = "GenericAgent"
AgentType.TECH_SUPPORT.value = "TechSupportAgent"
AgentType.GROUP_CHAT_MANAGER.value = "GroupChatManager"
AgentType.PLANNER.value = "PlannerAgent"

# Add other agents as needed

Expand Down
6 changes: 3 additions & 3 deletions src/backend/tests/test_group_chat_manager_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ async def initialize_group_chat_manager(self):

# Create agent dictionary for the group chat manager
available_agents = {
"PlannerAgent": planner_agent,
"HumanAgent": human_agent,
"GenericAgent": generic_agent
"planner_agent": planner_agent,
"human_agent": human_agent,
"generic_agent": generic_agent
}

# Create the group chat manager
Expand Down
2 changes: 1 addition & 1 deletion src/backend/utils_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async def get_agents(session_id: str, user_id: str) -> Dict[str, Any]:
}

# Convert to the agent name dictionary format used by the rest of the app
agents = {agent_classes[agent_type]: agent for agent_type, agent in raw_agents.items()}
agents = {agent_type.value: agent for agent_type, agent in raw_agents.items()}

# Cache the agents
agent_instances[cache_key] = agents
Expand Down
Loading