Automation Mode
Automation mode is for automated test harnesses that need to launch Guida, attach to WebView2 through CDP, open a workspace, create tabs, wait for readiness, and shut the app down deterministically.
It is separate from the Operational Dashboard API and Remote Ops API. Dashboard endpoints are read-only monitoring endpoints. Remote Ops is an explicitly enabled trusted-channel control API for live nodes. Automation endpoints are for deterministic test harnesses and are available only when Guida is launched with --automation.
Launch switches
Section titled “Launch switches”Automation-only switches are accepted only when --automation is present.
| Switch | Purpose |
|---|---|
--automation | Enables automation mode |
--workspace <path> | Opens a workspace at startup |
--webview-user-data-dir <path> | Uses a specific WebView2 profile directory |
--cdp-port <port> | Exposes WebView2 Chrome DevTools Protocol on the given port |
--dashboard-host <address> | Overrides the embedded server bind address |
--dashboard-port <port> | Overrides the embedded server port |
--automation-token <token> | Sets the token required by /api/automation/* requests |
If no WebView2 user-data directory is supplied, Guida creates an isolated temporary automation profile. If no automation token is supplied, Guida generates one and writes it to the Console.
Example:
Guida.exe --automation ` --workspace C:\dev\btbrowser-workspace ` --webview-user-data-dir C:\temp\guida-webview ` --cdp-port 9222 ` --dashboard-host 127.0.0.1 ` --dashboard-port 9315 ` --automation-token test-tokenCDP passthrough
Section titled “CDP passthrough”Use --cdp-port when a Playwright-style harness needs to connect to the underlying WebView2 browser through Chrome DevTools Protocol.
CDP gives the harness browser-level inspection and automation. The Guida automation API covers Guida-specific operations such as opening workspaces, creating Guida tabs, activating tabs, waiting for readiness, and shutting down the app.
Authentication
Section titled “Authentication”Automation endpoints require either header form:
X-Guida-Automation-Token: test-tokenor:
Authorization: Bearer test-tokenWhen automation mode is disabled, /api/automation/* endpoints return 404. When automation mode is enabled but the token is missing or wrong, requests are rejected.
Endpoints
Section titled “Endpoints”All endpoints are under /api/automation.
| Endpoint | Purpose |
|---|---|
GET /api/automation/status | Returns workspace, active workflow, active tab, and tab count |
GET /api/automation/session | Opens an SSE heartbeat stream for harness lifecycle checks |
POST /api/automation/workspace | Opens a workspace from { "path": "..." } |
GET /api/automation/tabs | Lists Guida tabs visible to the harness |
POST /api/automation/tabs | Creates a tab from { "name": "...", "url": "...", "activate": true, "waitForLoad": true } |
POST /api/automation/tabs/{tabId}/activate | Activates an existing tab |
GET /api/automation/tabs/active/ready | Waits for the active tab to be ready; supports timeoutMs |
POST /api/automation/shutdown | Requests Guida shutdown |
Typical harness flow
Section titled “Typical harness flow”- Launch Guida with
--automation, a dashboard port, and a known automation token. - Call
GET /api/automation/statusuntil Guida is reachable. - Open a workspace if one was not supplied at launch.
- Create or activate a Guida tab.
- Wait for
GET /api/automation/tabs/active/ready. - Connect the browser harness to the CDP port when browser-level automation is needed.
- Call
POST /api/automation/shutdownduring teardown.
Safety notes
Section titled “Safety notes”Keep automation mode local or inside a trusted test environment. Unlike the dashboard API, automation endpoints can open workspaces, create and activate tabs, and shut Guida down.
Remote private-network access without control should use the read-only Operational Dashboard API instead. Remote private-network control for operator tools should use Remote Ops API, not Automation Mode.
Next steps
Section titled “Next steps”- Operational Dashboard API - read-only monitoring endpoints
- Remote Ops API - trusted-channel remote control for live Guida nodes
- MCP Integration - local AI tool access, approvals, and audit logging
- Browser & DOM API - browser automation from Guida scripts