Skip to content

Commit 00d0a0d

Browse files
add last message to orchestrator history for sentinel (#476)
1 parent 564e9b0 commit 00d0a0d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/magentic_ui/teams/orchestrator/_orchestrator.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,6 +1636,9 @@ async def _execute_sentinel_step(
16361636
"type": "sentinel_error",
16371637
},
16381638
)
1639+
# add last message from agent to history
1640+
self._state.message_history.append(last_agent_message)
1641+
16391642
# inform orchestrator that the step has failed
16401643
self._state.message_history.append(
16411644
TextMessage(
@@ -1687,7 +1690,12 @@ async def _execute_sentinel_step(
16871690
log_msg,
16881691
metadata=complete_metadata,
16891692
)
1693+
1694+
# add last message from agent to history
1695+
self._state.message_history.append(last_agent_message)
1696+
16901697
# inform orchestrator that the step is completed
1698+
16911699
self._state.message_history.append(
16921700
TextMessage(
16931701
content=f"Sentinel step '{step.title}' completed successfully. Reason: {reason}",

0 commit comments

Comments
 (0)