Requirements
Install Harnest by following Install if
harnest --version is unavailable.
You do not need to install Python or Playwright locally.
harnest env sync creates the isolated agent environment and installs Harnest’s managed framework runtime. The Dockerfile installs Playwright and Chromium in the sandbox image, so the agent’s pyproject.toml needs no browser dependency.Create the browser image
Add a pinned Playwright build context. The underscore keeps the image directory out of sandbox discovery while Harnest still includes it in the compiled source artifact. Build it before serving the agent:sandbox/_chrome_image/Dockerfile
Declare the sandbox
Createsandbox/chrome.py. Browser navigation needs network access, so this sandbox opts in with network=True and uses larger memory, process, and scratch budgets than the calculation example.
sandbox/chrome.py
Add the browser tool
Createtools/browse_page.py. Keep the allowlist narrow. This example allows only example.com and playwright.dev, and applies the same policy to redirects and subresources inside the browser.
tools/browse_page.py
Assign the sandbox
Addchrome to the agent’s sandbox grants:
agent.py
instructions.md
Run the example
1
Verify Harnest
2
Start Docker
Check that the daemon is available:
3
Set the model credential
Export the key in the same shell that will run the server:Keep secrets out of
config.yaml, source files, and the browser image. The example’s checked-in configuration already sets OPENAI_MODEL and OPENAI_BASE_URL.4
Build the browser image
From the agent project directory, run:The Playwright image is large, so its first build can take a few minutes.
5
Create and test the agent environment
env sync creates the isolated environment and resolves the managed ADK version. test validates the project without starting the browser container.6
Serve the agent
http://127.0.0.1:8080/ and ask: “Read https://example.com and tell me what it is for.”image to its immutable registry reference.
See Sandboxing for scope, resource, cleanup, custom provider, and framework behavior.