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

Browsing Agent Is not working #128

Closed
okoliechykwuka opened this issue May 23, 2024 · 12 comments
Closed

Browsing Agent Is not working #128

okoliechykwuka opened this issue May 23, 2024 · 12 comments
Labels

Comments

@okoliechykwuka
Copy link

This is directly from the Browsing Agent Notebook, The only added changes are in line one.

from agency_swarm.agents import BrowsingAgent to from agency_swarm.agents.BrowsingAgent import BrowsingAgent

from agency_swarm.agents.BrowsingAgent import BrowsingAgent
from agency_swarm import Agency, Agent
import openai

openai.api_key = "what_ever"

selenium_config = {
    # your canary profile path
    # "chrome_profile_path": "/Users/vrsen/Library/Application Support/Google/Chrome Canary/Profile 1",
    "headless": False,
    "full_page_screenshot": False,
}

browsing_agent = BrowsingAgent(selenium_config=selenium_config)

agency = Agency([browsing_agent])

demo = agency.demo_gradio(height=700) # Reload the notebook each time you run this cell

ERROR TRACRBACK

Files folder '/home/chukypedro15/anaconda3/envs/pyxellenv/lib/python3.11/site-packages/agency_swarm/agents/BrowsingAgent/files' is not a directory. Skipping...
Schemas folder path is not a directory. Skipping...  /home/chukypedro15/anaconda3/envs/pyxellenv/lib/python3.11/site-packages/agency_swarm/agents/BrowsingAgent/schemas
Error parsing tool file SelectDropdown.py: invalid syntax (<string>, line 1). Skipping...
Error parsing tool file ExportFile.py: invalid syntax (<string>, line 1). Skipping...
Error parsing tool file ClickElement.py: invalid syntax (<string>, line 1). Skipping...
Error parsing tool file WebPageSummarizer.py: invalid syntax (<string>, line 1). Skipping...
Error parsing tool file Scroll.py: invalid syntax (<string>, line 1). Skipping...
Error parsing tool file ReadURL.py: invalid syntax (<string>, line 1). Skipping...
Error parsing tool file GoBack.py: invalid syntax (<string>, line 1). Skipping...
Error parsing tool file SolveCaptcha.py: invalid syntax (<string>, line 1). Skipping...
Error parsing tool file AnalyzeContent.py: invalid syntax (<string>, line 1). Skipping...
Error parsing tool file SendKeys.py: invalid syntax (<string>, line 1). Skipping...
Updating assistant... BrowsingAgent
/home/chukypedro15/anaconda3/envs/pyxellenv/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
  from .autonotebook import tqdm as notebook_tqdm
Running on local URL:  http://127.0.0.1:7860/

To create a public link, set `share=True` in `launch()`.


WHEN I TYPE "what is the current AAPL stock price in the radio text box, I get the below error.

IMPORTANT: You are using gradio version 4.26.0, however version 4.29.0 is available, please upgrade.
--------
Message files:  []
THREAD:[ user -> BrowsingAgent ]: URL https://platform.openai.com/playground?assistant=asst_XIwdgiDFb73zbZ5ySRtranGK&mode=assistant&thread=thread_duQMs2Ji1fsfimOjmUsaTGSG
/home/chukypedro15/anaconda3/envs/pyxellenv/lib/python3.11/site-packages/pydantic/main.py:347: UserWarning: Pydantic serializer warnings:
  Expected `Union[RunStepDeltaMessageDelta, ToolCallDeltaObject]` but got `ToolCallDeltaObject` - serialized value may not be as expected
  Expected `Union[CodeInterpreterToolCallDelta, RetrievalToolCallDelta, FunctionToolCallDelta]` but got `CodeInterpreterToolCallDelta` - serialized value may not be as expected
  return self.__pydantic_serializer__.to_python(
Exception in thread Thread-9 (get_completion_stream):
Traceback (most recent call last):
  File "/home/chukypedro15/anaconda3/envs/pyxellenv/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/home/chukypedro15/anaconda3/envs/pyxellenv/lib/python3.11/site-packages/ipykernel/ipkernel.py", line 761, in run_closure
    _threading_Thread_run(self)
  File "/home/chukypedro15/anaconda3/envs/pyxellenv/lib/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "/home/chukypedro15/anaconda3/envs/pyxellenv/lib/python3.11/site-packages/agency_swarm/agency/agency.py", line 147, in get_completion_stream
    next(gen)
  File "/home/chukypedro15/anaconda3/envs/pyxellenv/lib/python3.11/site-packages/agency_swarm/threads/thread.py", line 69, in get_completion
    self._create_run(recipient_agent, additional_instructions, event_handler)
  File "/home/chukypedro15/anaconda3/envs/pyxellenv/lib/python3.11/site-packages/agency_swarm/threads/thread.py", line 196, in _create_run
    stream.until_done()
  File "/home/chukypedro15/anaconda3/envs/pyxellenv/lib/python3.11/site-packages/openai/lib/streaming/_assistants.py", line 102, in until_done
    consume_sync_iterator(self)
  File "/home/chukypedro15/anaconda3/envs/pyxellenv/lib/python3.11/site-packages/openai/_utils/_streams.py", line 6, in consume_sync_iterator
    for _ in iterator:
  File "/home/chukypedro15/anaconda3/envs/pyxellenv/lib/python3.11/site-packages/openai/lib/streaming/_assistants.py", line 69, in __iter__
    for item in self._iterator:
  File "/home/chukypedro15/anaconda3/envs/pyxellenv/lib/python3.11/site-packages/openai/lib/streaming/_assistants.py", line 405, in __stream__
...
  File "/home/chukypedro15/anaconda3/envs/pyxellenv/lib/python3.11/site-packages/agency_swarm/agency/agency.py", line 266, in on_tool_call_created
    if tool_call.type == "function":
       ^^^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'type'
@emdagon
Copy link

emdagon commented May 24, 2024

I'm facing the same problem.

@Eunomiac
Copy link

Exact same problem here --- both when importing from agency-swarm, and when importing from a custom module I created after importing BrowserAgent via the CLI agency-swarm import-agent command.

@VRSEN
Copy link
Owner

VRSEN commented May 25, 2024

Hey guys, please install from main branch using pip install --no-cache -e . and let me know if this persists

@kinghotelwelco
Copy link

Hey guys, please install from main branch using pip install --no-cache -e . and let me know if this persists

Still not working as of now.

VRSEN added a commit that referenced this issue May 28, 2024
…emove udpates when initializing assistant from id #128
@okoliechykwuka
Copy link
Author

I am using requirement or poetry . How can I install the module without using pip install --no-cache -e . so that I can use the browsing agent

pip install --no-cache -e . method can only work in development.

@VRSEN
Copy link
Owner

VRSEN commented May 29, 2024

Pass local path to latest agency swarm into pip install or in your poetry dependencies. Alternatively install from github pip install --no-cache git+https://github.com/VRSEN/agency-swarm.git @okoliechykwuka

VRSEN added a commit that referenced this issue May 29, 2024
@Javitito
Copy link

Javitito commented Jun 4, 2024

After attempting to resolve the issue with the proposed solution, I am still encountering an error. I'm not sure how severe it is, but here is the error message:

Files folder 'C:\Users\javi\Documents\PROGRAMAS_PYTHON\agency-swarm\agency_swarm\agents\BrowsingAgent\files' is not a directory. Skipping...
Schemas folder path is not a directory. Skipping... C:\Users\javi\Documents\PROGRAMAS_PYTHON\agency-swarm\agency_swarm\agents\BrowsingAgent\schemas
Updating agent... GenesisCEO
Updating agent... ToolCreator
Updating agent... AgentCreator
Updating agent... OpenAPICreator
Updating agent... BrowsingAgent
Any guidance on how to fix this would be greatly appreciated.

@AmirAlsad
Copy link

AmirAlsad commented Jun 5, 2024

I'm running the exact same code and the BrowsingAgent is loaded in fine, but when you ask it to search anything, it shoots the following error:

  File "/opt/anaconda3/envs/AgencySwarmNotebooks/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
  File "/opt/anaconda3/envs/AgencySwarmNotebooks/lib/python3.11/site-packages/ipykernel/ipkernel.py", line 761, in run_closure
    _threading_Thread_run(self)
  File "/opt/anaconda3/envs/AgencySwarmNotebooks/lib/python3.11/threading.py", line 982, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/anaconda3/envs/AgencySwarmNotebooks/lib/python3.11/site-packages/agency_swarm/agency/agency.py", line 196, in get_completion_stream
    next(res)
  File "/opt/anaconda3/envs/AgencySwarmNotebooks/lib/python3.11/site-packages/agency_swarm/threads/thread.py", line 118, in get_completion
    self._create_run(recipient_agent, additional_instructions, event_handler, tool_choice)
  File "/opt/anaconda3/envs/AgencySwarmNotebooks/lib/python3.11/site-packages/agency_swarm/threads/thread.py", line 274, in _create_run
    stream.until_done()
  File "/opt/anaconda3/envs/AgencySwarmNotebooks/lib/python3.11/site-packages/openai/lib/streaming/_assistants.py", line 102, in until_done
    consume_sync_iterator(self)
  File "/opt/anaconda3/envs/AgencySwarmNotebooks/lib/python3.11/site-packages/openai/_utils/_streams.py", line 6, in consume_sync_iterator
    for _ in iterator:
  File "/opt/anaconda3/envs/AgencySwarmNotebooks/lib/python3.11/site-packages/openai/lib/streaming/_assistants.py", line 69, in __iter__
    for item in self._iterator:
  File "/opt/anaconda3/envs/AgencySwarmNotebooks/lib/python3.11/site-packages/openai/lib/streaming/_assistants.py", line 405, in __stream__
    self._emit_sse_event(event)
  File "/opt/anaconda3/envs/AgencySwarmNotebooks/lib/python3.11/site-packages/openai/lib/streaming/_assistants.py", line 368, in _emit_sse_event
    self.on_tool_call_created(self._current_tool_call)
  File "/opt/anaconda3/envs/AgencySwarmNotebooks/lib/python3.11/site-packages/agency_swarm/agency/agency.py", line 392, in on_tool_call_created
    raise ValueError("Invalid tool call type: " + tool_call["type"])
ValueError: Invalid tool call type: browser

This happens when I ask the agent to search anything up, including @okoliechykwuka's original prompt. It seems that it doesn't have an actual browser tool to make any searches?

@okoliechykwuka
Copy link
Author

Aside from the bugs, the Framework is too expensive to use.

@AmirAlsad
Copy link

Just added a SearchWeb tool to the BrowsingAgent in my fork ( #146 ), which resolves some of the bugs. I've also made the agent rely less on the user when navigating by taking more screenshots. Just as a note, don't leave your chrome profile path in the selenium config if you have that chrome profile already open because it will just throw an error (you can't have the same profile open more than once). Other than that make sure you're importing the agent from the right place.

Copy link
Contributor

github-actions bot commented Jul 9, 2024

This issue is stale because it has been open for 30 days with no activity. Please upgrade to the latest version and test it again.

@github-actions github-actions bot added the stale label Jul 9, 2024
Copy link
Contributor

This issue was closed because it has been inactive for 14 days since being marked as stale. If the issue still persists, please reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants