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

feat: Autonomous mode #2435

Closed
wants to merge 25 commits into from
Closed

feat: Autonomous mode #2435

wants to merge 25 commits into from

Conversation

SmartManoj
Copy link
Contributor

@SmartManoj SmartManoj commented Jun 14, 2024

Solves #1798.

image

For Future PRs: continue the previous task

Copy link
Collaborator

@yufansong yufansong left a comment

Choose a reason for hiding this comment

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

cc @li-boxuan @xingyaoww for review.

Comment on lines 225 to 228
if config.agent.is_autonomous:
messages.append(
{'role': 'agent', 'content': f'Iteration {state.iteration}'}
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why add this

Copy link
Contributor Author

@SmartManoj SmartManoj Jun 15, 2024

Choose a reason for hiding this comment

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

Without this, the agent repeatedly gives step 1 for the given task. Renaming Iteration to step would be appropriate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, it gives a hint about how many steps it has tried.

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 understand it either. Doesn't look right to me...

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 role == 'agent' is a supported behavior of litellm, it should be user message? Did you test the code?

Copy link
Contributor Author

@SmartManoj SmartManoj Jun 16, 2024

Choose a reason for hiding this comment

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

Litellm doesn't check that but openai does. Ran with a custom model.

Copy link
Collaborator

@xingyaoww xingyaoww left a comment

Choose a reason for hiding this comment

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

I'm a bit hestitant to merge this as is, unless we figure out a way to add a checkbox on the frontend that allows the user to select [autonomous mode].

I think a lot of OpenDevin's helpfulness comes from the ability to request inputs from the user, and i think it is probably not a good idea to completely remove this ability just to implement autonomous mode.

Comment on lines 225 to 228
if config.agent.is_autonomous:
messages.append(
{'role': 'agent', 'content': f'Iteration {state.iteration}'}
)
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 role == 'agent' is a supported behavior of litellm, it should be user message? Did you test the code?

@tobitege
Copy link
Collaborator

tobitege commented Jun 16, 2024

I'm a bit hestitant to merge this as is, unless we figure out a way to add a checkbox on the frontend that allows the user to select [autonomous mode].

I think a lot of OpenDevin's helpfulness comes from the ability to request inputs from the user, and i think it is probably not a good idea to completely remove this ability just to implement autonomous mode.

I'd rather have an instantly working Stop frontend button that can interrupt even a running task, without waiting for the current one to finish. Let the user control. This PR's behavior seems highly LLM dependent.

@xingyaoww
Copy link
Collaborator

xingyaoww commented Jun 16, 2024

I'd rather have an instantly working Stop frontend button that can interrupt even a running task, without waiting for the current one to finish. Let the user control.

OHHH yes! This is what i want too -- something like ctrl+C. This + Autonomous mode should be pretty good for most stuff.

But i still think when appropriate, the agent should still require input from the user. Otherwise, you'd need to educate the user first to "know there's a stop button that can do XYZ" which can increase the entry barrier.

@tobitege
Copy link
Collaborator

Is this PR just for a specific edge-case and does it warrant patching around the core that make it less maintainable?

@SmartManoj
Copy link
Contributor Author

i think it is probably not a good idea to completely remove this ability

@xingyaoww, it is still a config.

@xingyaoww
Copy link
Collaborator

xingyaoww commented Jun 16, 2024

it is still a config.

  1. If you don't teach the user to tweak the config, there's just no effect from a user's perspective -- we are writing code that's not actually useful to most users since most of them will start OpenDevin using docker (and by default, without autonomous mode).

  2. If the user configures the autonomous mode -- We throw away the ability to await user input, which is one of our core features. Moreover, we currently rely on some hacks to implement the autonomous mode, which creates a future maintenance burden.

Therefore, I don't think it is good to merge unless we can solve (1) in a meaningful way - bc if (1) is not solved, user experience is not gonna change, and it basically means we are adding code that is not actively used by people.

@SmartManoj
Copy link
Contributor Author

SmartManoj commented Jun 16, 2024

It's currently for advanced users and completely solves #1586

@xingyaoww xingyaoww requested a review from rbren June 16, 2024 06:52
@SmartManoj SmartManoj requested a review from xingyaoww June 16, 2024 12:25
@SmartManoj SmartManoj requested review from enyst and neubig June 24, 2024 03:05
@neubig
Copy link
Contributor

neubig commented Jul 3, 2024

Because there has been no response to @mamoodi 's comments above, I am going to close this PR, but please feel free to explain and reopen if you think otherwise.

@neubig neubig closed this Jul 3, 2024
@SmartManoj SmartManoj removed their assignment Jul 3, 2024
@SmartManoj
Copy link
Contributor Author

SmartManoj commented Jul 3, 2024

I have already discussed this with @mamoodi in Slack as the PR has been waiting for the reviewers.
image

And @xingyaoww also requested a review from @rbren
image

Finally, there is a commit and a review request after the comment too.
image

@SmartManoj
Copy link
Contributor Author

SmartManoj commented Jul 3, 2024

based on the comments by @xingyaoww seems like this might not be feasible as is.

@mamoodi There are some commits and a request review after that.

image

Copy link
Collaborator

@xingyaoww xingyaoww left a comment

Choose a reason for hiding this comment

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

Sorry it takes so long for review --Just saw it!

I think this version looks good to me, just some nits, and I'll need to locally test this before approve it.

@SmartManoj can you share a screenshot of the modified frontend so reviewer can see its effect?

@SmartManoj
Copy link
Contributor Author

SmartManoj commented Jul 3, 2024

can you share a screenshot of the modified frontend so reviewer can see its effect?

Already added in the description.

@xingyaoww xingyaoww reopened this Jul 3, 2024
@xingyaoww
Copy link
Collaborator

The tooltip is a bit laggy in this PR.
I suggested a change by re-using the Tooltip component we are using for the pause and stop button: SmartManoj#1

@xingyaoww
Copy link
Collaborator

xingyaoww commented Jul 3, 2024

My input is: "Can you build a website for me?"

Then i hit with the following errors:
image

Why it seems the "autonomous" message being concatenated to the messages from the agent?

)
action.content += user_msg # type: ignore
action.wait_for_response = False # type: ignore
return action
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you probably don't need to change these on the backend, since you are already dispatching user messages on the FE?

Copy link
Contributor Author

@SmartManoj SmartManoj Jul 3, 2024

Choose a reason for hiding this comment

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

Not dispatched on the front end. Changed here and parsed in FE.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you remove changes from the backend so that it won't affect other things (e.g., eval), and move this message to dispatched by the frontend?

Ideally, the "auto mode" should just be a way for the user to say "i want to keep clicking the [continue] button when it comes up"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

eval is not affected by this.

"""

name: str = 'CodeActAgent'
memory_enabled: bool = False
memory_max_threads: int = 2
is_autonomous: bool = False
Copy link
Collaborator

Choose a reason for hiding this comment

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

And why do we need this? I think is_autonoumous can be entirely handled by the FE - no?
e.g., when the autonomous mode is enabled, whenever the agent is requesting user inputs, the FE will always send back a pre-defined user message, asking the agent to "continue". We can probably re-use the continue button logic - the "checkbox" will just work by keep clicking the "continue" button for the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the config and added it as an attribute to Agent. The Agent should behave differently when autonomous mode is enabled like when to detect the loop.

Copy link
Collaborator

@xingyaoww xingyaoww Jul 3, 2024

Choose a reason for hiding this comment

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

Why we need to change the backend AND the agent for the autonomous mode?

ref: #2435 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for different prompts?

Copy link
Collaborator

Choose a reason for hiding this comment

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

what do you mean by "for different prompts"? can you elaborate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for different system prompts.

Copy link
Collaborator

Choose a reason for hiding this comment

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

why? I don't want us to add unnecessary additional complexity to the repo unless there are a few specific examples showing the necessity. The "continue" button on FE does not need to be modified on the backend; why does this need to modify BE?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why did you add "⚠️ Use with caution!" in the tooltip?

@SmartManoj SmartManoj marked this pull request as draft July 3, 2024 16:20
@SmartManoj SmartManoj mentioned this pull request Jul 4, 2024
@SmartManoj
Copy link
Contributor Author

Implemented this in the frontend itself in #2782

Have any thoughts that the agent should be aware of the autonomous mode in the future?

@xingyaoww
Copy link
Collaborator

Close this in favor of #2782.

@SmartManoj I think we might need the agent to be aware of this, but i don't yet see a clear reason / motivating example of doing so.

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.

7 participants