Code:
ximport asyncioimport os
from langchain_openai import ChatOpenAIfrom browser_use import Agentfrom dotenv import load_dotenv
load_dotenv()sensitive_data = { "LASA_USERNAME": os.environ["LASA_USERNAME"], "LASA_PASSWORD": os.environ["LASA_PASSWORD"],}
async def main(): agent = Agent( task="Go to lasa.org and login to the online payment portal using LASA_USERNAME and LASA_PASSWORD. Then proceed to make a payment using the existing payment method.", llm=ChatOpenAI(model="gpt-4o"), sensitive_data=sensitive_data, ) await agent.run()
asyncio.run(main())Output:
xxxxxxxxxxkym@mbp-14 bill-pay % uv run src/main.pyINFO [browser_use] BrowserUse logging setup complete with level infoINFO [telemetry] Anonymized telemetry enabled. See https://docs.browser-use.com/development/telemetry for more information./Users/kym/repos/bill-pay/.venv/lib/python3.13/site-packages/browser_use/agent/service.py:321: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.htmlimport pkg_resourcesINFO [agent] 🧠 Starting an agent with main_model=gpt-4o +tools +vision, planner_model=None, extraction_model=gpt-4oINFO [agent] 🚀 Starting task: Go to lasa.org and login to the online payment portal using LASA_USERNAME and LASA_PASSWORD. Then proceed to make a payment using the existing payment method.INFO [agent] 📍 Step 1INFO [agent] 🤷 Eval: Unknown - The task has just started and no significant actions have been taken yet.INFO [agent] 🧠 Memory: Initiating the task to access lasa.org and login. Current step 1/100.INFO [agent] 🎯 Next goal: Navigate to lasa.org to begin the login process.INFO [agent] 🛠️ Action 1/1: {"go_to_url":{"url":"https://www.lasa.org"}}INFO [controller] 🔗 Navigated to https://www.lasa.orgINFO [agent] 📍 Step 2INFO [agent] 👍 Eval: Success - Landed on the LASA homepage.INFO [agent] 🧠 Memory: Navigated to LASA homepage. Current step: 2/100. Next: Access online payment portal.INFO [agent] 🎯 Next goal: Click on 'Online Payment & Access' to proceed to login to the payment portal.INFO [agent] 🛠️ Action 1/1: {"click_element_by_index":{"index":20}}INFO [controller] 🖱️ Clicked button with index 20: Online Payment & AccessINFO [agent] 📍 Step 3INFO [agent] 👍 Eval: Success - Clicked to reach the billing and payment page.INFO [agent] 🧠 Memory: Reached the billing and payment page. Current step: 3/100. Plan to go to 'Online Bill Payment'.INFO [agent] 🎯 Next goal: Find and click on 'Online Bill Payment or Check Account Status' to proceed to login page.INFO [agent] 🛠️ Action 1/1: {"click_element_by_index":{"index":39}}INFO [controller] 🖱️ Clicked button with index 39: Online Bill Payment or Check Account StatusINFO [agent] 📍 Step 4INFO [agent] 👍 Eval: Success - Reached the online login page for Civic Pay.INFO [agent] 🧠 Memory: Navigated to Civic Pay login page. Current step: 5/100. Objective: Login using LASA credentials.INFO [agent] 🎯 Next goal: Input LASA_USERNAME and LASA_PASSWORD in the corresponding fields on the login page.INFO [agent] 🛠️ Action 1/1: {"switch_tab":{"page_id":1}}INFO [controller] 🔄 Switched to tab 1INFO [agent] 📍 Step 5INFO [agent] 👍 Eval: Success - Ready to input login details on the Civic Pay login page.INFO [agent] 🧠 Memory: On Civic Pay login page. Prepared to enter credentials. Current step: 6/100.INFO [agent] 🎯 Next goal: Enter LASA_USERNAME and LASA_PASSWORD in respective fields and submit.INFO [agent] 🛠️ Action 1/3: {"input_text":{"index":1,"text":"<secret>LASA_USERNAME</secret>"}}INFO [agent] 🛠️ Action 2/3: {"input_text":{"index":2,"text":"<secret>LASA_PASSWORD</secret>"}}INFO [agent] 🛠️ Action 3/3: {"click_element_by_index":{"index":4}}INFO [controller] ⌨️ Input sensitive data into index 1INFO [controller] ⌨️ Input sensitive data into index 2INFO [controller] 🖱️ Clicked button with index 4: Log InINFO [agent] 📍 Step 6INFO [agent] 👍 Eval: Success - Logged in to CivicPay and landed on the account home page.INFO [agent] 🧠 Memory: Logged into CivicPay. Ready to make a payment using the existing method. Current step: 7/100.INFO [agent] 🎯 Next goal: Proceed to make a payment by clicking the 'Pay Now' button.INFO [agent] 🛠️ Action 1/1: {"click_element_by_index":{"index":15}}INFO [controller] 🖱️ Clicked button with index 15: Pay NowINFO [agent] 📍 Step 7INFO [agent] 👍 Eval: Success - Reached payment details. Ready to make a payment.INFO [agent] 🧠 Memory: On payment page with payment details ready. Current step: 8/100.INFO [agent] 🎯 Next goal: Submit the payment using the existing payment method by clicking 'Make Payment' button.INFO [agent] 🛠️ Action 1/1: {"click_element_by_index":{"index":18}}INFO [controller] 🖱️ Clicked button with index 18: Make PaymentINFO [agent] 📍 Step 8INFO [agent] 👍 Eval: Success - Reached the payment completion page.INFO [agent] 🧠 Memory: Ready to complete the payment using existing payment method. Current step: 8/100.INFO [agent] 🎯 Next goal: Finalize the payment by clicking the 'Complete Payment' button.INFO [agent] 🛠️ Action 1/1: {"click_element_by_index":{"index":18}}INFO [controller] 🖱️ Clicked button with index 18: Complete PaymentINFO [agent] 📍 Step 9INFO [agent] ⚠ Eval: Failed - Payment method selection was not completed as required.INFO [agent] 🧠 Memory: Attempted to submit the payment but failed due to lack of payment method selection. Step 9/100.INFO [agent] 🎯 Next goal: Select existing payment method checkbox and resubmit the payment.INFO [agent] 🛠️ Action 1/2: {"click_element_by_index":{"index":15}}INFO [agent] 🛠️ Action 2/2: {"click_element_by_index":{"index":18}}INFO [controller] 🖱️ Clicked button with index 15: Use Existing Payment MethodINFO [agent] Element index changed after action 1 / 2, because page changed.INFO [agent] 📍 Step 10INFO [agent] ⚠ Eval: Failed - Previously, it was not possible to complete the payment because a payment method was not selected.INFO [agent] 🧠 Memory: Need to select the payment method. On the Make Payment page. Step 10/100.INFO [agent] 🎯 Next goal: Select the existing payment method checkbox and click 'Complete Payment'.INFO [agent] 🛠️ Action 1/2: {"click_element_by_index":{"index":17}}INFO [agent] 🛠️ Action 2/2: {"click_element_by_index":{"index":19}}INFO [controller] 🖱️ Clicked button with index 17: My Checking Account (Electronic Check ending in : 9893)INFO [controller] 🖱️ Clicked button with index 19: Complete PaymentINFO [agent] 📍 Step 11INFO [agent] 👍 Eval: Success - The payment has been successfully processed using the existing method.INFO [agent] 🧠 Memory: Payment of $125.40 completed successfully using account ending in 9893. Confirmation page is displayed. Step 11/100.INFO [agent] 🎯 Next goal: Complete the task as the main objective is achieved.INFO [agent] 🛠️ Action 1/1: {"done":{"text":"Successfully logged in to CivicPay and made a payment of $125.40 using the existing payment method (Account ending in 9893). Confirmation details are displayed and payment was processed successfully.","success":true}}INFO [agent] 📄 Result: Successfully logged in to CivicPay and made a payment of $125.40 using the existing payment method (Account ending in 9893). Confirmation details are displayed and payment was processed successfully.INFO [agent] ✅ Task completedINFO [agent] ✅ SuccessfullyINFO [agent] 📝 Total input tokens used (approximate): 53036