This project is a demonstration of using a browser-use as an API. The API can then be invoked manually or using any AI Agent.
The purpose of this project is to provide a browser-use agent as an API service, running in headless mode within a Docker container. This service can be consumed as a tool by AI agents, allowing them to browse the internet and retrieve final responses in natural language for any kind of web automation.
- Ensure you have Python 3.11+ installed.
- Clone the repo:
git clone <github URL to this project> - Create a virtual environment:
python3 -m venv .venv - Activate the virtual environment:
source .venv/bin/activate - Install the dependencies:
pip install -r requirements.txt - Run the server:
python server.py - In another terminal, hit the API entpoint using CURL or any tool like postman or REST client
curl -X POST -H "Content-Type: application/json; charset=utf-8" -d '{"task": "go to google and get me title and responsibilities of two software engineering jobs in phoenix along with their links"}' http://localhost:5055/v1/query
- Ensure you have Docker installed.
- Get into project folder:
cd <project folder> - Build the Docker image:
docker compose --build. Once built, subsequently you can rundocker compose up - In another terminal, hit the API entpoint using CURL or any tool like postman or REST client
curl -X POST -H "Content-Type: application/json; charset=utf-8" -d '{"task": "go to google and get me title and responsibilities of two software engineering jobs in phoenix along with their links"}' http://localhost:5055/v1/query
- [Optional] To terminate, in-flight request make a GET call to
http://localhost:5055/v1/terminate. This needs to improve to handle specific request being terminated with request id.