Make AgentDelegateAction send only the task, not the main agent thoughts
End-user friendly description of the problem this fixes or functionality that this introduces
- [ ] Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below Fix AgentDelegateAction to send only the task to the delegate agent, not the main agent thoughts
Give a summary of what the PR does, explaining any non-trivial design decisions
It's a bit strange to see the browsing agent starting with:
"21:12:46 - ACTION AgentDelegateAction(agent='BrowsingAgent', inputs={'task': "Thank you for providing the current content of the file. Now, let's summarize the information from the blog article and add it to the file. I'll start by browsing the article to gather the necessary information.. I should start with: Summarize the quality and cost information of various language models from https://www.all-hands.dev/blog/evaluation-of-llms-as-coding-agents-on-swe-bench-at-30x-speed"}, thought='', action='delegate')
Notes on the above:
- the
thoughtis empty, even though the main agent had a thought. Because it was included into the task. An AgentDelegateAction has a field forthoughtthat was not filled by parse(). - the main agent LLM seems to have intended "Summarize the quality and cost information of various language models ..." to be the task.
It seems to me that we need to put the contents of the thought in the thought and perhaps more importantly, keep the task as much as possible as the message we need in the delegate.
Link of any specific issues this addresses
Alternatively, we could take the "I should start with" too, into the task. I'm not sure.
I tried quickly with only browse_actions and it worked great. The difference: CodeAct:
Let me look up the Vice President of the USA using a browsing agent. Please wait a moment.
<execute_browse>
Tell me who is the Vice President of the USA
[Before] BrowsingAgent:
# Goal:
Let me look up the Vice President of the USA using a browsing agent. Please wait a moment. I should start with: Tell me who is the Vice President of the USA
[After] BrowsingAgent:
# Goal:
Tell me who is the Vice President of the USA
I am a bit confused because your current changes seem to be doing sth different than what your PR title says,
Make AgentDelegateAction send only the task, not the main agent thoughts
Regarding the intention from this PR title, my answer is: I don't know. I vaguely remember when the main task is complicated, this thought is necessary.
@li-boxuan I updated the description and the title (the title is hard 😅 ).
Basically, what you say: yes, let's split and put it this way. This PR proposes two things:
- fill in with it the
thoughtattribute of the AgentDelegateAction, instead of leaving it empty. It will be used by the parent later. Currently it's just absent when the action is parsed. - send to the delegate as
taskonly the contents in execute_browse tags. Instead of inserting in its "task", this "thought". The contents of the "thought" are the rest of the response that the LLM of the parent returned (outside the execute tag). Thetaskwill be inserted as "{goal}" in the delegate's prompt template. Thethoughtwill be inserted in the parent's history.
For the record, the history of the main agent is also unintended IMHO:
<execute_browse>
Understood. I will use the browsing tool to find the current Vice President of the USA.. I should start with: Search for "current Vice President of the USA" on Google
</execute_browse>
This is the entirety of the action in the parent's history: since the whole content was in task, the serialization in codeact puts it all in execute browse tags, plus a newline for the empty thought.
I would expect:
Understood. I will use the browsing tool to find the current Vice President of the USA.. I should start with:
<execute_browse>
Search for "current Vice President of the USA" on Google
</execute_browse>