From 8a77e8e1c756dfc9347e09cd7642a82216401410 Mon Sep 17 00:00:00 2001 From: Kasper Marinus Date: Wed, 7 Jan 2026 17:31:24 +0100 Subject: [PATCH] feat: check goals only for this phase Since conversation history still remains we can still check at a later point. ref: N25B-429 --- .../agents/bdi/bdi_program_manager.py | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/control_backend/agents/bdi/bdi_program_manager.py b/src/control_backend/agents/bdi/bdi_program_manager.py index fefd6a7..12d8c6a 100644 --- a/src/control_backend/agents/bdi/bdi_program_manager.py +++ b/src/control_backend/agents/bdi/bdi_program_manager.py @@ -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: - goals.extend(extract_goals_from_goal(goal)) + 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):