-
Notifications
You must be signed in to change notification settings - Fork 909
Open
Description
Hi, I was running an automation to this site http://149.102.131.110:8000 as a test for an agent on Steel cloud. I was using browser-use and the agent would timeout before the website was fully loaded (Looks like it was loading a lot of images). I have to add a longer timeout or more retries for the site to fully load, and sometimes it won't load even with that. Maybe this is something that can be solved by region as when I run on the playground it loaded a little faster.
Obviously headless browser in the cloud vs local browser will have major differences but my local browser loaded everything quite quickly. Wondering if you have seen this before or any tips for faster loading, or any idea of who to better ask this question to?
from langchain_google_genai import ChatGoogleGenerativeAI
import asyncio
from pydantic.types import SecretStr
from steel import Steel
from browser_use import Agent, BrowserSession, Controller, BrowserProfile
# from langchain_openai import ChatOpenAI
import os
# Initialize the Steel client with API key,
# Replace "YOUR_STEEL_API_KEY" with your actual API key,
client = Steel(steel_api_key=os.getenv("STEEL_API_KEY"))
# # Create a Steel session,
print("Creating Steel session...")
session = client.sessions.create()
print(f"Session created at {session.session_viewer_url}")
# Connect browser-use to Steel,
# Replace YOUR_STEEL_API_KEY with your actual API key,
cdp_url = f"wss://connect.steel.dev?apiKey={os.getenv('STEEL_API_KEY')}&sessionId={session.id}"
model = ChatGoogleGenerativeAI(
model="gemini-2.0-flash-exp",
temperature=0.3,
api_key=SecretStr(os.getenv('GEMINI_API_KEY') or "")
)
task = "Go to http://149.102.131.110:8000, authenticate with username 'user222' and password 'password123' to log in successfully"
prompt = f"If you do not see what you need to interact with, scroll down. If there is ambiguity in the following task, do only what is asked and nothing more. Task: {task}"
# If this is added then it occasionally will work
profile = BrowserProfile(
timeout=300000,
maximum_wait_page_load_time=30.0,
wait_for_network_idle_page_load_time=10000,
)
agent = Agent(
task=prompt,
llm=model,
browser_session=BrowserSession(cdp_url=cdp_url),
browser_profile=profile,
controller=Controller(exclude_actions=['search_google', 'switch_tab', 'close_tab', 'extract_content']),
)
async def main():
# Run the agent
print("Running the agent...")
history = await agent.run()
print("Actions: ", history.action_names())
model_actions = history.model_actions()
print("Model Actions: ", model_actions)
parsed_actions = []
print("Model Actions:", history.model_actions())
print("Task completed!")
# Clean up resources,
if session:
client.sessions.release(session.id)
print("Session released")
print("Done!")
# Run the async main function,
if __name__ == '__main__':
asyncio.run(main())Metadata
Metadata
Assignees
Labels
No labels