Skip to main content
This page documents the Protocol Buffer service definitions and message schemas that form the contract between Palyra components. These definitions are used to generate stubs for Rust, Kotlin, and Swift, ensuring cross-language consistency across the daemon, CLI, mobile clients, and browser automation layers schemas/generated/rust/protocol_stubs.rs#1-7.

Overview of Services

Palyra’s communication architecture is built on top of gRPC (for internal and node-to-node communication) and JSON envelopes (for Web Console and A2UI). The .proto files define the RPC methods, request/response structures, and core domain entities like CanonicalId, ApprovalRecord, and BrowserSession.

Core Service Architecture

The following diagram illustrates how the major Protobuf services map to the codebase entities and their interactions. Service to Code Entity Mapping Sources: schemas/proto/palyra/v1/gateway.proto#7-51, schemas/proto/palyra/v1/browser.proto#7-42, crates/palyra-daemon/src/transport/grpc/services/gateway/service.rs#50-59

1. Gateway & Control Plane Services

The Gateway is the primary entry point for agent orchestration and state management. It is defined in palyra/v1/gateway.proto.

GatewayService

Manages the lifecycle of agent “Runs” and sessions.

ApprovalsService

Provides an interface for managing human-in-the-loop (HITL) requirements.

VaultService

Handles encrypted secret management. Sources: schemas/proto/palyra/v1/gateway.proto#1-255, crates/palyra-daemon/src/transport/grpc/services/gateway/service.rs#76-166

2. Browser Automation Service

The BrowserService (defined in palyra/v1/browser.proto) facilitates high-level browser interaction, enforced by security budgets.

Browser Session Lifecycle

The service manages BrowserSession objects which wrap Chromium instances.
MethodDescriptionSecurity Constraint
CreateSessionSpawns a new browser contextSessionBudget enforced schemas/proto/palyra/v1/browser.proto#76-91
NavigateMoves to a URLaction_allowed_domains check schemas/proto/palyra/v1/browser.proto#19-19
ObserveCaptures accessibility tree/DOMmax_observe_snapshot_bytes schemas/proto/palyra/v1/browser.proto#29-29
RelayActionCommunicates with the Browser ExtensionLoopback-only transport schemas/proto/palyra/v1/browser.proto#40-40

Data Flow: Browser Action

Sources: schemas/proto/palyra/v1/browser.proto#7-42, schemas/proto/palyra/v1/browser.proto#57-74

3. Auth and Identity Services

The AuthService manages model provider credentials and health. Sources: schemas/generated/rust/protocol_stubs.rs#7-59, schemas/generated/kotlin/ProtocolStubs.kt#4-34

4. Shared Common Types

The palyra.common.v1 package contains primitive types used across all services to ensure interoperability. Sources: schemas/proto/palyra/v1/gateway.proto#5-5, crates/palyra-daemon/src/transport/grpc/services/gateway/service.rs#161-165

5. Generated Stubs and Parity

To maintain strict contract adherence, stubs are generated for multiple languages. These stubs are checked during CI to ensure they match the .proto source.

Implementation Status by Language

LanguageStub LocationPrimary Usage
Rustprotocol_stubs.rspalyrad and palyra CLI schemas/generated/rust/protocol_stubs.rs#1-5
KotlinProtocolStubs.ktAndroid / JVM Mobile Client schemas/generated/kotlin/ProtocolStubs.kt#1-4
SwiftProtocolStubs.swiftiOS / macOS Desktop Client schemas/generated/swift/ProtocolStubs.swift#1-3

Protocol Versioning

All services enforce a PROTOCOL_MAJOR_VERSION check (currently 1). Requests with mismatched major versions are rejected with FAILED_PRECONDITION crates/palyra-daemon/src/transport/grpc/services/gateway/service.rs#102-104. Sources: schemas/generated/rust/protocol_stubs.rs#5-5, schemas/generated/kotlin/ProtocolStubs.kt#1-3, schemas/generated/swift/ProtocolStubs.swift#1-2