Skip to main content
This page documents the gRPC service definitions and Protocol Buffer schemas that form the communication backbone of the Palyra platform. These schemas facilitate type-safe, cross-language interactions between the Core Daemon (palyrad), the CLI, the Browser Daemon (palyra-browserd), and various SDKs.

Overview of Protocol Architecture

Palyra utilizes Protocol Buffers (proto3) to define its service interfaces and data models. The schemas are organized within schemas/proto/palyra/v1/ and are used to generate language-specific stubs for Rust, Kotlin, and Swift.

Core Service Components

The protocol is divided into several specialized services, each responsible for a distinct domain of the platform:
ServiceResponsibility
GatewayServiceCentral orchestrator for runs, session resolution, and agent management.
ApprovalsServiceManagement and export of human-in-the-loop approval records.
VaultServiceSecure storage, retrieval, and deletion of encrypted secrets.
BrowserServiceAutomation and inspection of headless Chromium instances.
AuthServiceManagement of authentication profiles and provider health.
MemoryServiceIngestion and retrieval of long-term agent memory.
NodeServiceCoordination with remote execution nodes and capabilities.
CronServiceScheduling and execution of recurring background routines.
Sources: schemas/proto/palyra/v1/gateway.proto#7-29, schemas/proto/palyra/v1/gateway.proto#31-35, schemas/proto/palyra/v1/gateway.proto#37-42, schemas/proto/palyra/v1/browser.proto#7-42.

Service Definitions

Gateway and Orchestration

The GatewayService is the primary entry point for the palyra-daemon. It manages the RunStream, which is a bidirectional gRPC stream used for real-time agent execution and event propagation. Service Mapping: Natural Language to Code Entities Sources: schemas/proto/palyra/v1/gateway.proto#7-29, schemas/proto/palyra/v1/gateway.proto#9-10.

Browser Automation

The BrowserService (defined in browser.proto) exposes the capabilities of palyra-browserd. It allows the daemon or CLI to perform complex web automation tasks, ranging from simple navigation to multi-tab session management with persistent profiles. Browser Interaction Flow Sources: schemas/proto/palyra/v1/browser.proto#7-42, schemas/proto/palyra/v1/browser.proto#76-107, schemas/proto/palyra/v1/browser.proto#227-242.

Approvals and Security

Security-sensitive actions (like tool execution or secret access) are gated by the ApprovalsService. When a run requires an approval, it creates an ApprovalRecord schemas/proto/palyra/v1/gateway.proto#85-106.

Common Types and Versioning

The palyra.common.v1 package (imported in most proto files) provides shared primitives used across all services:

Stub Generation and Validation

Palyra uses a centralized generation strategy to ensure all clients remain in sync with the daemon’s protocol.

Rust Generation

Rust stubs are generated during the build process of palyra-cli and palyra-daemon using tonic-prost-build.

Cross-Language Stubs

For mobile and external integration, a PowerShell script scripts/protocol/generate-stubs.ps1 parses the .proto files to generate lightweight stubs in:

Validation Pipeline

The integrity of the protocol is enforced via several validation scripts:
  1. Schema Validation: scripts/protocol/validate-proto.ps1 uses protoc to ensure all .proto files are syntactically correct and imports are resolvable scripts/protocol/validate-proto.ps1#56-66.
  2. Stub Consistency: scripts/protocol/check-generated-stubs.ps1 verifies that the generated code in schemas/generated/ matches the source .proto files, failing the CI if they are out of sync scripts/protocol/check-generated-stubs.ps1#14-21.
  3. Compilation Checks: Language-specific scripts like scripts/protocol/validate-swift-stubs.sh and scripts/protocol/validate-kotlin-stubs.ps1 attempt to compile the generated stubs to catch type-naming collisions or syntax errors in the generator scripts/protocol/validate-swift-stubs.sh#20-21, scripts/protocol/validate-kotlin-stubs.ps1#24-30.
Sources: scripts/protocol/generate-stubs.ps1#82-91, scripts/protocol/validate-proto.ps1#6-8, crates/palyra-daemon/build.rs#1-38, crates/palyra-cli/build.rs#1-38.