If you don’t want to run your own browser harness/session, use our managed browser runner instead:
What is Glance?
Glance is Morph’s UI testing model: It takes in context on your PR and any natural language instructions on something specific that needs to be tested. This is the right API when you want to own the browser session and harness (Playwright, Selenium, Browserbase, Steel, etc.) but still use Morph’s model for step-by-step decisions.When to use it
- Bring-your-own harness: you already have a browser runner and want the model as a “brain”.
- Full control: you need custom tools, custom execution, or custom infra.
- Stateful sessions: you want Morph to keep a server-side plan + step history and you just send observations.
API (what goes in, what comes out)
Glance is exposed as a stateful harness session API:- Create session:
POST /harness/sessions - Next step:
POST /harness/sessions/{session_id}/step
What you send
- Session creation:
url,diff,instructions, and optionaltools(GeminifunctionDeclarations). - Each step:
screenshot: base64 PNG/JPEGcontext: optional metadata likecurrent_url,page_title, viewportclient_step_id: optional idempotency key (recommended)
What you get back
step_index: 0-based index assigned by the server (useful for logging + ordering)tool_calls: the tool calls to execute in your harnessis_done: whether the session is completedone_reason: optional completion reason
tool_calls → take a new screenshot → call /step again.
Tool definitions (Gemini functionDeclarations)
You provide tools as a list of “function declarations”: name, description, and a JSON-schema-like parameters object.
Here’s a minimal set that works well for browser harnesses:
Minimal example (JavaScript)
This shows the full loop at a high level (your harness executes the tools and captures screenshots):Quick start (cURL)
Response format
Each step returns:step_index: 0-based index assigned by the servertool_calls: list of tool calls to execute in your harnessis_done: whether the session should stopdone_reason: optional stop explanation
Notes
- Idempotency: send
client_step_idso retries don’t create duplicate steps. - Statefulness: sessions store a hidden plan and step history server-side; you only send observations.
- browser-use: if you want the browser-use Python SDK agent interface, see Using Morph with browser-use.