Skip to main content
The palyra-browserd daemon provides a secure, high-fidelity browser automation environment for Palyra agents. It abstracts complex browser interactions into a gRPC service, offering two distinct execution modes: a high-fidelity Chromium engine and a lightweight Simulated engine.

System Architecture

The browser subsystem consists of three layers: the CLI/Console (user-facing control), the Daemon Tool Runtime (agent-facing broker), and the Browser Daemon (the execution engine).

Data Flow: Agent to Browser

  1. An agent proposes a palyra.browser.* tool call.
  2. The palyra-daemon validates the request and brokers it via execute_browser_tool crates/palyra-daemon/src/application/tool_runtime/browser.rs#11.
  3. The daemon calls the BrowserService gRPC interface on palyra-browserd crates/palyra-browserd/src/transport/grpc/service.rs#1.
  4. palyra-browserd executes the action in the requested engine (Chromium or Simulated).
  5. Results are redacted, budgeted, and returned through the chain.

Code Entity Map: Browser Service

The following diagram maps the gRPC service implementation to its underlying domain and engine entities. Sources: crates/palyra-browserd/src/transport/grpc/service.rs#53-57, crates/palyra-browserd/src/domain/downloads.rs#44-50, crates/palyra-browserd/src/engine/chromium.rs#1-6

Engine Modes

palyra-browserd supports two engines to balance resource usage and fidelity.
FeatureChromium EngineSimulated Engine
BackendHeadless Chrome via CDPreqwest HTTP Client
JS ExecutionFull (V8)None (Static HTML)
IsolationProcess-per-sessionShared async runtime
Best ForSPAs, Complex UI, InteractionFast scraping, Static content
Capability Tagjavascript_execution: truejavascript_execution: false
The BrowserRuntimeCapabilities struct is attached to every tool outcome to ensure agents do not mistake static HTML for a functional JS application crates/palyra-daemon/src/application/tool_runtime/browser.rs#113-121. Sources: crates/palyra-browserd/src/engine/chromium.rs#1-6, crates/palyra-daemon/src/application/tool_runtime/browser.rs#108-121

Security and SSRF Protection

Browser automation is a high-risk vector for Server-Side Request Forgery (SSRF). palyra-browserd implements several layers of defense.

DNS Pinning and Validation

To prevent DNS rebinding attacks, palyra-browserd resolves hostnames and validates them against a private/local IP policy before the browser or HTTP client initiates a connection crates/palyra-browserd/src/security/target_validation.rs#3-7. The navigate_with_guards function enforces policies on every navigation and redirect crates/palyra-browserd/src/support/tests.rs#9. Sources: crates/palyra-browserd/src/security/target_validation.rs#1-35, crates/palyra-browserd/src/transport/grpc/service.rs#12-18, crates/palyra-daemon/src/transport/http/handlers/console/browser.rs#27-34

Session and Profile Management

BrowserProfileRecord

Profiles provide durable storage for cookies, localStorage, and session state.

BrowserSessionRecord

A session represents a live instance of an engine. Sources: crates/palyra-browserd/src/app/config.rs#10-31, crates/palyra-browserd/src/app/config.rs#59-63

Diagnostics and Artifacts

Script Injection

For Chromium sessions, palyra-browserd injects the CHROMIUM_PAGE_DIAGNOSTICS_SCRIPT into every page crates/palyra-browserd/src/engine/chromium.rs#183. This hook:
  1. Wraps console.log, fetch, and XMLHttpRequest.
  2. Buffers entries in a global window.__palyraDiagnostics object crates/palyra-browserd/src/engine/chromium.rs#185.
  3. Allows the daemon to “drain” logs even if the page crashes or navigates.

Download Quarantine

Captured downloads are managed by the DownloadSandboxSession crates/palyra-browserd/src/domain/downloads.rs#44.

Redaction and Budgeting

All data returned to the agent is sanitized: Sources: crates/palyra-browserd/src/engine/chromium.rs#183-222, crates/palyra-browserd/src/domain/downloads.rs#44-50, crates/palyra-browserd/src/domain/downloads.rs#132-137, crates/palyra-browserd/src/app/config.rs#88-95

Daemon-Side Tool Runtime

The palyra-daemon implements the palyra.browser.* tool family by proxying to browserd. Sources: crates/palyra-daemon/src/application/tool_runtime/browser.rs#11-65, crates/palyra-browserd/src/engine/chromium.rs#1-6

Key Functions

Sources: crates/palyra-daemon/src/application/tool_runtime/browser.rs#11-126