Closed Guerdal closed 9 months ago
This guide provides step-by-step instructions on how to replace the browserless.io dependency with the Docker image browserless/chrome:latest
in the CrewAI project.
Run the following command to start the Browserless Docker container:
$ docker run -p 8080:3000 --restart always -d --name browserless browserless/chrome
This command maps the local port 8080 to the container's port 3000 and ensures the container restarts automatically. For more details, refer to the Browserless Docker documentation.
To check if the Browserless service is running, execute the Python script below. Ensure you have websocket-client
installed (pip install websocket-client
):
import websocket
import json
try:
ws = websocket.create_connection("ws://localhost:8080")
ws.send(json.dumps({"id": 1, "method": "Browser.getVersion"}))
while True:
response = ws.recv()
if response:
print("Received:", response)
break
except Exception as e:
print("Exception:", e)
finally:
ws.close()
Update the scrape_and_summarize_website
function in ./crewAI-examples/trip_planner/tools/browser_tools.py
:
class BrowserTools():
@tool("Scrape website content")
def scrape_and_summarize_website(website):
"""Scrape and summarize a website's content"""
# Change from remote Browserless service to local Docker instance
url = f"http://localhost:8080/content" # Local Docker instance URL
...
For reference, visit the CrewAI GitHub repository.
By following these steps, you can successfully integrate the Browserless Docker container into the CrewAI project. For further assistance or queries, feel free to reach out.
Note: This was generated using GPT4.
If you haven't solved it yet, could you please create an issue at https://github.com/joaomdmoura/crewAI/issues? Let's focus on addressing issues there.
could it be possible to have the url for browserless in .env?
Hello,
CrewAI is a magnificent project, I am trying to make it work with as little dependence on online services as possible.
So is it possible to replace the browserless (https://www.browserless.io/) dependency with the docker image browserless/chrome:latest? And if so, how? Thank you in advance.