Skip to content

Implement ReWOO Agent #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 33 commits into
base: develop
Choose a base branch
from

Conversation

yczhang-nv
Copy link
Contributor

@yczhang-nv yczhang-nv commented Apr 3, 2025

Description

This PR adds an implementation of a ReWOO agent.

  • A ReWOO agent works as follows:

    1. The planner node generates the entire chain of tools ("plan") in one go.
    2. The executor node processes the "plan" by iterating through each step and invoking the specified tools. Each tool’s output replaces the corresponding placeholder in the plan, and that updated plan is passed to the subsequent tool.
    3. The solver node generates the final results based on the complete "plan" and the tool outputs from the previous steps.
  • Compared to the ReAct agent, the ReWOO pattern eliminates the need to include the system prompt and all previous steps for every reasoning iteration, thereby reducing token usage and boosting performance.

  • This PR also introduces a minor refactor to the BaseAgent interface to accommodate the ReWOO pattern, which utilizes three nodes instead of the two nodes used by ReAct.

Closes https://jirasw.nvidia.com/browse/AIQ-849

By Submitting this PR I confirm:

  • I am familiar with the Contributing Guidelines.
  • We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
    • Any contribution which contains commits that are not Signed-Off will not be accepted.
  • When the PR is ready for review, new or existing tests cover these changes.
  • When the PR is ready for review, the documentation is up to date with these changes.

Signed-off-by: Yuchen Zhang <[email protected]>
@yczhang-nv yczhang-nv self-assigned this Apr 3, 2025
Signed-off-by: Yuchen Zhang <[email protected]>
Signed-off-by: Yuchen Zhang <[email protected]>
Signed-off-by: Yuchen Zhang <[email protected]>
Signed-off-by: Yuchen Zhang <[email protected]>
Signed-off-by: Yuchen Zhang <[email protected]>
@yczhang-nv yczhang-nv added feature request New feature or request non-breaking Non-breaking change labels Apr 4, 2025
Signed-off-by: Yuchen Zhang <[email protected]>
Signed-off-by: Yuchen Zhang <[email protected]>
Signed-off-by: Yuchen Zhang <[email protected]>
Signed-off-by: Yuchen Zhang <[email protected]>
@yczhang-nv yczhang-nv marked this pull request as ready for review April 7, 2025 23:28
@yczhang-nv yczhang-nv requested a review from a team as a code owner April 7, 2025 23:28
@yczhang-nv yczhang-nv changed the title Add ReWOO Agent Implement ReWOO Agent Apr 7, 2025
Copy link
Collaborator

@mdemoret-nv mdemoret-nv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but we need unit tests for this

@yczhang-nv yczhang-nv force-pushed the yuchen-add-rewoo-agent branch from 432d847 to c09a9dc Compare April 10, 2025 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants