MCPcopy
hub / github.com/huggingface/smolagents / run_webagent

Function run_webagent

src/smolagents/vision_web_browser.py:217–237  ·  view source on GitHub ↗
(
    prompt: str,
    model_type: str,
    model_id: str,
    provider: str | None = None,
    api_base: str | None = None,
    api_key: str | None = None,
)

Source from the content-addressed store, hash-verified

215
216
217def run_webagent(
218 prompt: str,
219 model_type: str,
220 model_id: str,
221 provider: str | None = None,
222 api_base: str | None = None,
223 api_key: str | None = None,
224) -> None:
225 # Load environment variables
226 load_dotenv()
227
228 # Initialize the model based on the provided arguments
229 model = load_model(model_type, model_id, provider=provider, api_base=api_base, api_key=api_key)
230
231 global driver
232 driver = initialize_driver()
233 agent = initialize_agent(model)
234
235 # Run the agent with the provided prompt
236 agent.python_executor("from helium import *")
237 agent.run(prompt + helium_instructions)
238
239
240def main() -> None:

Callers 2

mainFunction · 0.85

Calls 4

load_modelFunction · 0.90
initialize_driverFunction · 0.85
initialize_agentFunction · 0.85
runMethod · 0.80

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…