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(agent): add BrowseURLAction to CodeAct (produce markdown from URL) #5285

Merged
merged 10 commits into from
Nov 27, 2024

Conversation

xingyaoww
Copy link
Collaborator

@xingyaoww xingyaoww commented Nov 26, 2024

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

This PR introduce two browsing mode for default CodeAct agent AND improves the agent's ability to read arbitrary documentation/web page on the internet.

  • web_read: simply perform information gathering by browsing URL & convert HTML pages into a markdown file for LLM to comprehend, most useful to read documentation, github issues, etc. It also allows the agent to perform google search by directly visit https://www.google.com/search?q=YOUR_QUERY.
  • browser: more complex browsing that allows the agent to interact with the web page (clicking, input things into form, scroll up and down, etc).

Give a summary of what the PR does, explaining any non-trivial design decisions

A new web_read tool that directly reads off a given URL
Screenshot of it working:

image image

Link of any specific issues this addresses


To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:97df362-nikolaik   --name openhands-app-97df362   docker.all-hands.dev/all-hands-ai/openhands:97df362

Copy link
Contributor

@neubig neubig left a comment

Choose a reason for hiding this comment

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

Can we evaluate this in some way? WebArena would be ideal, but barring that miniwob

@xingyaoww
Copy link
Collaborator Author

xingyaoww commented Nov 26, 2024

@neubig this will ONLY be triggered when "http://" or "https://" keywords are detected from user messages -- which a lot of instances (if not all) in miniwob/webarena do not have, means these benchmark likely won't be able to evaluate this changes?

@xingyaoww xingyaoww marked this pull request as draft November 26, 2024 18:17
@xingyaoww xingyaoww changed the title feat(agent): add webpage read microagent feat(agent): add BrowseURLAction back (produce markdown from URL) Nov 26, 2024
@neubig
Copy link
Contributor

neubig commented Nov 26, 2024

I think miniwob and webarena tell you the URL to go to? (but if not, maybe they should...)

@xingyaoww
Copy link
Collaborator Author

@neubig no.. BrowserGym will automatically switch the given page before the eval kicks off.

But anyway -- i made some modification and directly made an additional web_read function that allows the agent to read the website directly - Here's the Miniwob result: 84/125=67.2%, which is very comparable to the 86/125 we got in #4667.

Copy link
Contributor

@neubig neubig left a comment

Choose a reason for hiding this comment

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

OK, this LGTM, thank you!

And just to clarify, I wanted to make sure that this didn't break our existing browsing functionality. I think the new solution definitely does not. And actually we might even want to turn the standard browsing functionality off in safety-critical settings, allowing only the web-page read tool. This seems like a great solution!

@xingyaoww xingyaoww marked this pull request as ready for review November 27, 2024 16:59
@xingyaoww xingyaoww changed the title feat(agent): add BrowseURLAction back (produce markdown from URL) feat(agent): add BrowseURLAction to CodeAct (produce markdown from URL) Nov 27, 2024
@xingyaoww
Copy link
Collaborator Author

And I evaluated on a subset of SWE-Bench tasks (30) with browsing enabled - doesn't seem to confuse the agent as well. Will go ahead and merge this.

15:53:17 - openhands:INFO: eval_infer.py:418 - # resolved: 14 / 30. (46.67%)
15:53:17 - openhands:INFO: eval_infer.py:418 - # failed_apply_patch: 0 / 30. (0.00%)
15:53:17 - openhands:INFO: eval_infer.py:418 - # error_eval: 0 / 30. (0.00%)
15:53:17 - openhands:INFO: eval_infer.py:418 - # empty_generation: 0 / 30. (0.00%)

@xingyaoww xingyaoww enabled auto-merge (squash) November 27, 2024 21:12
@xingyaoww xingyaoww merged commit 4d3b035 into main Nov 27, 2024
13 checks passed
@xingyaoww xingyaoww deleted the xw/simple-web-page-read-microagent branch November 27, 2024 21:55
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.

2 participants