Sunday, April 6, 2025

Setup AI agent browser-use using web-ui from scratch

 

Setup AI agent browser-use using  web-ui from scratch


Notice here, I dont want to don anything on my local laptop, since this will mess up my local permenant python setup. So I use a VM.


references:

https://docs.astral.sh/uv/

https://github.com/browser-use/browser-use?tab=readme-ov-file

https://docs.browser-use.com/quickstart


YouTube:


                        

1. setup chrome as your browser


2. install uv as package manager [a package and project manager written in rust]


https://docs.astral.sh/uv/getting-started/installation/



Examine the script:


powershell -c "irm https://astral.sh/uv/install.ps1 | more"


select windows install option:


powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"


> copy/paste the codes above


Output:


Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows                                                                                                                                                                                                                                                                                                                                                                                                 PS C:\Users\vagrant> powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"                                                                                                                                      Downloading uv 0.6.12 (x86_64-pc-windows-msvc)                                                                                                                                                                                               Installing to C:\Users\vagrant\.local\bin

  uv.exe

  uvx.exe

everything's installed!


To add C:\Users\vagrant\.local\bin to your PATH, either restart your shell or run:


    set Path=C:\Users\vagrant\.local\bin;%Path%   (cmd)

    $env:Path = "C:\Users\vagrant\.local\bin;$env:Path"   (powershell)

PS C:\Users\vagrant>




3. Install git


https://git-scm.com/downloads/win


4. Download web-ui repo and setup the browser-use repo on local laptop

cmd

cd c:\user\vagrant

mkdir web-ui-agent

cd web-ui-agent

dir

git clone https://github.com/browser-use/web-ui.git

cd web-ui



output:

C:\Users\vagrant>cd web-ui-agent


C:\Users\vagrant\web-ui-agent>dir

 Volume in drive C has no label.

 Volume Serial Number is 9499-6C73


 Directory of C:\Users\vagrant\web-ui-agent


04/05/2025  12:45 AM    <DIR>          .

04/05/2025  12:49 AM    <DIR>          ..

               0 File(s)              0 bytes

               2 Dir(s)  103,294,328,832 bytes free


C:\Users\vagrant\web-ui-agent>git clone https://github.com/browser-use/web-ui.git

Cloning into 'web-ui'...

remote: Enumerating objects: 1653, done.

remote: Counting objects: 100% (685/685), done.

remote: Compressing objects: 100% (82/82), done.

remote: Total 1653 (delta 627), reused 603 (delta 603), pack-reused 968 (from 2)

Receiving objects: 100% (1653/1653), 984.22 KiB | 5.89 MiB/s, done.

Resolving deltas: 100% (1028/1028), done.


C:\Users\vagrant\web-ui-agent>dir

 Volume in drive C has no label.

 Volume Serial Number is 9499-6C73


 Directory of C:\Users\vagrant\web-ui-agent


04/05/2025  01:12 AM    <DIR>          .

04/05/2025  12:49 AM    <DIR>          ..

04/05/2025  01:12 AM    <DIR>          web-ui

               0 File(s)              0 bytes

               3 Dir(s)  103,291,965,440 bytes free


C:\Users\vagrant\web-ui-agent>cd web-ui


C:\Users\vagrant\web-ui-agent\web-ui>dir

 Volume in drive C has no label.

 Volume Serial Number is 9499-6C73


 Directory of C:\Users\vagrant\web-ui-agent\web-ui


04/05/2025  01:12 AM    <DIR>          .

04/05/2025  01:12 AM    <DIR>          ..

04/05/2025  01:12 AM                 9 .dockerignore

04/05/2025  01:12 AM             1,286 .env.example

04/05/2025  01:12 AM             3,603 .gitignore

04/05/2025  01:12 AM    <DIR>          .vscode

04/05/2025  01:12 AM    <DIR>          assets

04/05/2025  01:12 AM             2,426 docker-compose.yml

04/05/2025  01:12 AM             2,084 Dockerfile

04/05/2025  01:12 AM             2,112 Dockerfile.arm64

04/05/2025  01:12 AM               160 entrypoint.sh

04/05/2025  01:12 AM             1,094 LICENSE

04/05/2025  01:12 AM             9,506 README.md

04/05/2025  01:12 AM               156 requirements.txt

04/05/2025  01:12 AM             1,052 SECURITY.md

04/05/2025  01:12 AM    <DIR>          src

04/05/2025  01:12 AM             3,051 supervisord.conf

04/05/2025  01:12 AM    <DIR>          tests

04/05/2025  01:12 AM            48,145 webui.py

              13 File(s)         74,684 bytes

               6 Dir(s)  103,291,965,440 bytes free


C:\Users\vagrant\web-ui-agent\web-ui>




5. Download web-ui repo and setup the browser-use repo on local laptop



uv python list

uv python install 

uv python list


Output:


c:\Users\vagrant\web-ui-agent\web-ui>uv python list

cpython-3.14.0a6+freethreaded-windows-x86_64-none    <download available>

cpython-3.14.0a6-windows-x86_64-none                 <download available>

cpython-3.13.2+freethreaded-windows-x86_64-none      <download available>

cpython-3.13.2-windows-x86_64-none                   <download available>

cpython-3.12.9-windows-x86_64-none                   <download available>

cpython-3.11.11-windows-x86_64-none                  <download available>

cpython-3.10.16-windows-x86_64-none                  <download available>

cpython-3.9.21-windows-x86_64-none                   <download available>

cpython-3.8.20-windows-x86_64-none                   <download available>

cpython-3.7.9-windows-x86_64-none                    <download available>


C:\Users\vagrant\web-ui-agent\web-ui>uv python install

Installed Python 3.13.2 in 5.21s

 + cpython-3.13.2-windows-x86_64-none


C:\Users\vagrant\web-ui-agent\web-ui>uv python list

cpython-3.14.0a6+freethreaded-windows-x86_64-none    <download available>

cpython-3.14.0a6-windows-x86_64-none                 <download available>

cpython-3.13.2+freethreaded-windows-x86_64-none      <download available>

cpython-3.13.2-windows-x86_64-none                   C:\Users\vagrant\AppData\Roaming\uv\python\cpython-3.13.2-windows-x86_64-none\python.exe

cpython-3.12.9-windows-x86_64-none                   <download available>

cpython-3.11.11-windows-x86_64-none                  <download available>

cpython-3.10.16-windows-x86_64-none                  <download available>

cpython-3.9.21-windows-x86_64-none                   <download available>

cpython-3.8.20-windows-x86_64-none                   <download available>

cpython-3.7.9-windows-x86_64-none                    <download available>


C:\Users\vagrant\web-ui-agent\web-ui>




6. Install Python, activate python virtual environment & install all dependent packages using uv


uv venv --python 3.13.2

.venv\Scripts\activate

uv pip list

uv pip install -r requirements.txt

uv pip list


output:

(web-ui) C:\Users\vagrant\web-ui-agent\web-ui>uv pip install -r requirements.txt

Resolved 122 packages in 4.80s

      Built html2text==2024.2.26

Prepared 22 packages in 10.84s

Installed 122 packages in 4.17s

 + aiofiles==23.2.1

 + annotated-types==0.7.0

 + anthropic==0.49.0

 + anyio==4.9.0

 + audioop-lts==0.2.1

 + babel==2.17.0

 + backoff==2.2.1

 + beautifulsoup4==4.13.3

 + browser-use==0.1.40

 + cachetools==5.5.2

 + certifi==2025.1.31

 + charset-normalizer==3.4.1

 + click==8.1.8

 + colorama==0.4.6

 + courlan==1.3.2

 + dateparser==1.2.1

 + defusedxml==0.7.1

 + distro==1.9.0

 + fastapi==0.115.12

 + ffmpy==0.5.0

 + filelock==3.18.0

 + filetype==1.2.0

 + fsspec==2025.3.2

 + google-ai-generativelanguage==0.6.15

 + google-api-core==2.24.2

 + google-api-python-client==2.166.0

 + google-auth==2.38.0

 + google-auth-httplib2==0.2.0

 + google-generativeai==0.8.4

 + googleapis-common-protos==1.69.2

 + gradio==5.23.1

 + gradio-client==1.8.0

 + greenlet==3.1.1

 + groovy==0.1.2

 + grpcio==1.71.0

 + grpcio-status==1.71.0

 + h11==0.14.0

 + html2text==2024.2.26

 + htmldate==1.9.3

 + httpcore==1.0.7

 + httplib2==0.22.0

 + httpx==0.28.1

 + httpx-sse==0.4.0

 + huggingface-hub==0.30.1

 + idna==3.10

 + jinja2==3.1.6

 + jiter==0.9.0

 + json-repair==0.40.0

 + jsonpatch==1.33

 + jsonpointer==3.0.0

 + justext==3.0.2

 + langchain-anthropic==0.3.3

 + langchain-core==0.3.51

 + langchain-google-genai==2.0.8

 + langchain-mistralai==0.2.4

 + langchain-ollama==0.2.2

 + langchain-openai==0.3.1

 + langsmith==0.3.24

 + lxml==5.3.1

 + lxml-html-clean==0.4.1

 + maincontentextractor==0.0.4

 + markdown-it-py==3.0.0

 + markdownify==0.14.1

 + markupsafe==3.0.2

 + mdurl==0.1.2

 + monotonic==1.6

 + numpy==2.2.4

 + ollama==0.4.7

 + openai==1.70.0

 + orjson==3.10.16

 + packaging==24.2

 + pandas==2.2.3

 + pillow==11.1.0

 + playwright==1.51.0

 + posthog==3.23.0

 + proto-plus==1.26.1

 + protobuf==5.29.4

 + pyasn1==0.6.1

 + pyasn1-modules==0.4.2

 + pydantic==2.11.2

 + pydantic-core==2.33.1

 + pydub==0.25.1

 + pyee==12.1.1

 + pygments==2.19.1

 + pyparsing==3.2.3

 + pyperclip==1.9.0

 + python-dateutil==2.9.0.post0

 + python-dotenv==1.1.0

 + python-multipart==0.0.20

 + pytz==2025.2

 + pyyaml==6.0.2

 + regex==2024.11.6

 + requests==2.32.3

 + requests-toolbelt==1.0.0

 + rich==14.0.0

 + rsa==4.9

 + ruff==0.11.4

 + safehttpx==0.1.6

 + semantic-version==2.10.0

 + setuptools==78.1.0

 + shellingham==1.5.4

 + six==1.17.0

 + sniffio==1.3.1

 + soupsieve==2.6

 + starlette==0.46.1

 + tenacity==9.1.2

 + tiktoken==0.9.0

 + tld==0.13

 + tokenizers==0.21.1

 + tomlkit==0.13.2

 + tqdm==4.67.1

 + trafilatura==2.0.0

 + typer==0.15.2

 + typing-extensions==4.13.1

 + typing-inspection==0.4.0

 + tzdata==2025.2

 + tzlocal==5.3.1

 + uritemplate==4.1.1

 + urllib3==2.3.0

 + uvicorn==0.34.0

 + websockets==15.0.1

 + zstandard==0.23.0


(web-ui) C:\Users\vagrant\web-ui-agent\web-ui>


(web-ui) C:\Users\vagrant\web-ui-agent\web-ui>uv pip list

Package                      Version

---------------------------- -----------

aiofiles                     23.2.1

annotated-types              0.7.0

anthropic                    0.49.0

anyio                        4.9.0

audioop-lts                  0.2.1

babel                        2.17.0

backoff                      2.2.1

beautifulsoup4               4.13.3

browser-use                  0.1.40

cachetools                   5.5.2

certifi                      2025.1.31

charset-normalizer           3.4.1

click                        8.1.8

colorama                     0.4.6

courlan                      1.3.2

dateparser                   1.2.1

defusedxml                   0.7.1

distro                       1.9.0

fastapi                      0.115.12

ffmpy                        0.5.0

filelock                     3.18.0

filetype                     1.2.0

fsspec                       2025.3.2

google-ai-generativelanguage 0.6.15

google-api-core              2.24.2

google-api-python-client     2.166.0

google-auth                  2.38.0

google-auth-httplib2         0.2.0

google-generativeai          0.8.4

googleapis-common-protos     1.69.2

gradio                       5.23.1

gradio-client                1.8.0

greenlet                     3.1.1

groovy                       0.1.2

grpcio                       1.71.0

grpcio-status                1.71.0

h11                          0.14.0

html2text                    2024.2.26

htmldate                     1.9.3

httpcore                     1.0.7

httplib2                     0.22.0

httpx                        0.28.1

httpx-sse                    0.4.0

huggingface-hub              0.30.1

idna                         3.10

jinja2                       3.1.6

jiter                        0.9.0

json-repair                  0.40.0

jsonpatch                    1.33

jsonpointer                  3.0.0

justext                      3.0.2

langchain-anthropic          0.3.3

langchain-core               0.3.51

langchain-google-genai       2.0.8

langchain-mistralai          0.2.4

langchain-ollama             0.2.2

langchain-openai             0.3.1

langsmith                    0.3.24

lxml                         5.3.1

lxml-html-clean              0.4.1

maincontentextractor         0.0.4

markdown-it-py               3.0.0

markdownify                  0.14.1

markupsafe                   3.0.2

mdurl                        0.1.2

monotonic                    1.6

numpy                        2.2.4

ollama                       0.4.7

openai                       1.70.0

orjson                       3.10.16

packaging                    24.2

pandas                       2.2.3

pillow                       11.1.0

playwright                   1.51.0

posthog                      3.23.0

proto-plus                   1.26.1

protobuf                     5.29.4

pyasn1                       0.6.1

pyasn1-modules               0.4.2

pydantic                     2.11.2

pydantic-core                2.33.1

pydub                        0.25.1

pyee                         12.1.1

pygments                     2.19.1

pyparsing                    3.2.3

pyperclip                    1.9.0

python-dateutil              2.9.0.post0

python-dotenv                1.1.0

python-multipart             0.0.20

pytz                         2025.2

pyyaml                       6.0.2

regex                        2024.11.6

requests                     2.32.3

requests-toolbelt            1.0.0

rich                         14.0.0

rsa                          4.9

ruff                         0.11.4

safehttpx                    0.1.6

semantic-version             2.10.0

setuptools                   78.1.0

shellingham                  1.5.4

six                          1.17.0

sniffio                      1.3.1

soupsieve                    2.6

starlette                    0.46.1

tenacity                     9.1.2

tiktoken                     0.9.0

tld                          0.13

tokenizers                   0.21.1

tomlkit                      0.13.2

tqdm                         4.67.1

trafilatura                  2.0.0

typer                        0.15.2

typing-extensions            4.13.1

typing-inspection            0.4.0

tzdata                       2025.2

tzlocal                      5.3.1

uritemplate                  4.1.1

urllib3                      2.3.0

uvicorn                      0.34.0

websockets                   15.0.1

zstandard                    0.23.0


(web-ui) C:\Users\vagrant\web-ui-agent\web-ui>



7. Install headless browser chromium:

playwright install --with-deps chromium


Output:

(web-ui) C:\Users\vagrant\web-ui-agent\web-ui>playwright install --with-deps chromium


Success Restart Needed Exit Code      Feature Result

------- -------------- ---------      --------------

True    No             Success        {Media Foundation}



8. Copy environment file containing google’s gemini flash llm api key:

copy <>\.env .env



Output:


(web-ui) C:\Users\vagrant\web-ui-agent\web-ui>


copy <>\.env .env


>> done


Directory of C:\Users\vagrant\web-ui-agent\web-ui


04/05/2025  01:24 AM    <DIR>          .

04/05/2025  01:12 AM    <DIR>          ..

04/05/2025  01:12 AM                 9 .dockerignore

04/04/2025  01:36 AM               153 .env << file exists

04/05/2025  01:12 AM             1,286 .env.example

04/05/2025  01:12 AM             3,603 .gitignore

04/05/2025  01:16 AM    <DIR>          .venv

04/05/2025  01:12 AM    <DIR>          .vscode

04/05/2025  01:12 AM    <DIR>          assets

04/05/2025  01:12 AM             2,426 docker-compose.yml

04/05/2025  01:12 AM             2,084 Dockerfile

04/05/2025  01:12 AM             2,112 Dockerfile.arm64

04/05/2025  01:12 AM               160 entrypoint.sh

04/05/2025  01:12 AM             1,094 LICENSE

04/05/2025  01:12 AM             9,506 README.md

04/05/2025  01:12 AM               156 requirements.txt

04/05/2025  01:12 AM             1,052 SECURITY.md

04/05/2025  01:12 AM    <DIR>          src

04/05/2025  01:12 AM             3,051 supervisord.conf

04/05/2025  01:12 AM    <DIR>          tests

04/05/2025  01:12 AM            48,145 webui.py

              14 File(s)         74,837 bytes

               7 Dir(s)  102,828,404,736 bytes free


(web-ui) C:\Users\vagrant\web-ui-agent\web-ui>



9. Launch the webui program:


python webui.py --ip 127.0.0.1 --port 7788


Launch webui: http://127.0.0.1:7788






No comments:

Post a Comment

Flashback data archive steps

 Objective: Ways to track DML changes in a table Detailed objective: We should be able to track the changes in the table at any point in tim...