Skip to content

Commit 3328669

Browse files
authored
fix Finish action to sent its 'thoughts' in the prompt (OpenHands#3149)
1 parent 9ed95ab commit 3328669

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

agenthub/codeact_agent/codeact_agent.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ def action_to_str(self, action: Action) -> str:
121121
return f'{action.thought}\n<execute_browse>\n{action.inputs["task"]}\n</execute_browse>'
122122
elif isinstance(action, MessageAction):
123123
return action.content
124+
elif isinstance(action, AgentFinishAction) and action.source == 'agent':
125+
return action.thought
124126
return ''
125127

126128
def get_action_message(self, action: Action) -> dict[str, str] | None:
@@ -129,6 +131,7 @@ def get_action_message(self, action: Action) -> dict[str, str] | None:
129131
or isinstance(action, CmdRunAction)
130132
or isinstance(action, IPythonRunCellAction)
131133
or isinstance(action, MessageAction)
134+
or (isinstance(action, AgentFinishAction) and action.source == 'agent')
132135
):
133136
return {
134137
'role': 'user' if action.source == 'user' else 'assistant',

0 commit comments

Comments
 (0)