Skip to main content
This cookbook combines the browser agent and the Python runner from the code agent in one loop. Asked for the gap between two dates, Holo reads them off the page and leaves the arithmetic to Python.
This example runs model-written code on your machine with subprocess. Outside a demo, run it in a container or a sandbox with no network and no secrets.
1

Start from the browser agent

Install and save browser_agent.py, then make the edits below. Nothing else changes.
2

Add the runner

Import subprocess and sys, and register run_python next to the screen tools:
browser_agent.py
3

Route the call

Handle run_python first in execute, before the screen actions:
browser_agent.py
4

Update the prompt and task

browser_agent.py
5

Run it

Output

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 tools list. Route their names to session.call_tool.