Fix incomplete final answers in hierarchical process mode #2769
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix Hierarchical Process Mode Incomplete Final Answers
Issue
When using hierarchical process mode with GPT-4o, the final answer is incomplete. It only shows the manager agent's delegation thought, not the actual result from the delegated agent.
Solution
Set
result_as_answer=True
in theDelegateWorkTool
class to ensure that the delegated agent's result is used as the final answer instead of the manager agent's delegation thought.Testing
Added a test that verifies the delegated agent's result is properly captured as the final answer in hierarchical process mode.
Fixes #2768
Link to Devin run: https://app.devin.ai/sessions/3e2f5f52a0494993b6244810e16a75d9
Requested by: Joe Moura ([email protected])