AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Improve dev containers so autogpt can browse the web

Open bennyhobart opened this issue 1 year ago • 1 comments

Background

Currently dev containers do not contain everything necessary to run AutoGPT, and between different environments installing these dependencies can be quite a mess.

This diff aims to give the containers everything necessary to just follow the readme and get going with auto-gpt in dev containers

Changes

  • Update dockerfile to pull from know environment, the expectation is on apple silicon people will use rosetta to run this container, this change allows us to install chrome, sourcery and other standard things without much finangling
  • Install Chrome, necessary to browse
  • add options.add_argument("--no-sandbox") to Chrome startup so it can run in dev containers, this does have bad security implications https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/design/sandbox.md, and we might be able to get around it in another way (changing user starting chrome from root -> userspace, moving from debian(?))

Documentation

All specific things added are self documented, I could add a comment above the chrome install line if we wanted to outline, but seems readable as is

Test Plan

Reload and rebuild dev container

Run autogpt with goals of [Navigate to https://en.wikipedia.org/wiki/John_Wick:_Chapter_4', 'summarize page', 'output to file'] and role of "an AI designed to summarize webpages"

Observe glory

PR Quality Checklist

  • [x] My pull request is atomic and focuses on a single change.
  • [x] I have thoroughly tested my changes with multiple different prompts.
  • [x] I have considered potential risks and mitigations for my changes.
  • [x] I have documented my changes clearly and comprehensively.
  • [x] I have not snuck in any "extra" small tweaks changes

Currently no tests exists for dev containers, I only learnt about these today when pulling down autogpt but might be wortwhile investing in

bennyhobart avatar Apr 16 '23 16:04 bennyhobart

There's a few related issues for this https://github.com/Significant-Gravitas/Auto-GPT/issues/1445 https://github.com/Significant-Gravitas/Auto-GPT/issues/1788 https://github.com/Significant-Gravitas/Auto-GPT/issues/1711

bennyhobart avatar Apr 16 '23 16:04 bennyhobart

This is an important PR, on master currently Auto-GPT can't use web resources.

SYSTEM: Command browse_website returned: Error: Message: unknown error: DevToolsActivePort file doesn't exist Stacktrace: #0 0x55d407b34fe3 <unknown> #1 0x55d407873d36 <unknown> #2 0x55d4078a0459 <unknown> #3 0x55d40789c051 <unknown> #4 0x55d407898a9b <unknown> #5 0x55d4078daaf7 <unknown> #6 0x55d4078da11f <unknown> #7 0x55d4078d1693 <unknown> #8 0x55d4078a403a <unknown> #9 0x55d4078a517e <unknown> #10 0x55d407af6dbd <unknown> #11 0x55d407afac6c <unknown> #12 0x55d407b044b0 <unknown> #13 0x55d407afbd63 <unknown> #14 0x55d407acec35 <unknown> #15 0x55d407b1f138 <unknown> #16 0x55d407b1f2c7 <unknown> #17 0x55d407b2d093 <unknown> #18 0x7f5dc8294b43 <unknown>

AndresCdo avatar Apr 16 '23 20:04 AndresCdo

Did you check the current master? Works fine if you have chrome or firefox. If you have edge, wait for #1988 to get merged

nponeccop avatar Apr 16 '23 20:04 nponeccop

@nponeccop that diff will not fix default behavior of dev containers; dev containers do not have a browser installed

bennyhobart avatar Apr 16 '23 21:04 bennyhobart

Oh, I was misled by "This is an important PR, on master currently Auto-GPT can't use web resources.

It should have been "This is an important PR, on master currently Auto-GPT can't use web resources when run in containers, as this PR only affects containers".

I see now, sorry for misunderstanding.

nponeccop avatar Apr 16 '23 21:04 nponeccop

no worries @nponeccop ! I appreciate you revieweing all this code, very busy repo and definitely a huge lift to get through it all

Thanks!

bennyhobart avatar Apr 16 '23 22:04 bennyhobart

This PR breaks things for anyone trying to run on an ARM device, such as AWS EC2 instances or M1 Mac devices.

The docker file needs to be architecture agnostic, not specifying amd64.

johnseth97 avatar Apr 22 '23 16:04 johnseth97

The docker file needs to be architecture agnostic, not specifying amd64.

@desojo do you have any experience running a headless version of a Firefox browser in Linux (using selenium)? In my own fork off this repo trying to Dockerize it for ARM, you'd only need to do one or two more things after changing the default browser to Firefox for this to be ARM ready.

tajkirkpatrick avatar Apr 22 '23 18:04 tajkirkpatrick