Skip to content
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

Add AgentRejectAction across multiple modules #1615

Merged
merged 4 commits into from May 8, 2024

Conversation

li-boxuan
Copy link
Collaborator

@li-boxuan li-boxuan commented May 7, 2024

This commit introduces the AgentRejectAction class and integrates it across various modules and actions. It includes updates to READMEs, action definitions, and agent controllers to handle the new 'reject' action. This functionality will allow agents to properly signal task rejection.

===========BELOW COMMIT MESSAGE IS GENERATED BY OPENDEVIN=============

Yes, again I am too lazy to write a commit message by myself. So I asked OpenDevin to do me the favour:

WORKSPACE_MOUNT_PATH="`PWD`" SANDBOX_TYPE="exec" poetry run python opendevin/core/main.py -t "write a commit message" -c ManagerAgent -d ./

Why this PR is needed?

  1. To give the user and/or delegator agent a chance to rethink about the task
  2. To encourage agent developers to think about edge/failure cases. E.g. without the prompt change included in this PR, CommitWriterAgent never finishes when running in a non-git folder
  3. To differentiate between success and failure (ofc). Without this PR, we don't know if There is no diff in the staging area; no changes to commit. output from CommitWriterAgent really means there's no change to commit, OR the output itself is literally the compiled commit message.

TODO in this PR:

  • Update backend_architecture.puml This should be a separate issue.

Future work:

  • Add integration test for Reject
  • Delegator should be able to rethink about the task assignment
  • Micro-agents should have enforcements for their inputs & outputs schema
  • UI changes to differentiate between "Finish" and "Reject"
  • Any other agent needs to use "Reject" action?

This commit introduces the AgentRejectAction class and integrates it across various modules and actions. It includes updates to READMEs, action definitions, and agent controllers to handle the new 'reject' action. This functionality will allow agents to properly signal task rejection.
@codecov-commenter
Copy link

codecov-commenter commented May 7, 2024

Codecov Report

Attention: Patch coverage is 81.81818% with 2 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (main@242c4a0). Click here to learn what that means.

Files Patch % Lines
opendevin/controller/agent_controller.py 0.00% 1 Missing ⚠️
opendevin/events/action/agent.py 87.50% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1615   +/-   ##
=======================================
  Coverage        ?   39.05%           
=======================================
  Files           ?       92           
  Lines           ?     3731           
  Branches        ?        0           
=======================================
  Hits            ?     1457           
  Misses          ?     2274           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@li-boxuan li-boxuan linked an issue May 7, 2024 that may be closed by this pull request
@@ -105,6 +105,17 @@ def message(self) -> str:
return "All done! What's next on the agenda?"


@dataclass
class AgentRejectAction(Action):
outputs: Dict = field(default_factory=dict)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this should have an arbitrary dict of outputs, the way finish does. All we want is a reason

Copy link
Collaborator Author

@li-boxuan li-boxuan May 8, 2024

Choose a reason for hiding this comment

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

I see where you are coming from, but I have a few counter-arguments:

  1. An agent can choose to have more than just a reason attribute. For example, it can suggest how to fix the task in addition to a reason.
  2. Both AgentRejectAction and AgentFinishAction are termination actions, so it's better for them to have the same interface IMO.
  3. By design, a micro-agent has a schema for inputs and outputs. We don't really enforce it at the moment (i.e. a micro-agent can finish with whatever outputs type), but I feel like we should do it sooner or later. If AgentRejectAction and AgentFinishAction could have different schema for outputs, things will become trickier.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will create a follow-up to enforce the schema for micro-agents. We could discuss if we want to continue this approach there.

@rbren
Copy link
Collaborator

rbren commented May 7, 2024

Very cool! Agree this will be useful

@li-boxuan li-boxuan merged commit af5bdf6 into OpenDevin:main May 8, 2024
23 checks passed
@li-boxuan li-boxuan deleted the 1482/add-rejection-action branch May 8, 2024 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Micro-agent: Support task rejection
4 participants