@@ -58,7 +58,6 @@ async def run_browser_agent(
58
58
use_vision ,
59
59
max_actions_per_step ,
60
60
tool_call_in_content ,
61
- browser_context = None
62
61
):
63
62
# Disable recording if the checkbox is unchecked
64
63
if not enable_recording :
@@ -84,7 +83,6 @@ async def run_browser_agent(
84
83
base_url = llm_base_url ,
85
84
api_key = llm_api_key ,
86
85
)
87
-
88
86
if agent_type == "org" :
89
87
final_result , errors , model_actions , model_thoughts = await run_org_agent (
90
88
llm = llm ,
@@ -115,7 +113,7 @@ async def run_browser_agent(
115
113
max_steps = max_steps ,
116
114
use_vision = use_vision ,
117
115
max_actions_per_step = max_actions_per_step ,
118
- tool_call_in_content = tool_call_in_content ,
116
+ tool_call_in_content = tool_call_in_content
119
117
)
120
118
else :
121
119
raise ValueError (f"Invalid agent type: { agent_type } " )
@@ -144,7 +142,7 @@ async def run_org_agent(
144
142
max_steps ,
145
143
use_vision ,
146
144
max_actions_per_step ,
147
- tool_call_in_content ,
145
+ tool_call_in_content
148
146
):
149
147
browser = Browser (
150
148
config = BrowserConfig (
@@ -378,8 +376,7 @@ async def run_with_stream(
378
376
max_steps = max_steps ,
379
377
use_vision = use_vision ,
380
378
max_actions_per_step = max_actions_per_step ,
381
- tool_call_in_content = tool_call_in_content ,
382
- browser_context = _global_browser_context
379
+ tool_call_in_content = tool_call_in_content
383
380
)
384
381
)
385
382
@@ -467,6 +464,7 @@ def create_ui(theme_name="Ocean"):
467
464
border-radius: 10px;
468
465
}
469
466
"""
467
+
470
468
js = """
471
469
function refresh() {
472
470
const url = new URL(window.location);
@@ -615,11 +613,18 @@ def create_ui(theme_name="Ocean"):
615
613
616
614
with gr .TabItem ("🤖 Run Agent" , id = 4 ):
617
615
task = gr .Textbox (
616
+ label = "Task Description" ,
618
617
lines = 4 ,
618
+ placeholder = "Enter your task here..." ,
619
619
value = "go to google.com and type 'OpenAI' click search and give me the first url" ,
620
620
info = "Describe what you want the agent to do" ,
621
621
)
622
- add_infos = gr .Textbox (lines = 3 , label = "Additional Information" )
622
+ add_infos = gr .Textbox (
623
+ label = "Additional Information" ,
624
+ lines = 3 ,
625
+ placeholder = "Add any helpful context or instructions..." ,
626
+ info = "Optional hints to help the LLM complete the task" ,
627
+ )
623
628
624
629
with gr .Row ():
625
630
run_button = gr .Button ("▶️ Run Agent" , variant = "primary" , scale = 2 )
@@ -705,7 +710,7 @@ def list_recordings(save_recording_path):
705
710
outputs = save_recording_path
706
711
)
707
712
708
- # Button logic
713
+ # Run button click handler
709
714
run_button .click (
710
715
fn = run_with_stream ,
711
716
inputs = [
@@ -727,8 +732,6 @@ def list_recordings(save_recording_path):
727
732
728
733
return demo
729
734
730
-
731
- # Update the main function to handle cleanup
732
735
def main ():
733
736
parser = argparse .ArgumentParser (description = "Gradio UI for Browser Agent" )
734
737
parser .add_argument ("--ip" , type = str , default = "127.0.0.1" , help = "IP address to bind to" )
0 commit comments