stitionai / devika

Devika is an Agentic AI Software Engineer that can understand high-level human instructions, break them down into steps, research relevant information, and write code to achieve the given objective. Devika aims to be a competitive open-source alternative to Devin by Cognition AI.
MIT License
18.25k stars 2.37k forks source link

playwright #310

Closed jalendarreddym closed 4 months ago

jalendarreddym commented 5 months ago

Description: When running the Devika agent, I encountered an error related to navigating to a URL using Playwright.

Steps to Reproduce:

Run the Devika agent. Attempt to navigate to a specific URL. See the error message. Expected Behavior: I expected the Devika agent to navigate to the URL successfully.

Error Message:

Exception in thread Thread-7 (): Traceback (most recent call last): File "C:\ProgramData\anaconda3\Lib\threading.py", line 1038, in _bootstrap_inner self.run() ... playwright._impl._errors.Error: Protocol error (Page.navigate): Cannot navigate to invalid URL Additional Information:

Operating System: [e.g., Windows 10] Browser: [e.g., Edge Devika Version: [e.g., 1.0.0]

BigFatherJesus commented 5 months ago

+1, I'm getting the same issue when using Google, when using anything else I get an Async API issue

sinanisler commented 5 months ago

I re installed everything 3 times there is definitly something wrong with the code rightnow we need stable docker release I will wait :)

samuelbirocchi commented 5 months ago

+1, I'm getting the same issue when using Google, when using anything else I get an Async API issue

have you tried the latests commits on the main branch? This issue should be fixed by now

dproworld commented 5 months ago

My error was slightly different, but it was fixed after upgrading to latest commit

qwaszaq commented 5 months ago

mine is something like this:

Search Engine :: google Searching in Google...

Link ::

Exception in thread Thread-3 (): Traceback (most recent call last): File "/home/ab/miniconda3/envs/devika/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/home/ab/miniconda3/envs/devika/lib/python3.10/threading.py", line 953, in run self._target(*self._args, self._kwargs) File "/home/ab/devika/devika.py", line 96, in thread = Thread(target=lambda: agent.execute(message, project_name)) File "/home/ab/devika/src/agents/agent.py", line 348, in execute search_results = self.search_queries(queries, project_name) File "/home/ab/devika/src/agents/agent.py", line 111, in search_queries browser, raw, data = loop.run_until_complete(self.open_page(project_name, link)) File "/home/ab/miniconda3/envs/devika/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/home/ab/devika/src/agents/agent.py", line 72, in open_page await browser.go_to(pdf_download_url) File "/home/ab/devika/src/browser/browser.py", line 32, in go_to await self.page.goto(url, timeout=20000) File "/home/ab/miniconda3/envs/devika/lib/python3.10/site-packages/playwright/async_api/_generated.py", line 8612, in goto await self._impl_obj.goto( File "/home/ab/miniconda3/envs/devika/lib/python3.10/site-packages/playwright/_impl/_page.py", line 500, in goto return await self._main_frame.goto(locals_to_params(locals())) File "/home/ab/miniconda3/envs/devika/lib/python3.10/site-packages/playwright/_impl/_frame.py", line 145, in goto await self._channel.send("goto", locals_to_params(locals())) File "/home/ab/miniconda3/envs/devika/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 59, in send return await self._connection.wrap_api_call( File "/home/ab/miniconda3/envs/devika/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 509, in wrap_api_call return await cb() File "/home/ab/miniconda3/envs/devika/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 97, in inner_send result = next(iter(done)).result() playwright._impl._errors.Error: Protocol error (Page.navigate): Cannot navigate to invalid URL

no idea what is the case :(

ARajgor commented 5 months ago

fetch the latest changes. already fixed for simple case. I guess docker file is not ready.

ARajgor commented 5 months ago

if it's help then resolve the issue.

tjthejuggler commented 5 months ago

I am also getting this as well:

playwright._impl._errors.Error: Protocol error (Page.navigate): Cannot navigate to invalid URL

I uninstalled and reinstalled everything, it says I am up to date when i do 'git pull' . Is there anything extra I have to do to get the code with fix for this or just wait for the docker?

I am using Ollama/Mistral and Google search and it's Ubuntu 22.04

Edit: There is no difference if I use openai3.5 or 4 turbo, same error for all 3. Also, maybe this is related, the settings and the home button on the left both seem to make it be stuck on an empty screen, only way back to the main screen is to refresh after I click those buttons.

Tim-Mclennan commented 5 months ago

I am also getting this as well:

playwright._impl._errors.Error: Protocol error (Page.navigate): Cannot navigate to invalid URL

I uninstalled and reinstalled everything, it says I am up to date when i do 'git pull' . Is there anything extra I have to do to get the code with fix for this or just wait for the docker?

I am using Ollama/Mistral and Google search and it's Ubuntu 22.04

Edit: There is no difference if I use openai3.5 or 4 turbo, same error for all 3. Also, maybe this is related, the settings and the home button on the left both seem to make it be stuck on an empty screen, only way back to the main screen is to refresh after I click those buttons.

I am also getting the same error, let me know how you go with it. I noticed that the URL is not even being populated when Devika searches: image

tjthejuggler commented 5 months ago

@Tim-Mclennan mine started working! I noticed my google search API had a space after it so i got rid of the space and restarted the backend and frontend and now i am able to search with gpt4 and ollama/mistral. I'm surprised that the space would cause the problem, but all i did was that and restart.

Luxcium commented 5 months ago

I am unable to install in Fedora without having problems. Getting help on the playwright repo is frustrating and I am unable to understand why Fedora users are being laughed at like that… Please help!!!

dproworld commented 5 months ago
  1. Make sure you are using a virtual environment while installing everything. I would not use the one suggested, instead conda. This solves lots of issues (conda)
  2. pull / clone the latest version of this repo
  3. install bun the proper way (through the instructions on website) and not through apt (generally good practice)
  4. when commenting on an issue, do git log -1 and add that as version, as issues like this have already been solved for certain versions.
  5. Make sure you don't have corrupted packages if all of the above has been completed. Keep a clean apt and pip, and you shouldn't have any errors.

If you have tried all of that (my installs never work out of the box, so these steps usually solve most problems), I would create another issue as it would be of compatability (as latest works on a standard 22.04 Ubuntu install) between systems (in this case I would double check everything by re-installing on a clean virtual install of your os, perhaps with docker, but that's just me). If anyone is using Windows, I would personally refrain using it on a mvp (as is any open-source devin project right now) and instead use WSL or a vm, but that's just me. Please comment if I missed something.

sockthem commented 5 months ago

@Tim-Mclennan mine started working! I noticed my google search API had a space after it so i got rid of the space and restarted the backend and frontend and now i am able to search with gpt4 and ollama/mistral. I'm surprised that the space would cause the problem, but all i did was that and restart.

can you tell more? where was the space?

Facing same error

sockthem commented 5 months ago

fetch the latest changes. already fixed for simple case. I guess docker file is not ready.

fetched latest changes, still this error: playwright._impl._errors.Error: Protocol error (Page.navigate): Cannot navigate to invalid URL

tjthejuggler commented 5 months ago

@sockthem

The space that I got rid of was in config.toml in the api keys section, the Google Search variable. There was a space after the key that I had pasted in. I don't know why that would matter, but that was literally the only thing I changed, and then I shut down the front and backends and then restarted them.

Also, I didn't follow the instructions here in the repo, I followed Matthew Berman's new tutorial on this. I realized after I did it that his instructions were a bit different than what's on here.

https://youtu.be/kw9nTK42bTw

sockthem commented 5 months ago

i saw this video earlier, where he is facing the same issue and at the end says " its buggy at this point" , but rest of the features are working fine. DuckDuckGo browser is working, but google search ain't still. I tried removing space, restarted multiple times, still no luck.

sockthem commented 5 months ago

@sockthem

The space that I got rid of was in config.toml in the api keys section, the Google Search variable. There was a space after the key that I had pasted in. I don't know why that would matter, but that was literally the only thing I changed, and then I shut down the front and backends and then restarted them.

Also, I didn't follow the instructions here in the repo, I followed Matthew Berman's new tutorial on this. I realized after I did it that his instructions were a bit different than what's on here.

https://youtu.be/kw9nTK42bTw

is google search working for you now?

tjthejuggler commented 5 months ago

@sockthem

Google search is working for me. I haven't tried with any other search. I tested with ollama/mistral and gpt4. The web page that is browsing comes up on the right hand side, and it produces code just as expected. The code it produced needed a little tweaking, but I think that was totally unrelated to any searching or browsing.

Luxcium commented 5 months ago

I am unable to install in Fedora without having problems. Getting help on the playwright repo is frustrating and I am unable to understand why Fedora users are being laughed at like that… Please help!!!

I realized that it was just easier to use the docker-compose method and it seems like it did not fail while building but now I think I have other problems (unrelated to the topic since playwright is no longer an issue) I will be patient and will hope that it will be possible to have some sort of way to refresh the system state or to get better information about the possibility of degradation in the process...

Thanks for all the efforts everyone has been putting into making this possible... I hope this will become so powerful that it is maintain itself in the near future...

andreabolandrina commented 5 months ago

still getting "playwright._impl._errors.Error: Protocol error (Page.navigate): Cannot navigate to invalid URL" with the latest code too.

ARajgor commented 5 months ago

still getting "playwright._impl._errors.Error: Protocol error (Page.navigate): Cannot navigate to invalid URL" with the latest code too.

In the python log there a log of links like Links :: can you share the links

andreabolandrina commented 5 months ago

Hi @ARajgor, thanks for asking.

Where would I find those? I checked the "data/logs/devika_agent.log" log file and it does not contain any "Links ::" or similar.

PS: I've also tried replacing Google search with DuckDuckGo and the backend gets stuck with the message: "root: INFO : Waiting for user query..." repeating every 5 seconds..

ARajgor commented 5 months ago

Hi @ARajgor, thanks for asking.

Where would I find those? I checked the "data/logs/devika_agent.log" log file and it does not contain any "Links ::" or similar.

PS: I've also tried replacing Google search with DuckDuckGo and the backend gets stuck with the message: "root: INFO : Waiting for user query..." repeating every 5 seconds..

"Links ::" isn't present in log. While you running the agent it print in console.

"Waiting for user query..." is already solve I don't know why it's still a problem. For this share the "research ::" print

andreabolandrina commented 5 months ago

OK. I haven't got this in the last two runs (and I did not update the codebase since yesterday). Not sure about the reason but hopefully the issue is not coming back..

ARajgor commented 4 months ago

solved it. fetch the latest changes.