Browser Tool
~3 min read
Concept & How It Works
Why Does It Exist?
Many tasks require interacting with web UIs that have no API — booking forms, admin dashboards, legacy portals. Browser tools bridge that gap.
Real-World Analogy
A browser tool is a remote intern with a mouse and keyboard who can use any website on your behalf.
Visual Workflows
What is Browser Tool?
Example
Scenario
An agent uses a browser tool to log into a vendor portal, download last month's invoice PDF, and attach it to an expense report.
Solution
In Tool Calling & Function Calling, apply Browser Tool to this scenario: An agent uses a browser tool to log into a vendor portal, download last month's invoice PDF, and attach it to an expense report. Identify the inputs, run the technique, validate the output, and note one thing you would monitor in production.
Practice Task
Do this before moving to the next module — reading alone is not enough.
Open the Code Walkthrough below and run it locally. Change one parameter related to Browser Tool (e.g. model, temperature, top_k, or tool name), observe the difference in output, and write 2–3 sentences explaining what changed.
Code Walkthrough
Highlighted lines show where Browser Tool happens in the code.
1from playwright.async_api import async_playwright # import dependencies2
3async def browse(url, action, selector=None, text=None):4 async with async_playwright() as p:5 browser = await p.chromium.launch(headless=True) # key line for Browser Tool6 page = await browser.new_page() # key line for Browser Tool7 await page.goto(url)8 if action == "click":9 await page.click(selector)10 elif action == "extract":11 return await page.inner_text(selector) # return the result12 await browser.close() # key line for Browser ToolCommands to Remember
Commands to Remember
client.chat.completions.create(..., tools=[...]) # pass tool schemas to APIjson.loads(response.choices[0].message.tool_calls[0].function.arguments) # parse tool argspip install pydantic # validate tool inputs with schemas
Common Mistakes
- Treating Browser Tool as a black box without evaluation
- Ignoring cost and latency in production
- Skipping error handling for browser tool
Cheat Sheet
Quick recap — the most important points from this module.
Cheat Sheet
quick ref- •Browser Tool
- •Playwright
- •Headless Browser
- •Accessibility Tree