feat: check goals only for this phase

Since conversation history still remains we can still check at a later point.

ref: N25B-429
This commit is contained in:
2026-01-07 17:31:24 +01:00
parent 3b4dccc760
commit 8a77e8e1c7

View File

@@ -86,6 +86,7 @@ class BDIProgramManager(BaseAgent):
self._phase = phase
self._send_beliefs_to_semantic_belief_extractor()
self._send_goals_to_semantic_belief_extractor()
# Notify user interaction agent
msg = InternalMessage(
@@ -131,12 +132,10 @@ class BDIProgramManager(BaseAgent):
await self.send(message)
@staticmethod
def _extract_goals_from_program(program: Program) -> list[Goal]:
def _extract_current_goals(self) -> list[Goal]:
"""
Extract all goals from the program, including subgoals.
:param program: The program received from the API.
:return: A list of Goal objects.
"""
goals: list[Goal] = []
@@ -148,19 +147,16 @@ class BDIProgramManager(BaseAgent):
goals_.extend(extract_goals_from_goal(plan))
return goals_
for phase in program.phases:
for goal in phase.goals:
for goal in self._phase.goals:
goals.extend(extract_goals_from_goal(goal))
return goals
async def _send_goals_to_semantic_belief_extractor(self, program: Program):
async def _send_goals_to_semantic_belief_extractor(self):
"""
Extract goals from the program and send them to the Semantic Belief Extractor Agent.
:param program: The program received from the API.
Extract goals for the current phase and send them to the Semantic Belief Extractor Agent.
"""
goals = GoalList(goals=self._extract_goals_from_program(program))
goals = GoalList(goals=self._extract_current_goals())
message = InternalMessage(
to=settings.agent_settings.text_belief_extractor_name,
@@ -192,7 +188,7 @@ class BDIProgramManager(BaseAgent):
await asyncio.gather(
self._create_agentspeak_and_send_to_bdi(program),
self._send_beliefs_to_semantic_belief_extractor(),
self._send_goals_to_semantic_belief_extractor(program),
self._send_goals_to_semantic_belief_extractor(),
)
async def setup(self):