feat: added a functionality for monitoring page

ref: N25B-400
This commit is contained in:
Pim Hutting
2026-01-08 09:56:10 +01:00
parent 20e5e46639
commit 4bf2be6359
5 changed files with 161 additions and 40 deletions

View File

@@ -75,7 +75,12 @@ class BDIProgramManager(BaseAgent):
self._transition_phase(phases["old"], phases["new"])
def _transition_phase(self, old: str, new: str):
assert old == str(self._phase.id)
if old != str(self._phase.id):
self.logger.warning(
f"Phase transition desync detected! ASL requested move from '{old}', "
f"but Python is currently in '{self._phase.id}'. Request ignored."
)
return
if new == "end":
self._phase = None
@@ -208,6 +213,7 @@ class BDIProgramManager(BaseAgent):
self._initialize_internal_state(program)
await self._send_program_to_user_interrupt(program)
await self._send_clear_llm_history()
await asyncio.gather(
@@ -216,6 +222,21 @@ class BDIProgramManager(BaseAgent):
self._send_goals_to_semantic_belief_extractor(),
)
async def _send_program_to_user_interrupt(self, program: Program):
"""
Send the received program to the User Interrupt Agent.
:param program: The program object received from the API.
"""
msg = InternalMessage(
sender=self.name,
to=settings.agent_settings.user_interrupt_name,
body=program.model_dump_json(),
thread="new_program",
)
await self.send(msg)
async def setup(self):
"""
Initialize the agent.