Skip to main content
This is the browser agent loop with two changes: no screenshots, and one tool, run_python. Holo writes a script, runs it, reads the output, and answers. Each run’s output goes back as a tool message.
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

Save the agent

Install with pip install openai and export HAI_API_KEY, then save:
code_agent.py
2

Run it

Output

How it works

  • Output cap. Each result keeps the last 4,000 characters, so a runaway print cannot flood the context.
  • Errors are feedback. stderr goes back with stdout: Holo reads the traceback and fixes it next step.
  • Timeouts. run_python kills each script after 30 seconds and tells Holo. Raise the timeout for heavier jobs.
The same pattern fits any runner (bash, a Jupyter kernel, a remote sandbox): one tool per runtime, described in plain words.