Skip to main content
This page documents the Protocol Buffer service definitions and message schemas that form the backbone of Palyra’s communication layer. These definitions facilitate type-safe interaction between the core daemon (palyrad), the browser automation service (palyra-browserd), and various clients including the CLI, Web Console, and Desktop application.

Protocol Versioning Strategy

Palyra uses a strict versioning scheme to ensure compatibility across its distributed components. The core of this system is the PROTOCOL_MAJOR_VERSION, which is incremented whenever breaking changes are introduced to the message structures or RPC signatures.

Service Architecture Overview

The protocol is divided into functional domains, each represented by a .proto file. These are compiled into language-specific stubs for Rust, Kotlin (Android), and Swift (iOS/macOS) schemas/generated/rust/protocol_stubs.rs#1-1, schemas/generated/kotlin/ProtocolStubs.kt#1-1, schemas/generated/swift/ProtocolStubs.swift#1-1.

Core Service Mapping

The following diagram maps the logical service definitions to their implementation entities within the palyrad daemon. Diagram: Service Definition to Implementation Mapping Sources: schemas/proto/palyra/v1/gateway.proto#7-51, crates/palyra-daemon/src/gateway.rs#41-44

Gateway Service (gateway.proto)

The GatewayService is the primary entry point for agent orchestration and session management. It handles the lifecycle of “Runs” and message routing.

Key RPCs

Approval Subsystem

The ApprovalsService provides access to the audit log of security decisions. Sources: schemas/proto/palyra/v1/gateway.proto#7-166, crates/palyra-daemon/src/gateway.rs#56-71

Browser Service (browser.proto)

The BrowserService defines the interface for palyra-browserd, the headless automation engine. It focuses on session-based web interaction with strict resource budgeting.

Session Management and Budgeting

Every browser session is governed by a SessionBudget to prevent resource exhaustion.

Interaction RPCs

The service provides granular control over the Chromium instance: Sources: schemas/proto/palyra/v1/browser.proto#7-168

Supporting Services

Cron Service (cron.proto)

Manages scheduled routines.

Memory Service (memory.proto)

Handles long-term storage and vector search for agent context.

Vault Service (gateway.proto)

Provides a secure K/V store for secrets.

Data Flow: Message Routing

The following diagram illustrates how a RouteMessageRequest flows from a protocol definition into the daemon’s internal logic. Diagram: RouteMessage Data Flow Sources: schemas/proto/palyra/v1/gateway.proto#16-16, crates/palyra-daemon/src/gateway.rs#50-54, crates/palyra-daemon/src/journal.rs#63-71

Common Message Types (common.proto)

The common.proto file defines primitive types used across all services to maintain consistency.
TypePurposeReference
CanonicalIdA standardized ULID-based identifier for entities.schemas/proto/palyra/v1/gateway.proto#87-89
MessageAttachmentDefines files or media attached to messages.crates/palyra-daemon/tests/gateway_grpc.rs#134-134
ApprovalPromptThe UI schema for requesting user approval.schemas/proto/palyra/v1/gateway.proto#101-101
RunStreamEventThe polymorphic event type for orchestrator updates.schemas/proto/palyra/v1/gateway.proto#10-10
Sources: schemas/proto/palyra/v1/common.proto#1-10, crates/palyra-daemon/src/gateway.rs#22-22