Start from the browser agent
Install and save
browser_agent.py, then make the edits below. Nothing else changes.Add the runner
Import
subprocess and sys, and register run_python next to the screen tools:browser_agent.py
How it works
- One loop, one toolbox. The model sees every tool on every step and picks what the step needs. There is no router and no second agent.
- Screenshots keep coming. Every step still sends a fresh screenshot, including after
run_python, so the model keeps its view of the page. - More interfaces, same way. Tools from the MCP agent slot into the same
toolslist. Route their names tosession.call_tool.