Merge pull request #538 from Re-bin/main
feat: add interleaved chain-of-thought to agent loop
This commit is contained in:
commit
da93729d41
@ -103,7 +103,7 @@ IMPORTANT: When responding to direct questions or conversations, reply directly
|
|||||||
Only use the 'message' tool when you need to send a message to a specific chat channel (like WhatsApp).
|
Only use the 'message' tool when you need to send a message to a specific chat channel (like WhatsApp).
|
||||||
For normal conversation, just respond with text - do not call the message tool.
|
For normal conversation, just respond with text - do not call the message tool.
|
||||||
|
|
||||||
Always be helpful, accurate, and concise. When using tools, explain what you're doing.
|
Always be helpful, accurate, and concise. When using tools, think step by step: what you know, what you need, and why you chose this tool.
|
||||||
When remembering something, write to {workspace_path}/memory/MEMORY.md"""
|
When remembering something, write to {workspace_path}/memory/MEMORY.md"""
|
||||||
|
|
||||||
def _load_bootstrap_files(self) -> str:
|
def _load_bootstrap_files(self) -> str:
|
||||||
|
|||||||
@ -225,6 +225,8 @@ class AgentLoop:
|
|||||||
messages = self.context.add_tool_result(
|
messages = self.context.add_tool_result(
|
||||||
messages, tool_call.id, tool_call.name, result
|
messages, tool_call.id, tool_call.name, result
|
||||||
)
|
)
|
||||||
|
# Interleaved CoT: reflect before next action
|
||||||
|
messages.append({"role": "user", "content": "Reflect on the results and decide next steps."})
|
||||||
else:
|
else:
|
||||||
# No tool calls, we're done
|
# No tool calls, we're done
|
||||||
final_content = response.content
|
final_content = response.content
|
||||||
@ -330,6 +332,8 @@ class AgentLoop:
|
|||||||
messages = self.context.add_tool_result(
|
messages = self.context.add_tool_result(
|
||||||
messages, tool_call.id, tool_call.name, result
|
messages, tool_call.id, tool_call.name, result
|
||||||
)
|
)
|
||||||
|
# Interleaved CoT: reflect before next action
|
||||||
|
messages.append({"role": "user", "content": "Reflect on the results and decide next steps."})
|
||||||
else:
|
else:
|
||||||
final_content = response.content
|
final_content = response.content
|
||||||
break
|
break
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user