palyra.v1 namespaces for all services schemas/generated/rust/protocol_stubs.rs#5-7.
Service Architecture Overview
The Palyra protocol is divided into several specialized services, each responsible for a specific domain of the agentic runtime. The daemon acts as the central hub, implementing theGatewayService, ApprovalsService, and VaultService, while delegating browser-specific tasks to palyra-browserd via the BrowserService.
Code Entity Mapping
The following diagram bridges the natural language service names to their specific Protobuf definitions and generated implementation traits. Diagram: Protocol Service to Code Entity Mapping Sources: schemas/proto/palyra/v1/gateway.proto#7-29, schemas/proto/palyra/v1/browser.proto#7-42, schemas/generated/rust/protocol_stubs.rs#52-58.1. GatewayService
TheGatewayService is the primary entry point for agent orchestration and session management. It handles the lifecycle of “Runs” and manages the binding of Agents to specific execution contexts.
| RPC Method | Description |
|---|---|
RunStream | A bidirectional stream for executing agent instructions and receiving real-time events (logs, tool calls, status). |
AppendEvent | Manually appends events to a session’s journal for state synchronization. |
RouteMessage | Routes incoming messages from channel connectors to the appropriate agent session. |
BindAgentForContext | Associates a specific Agent ID with a principal/channel context. |
2. ApprovalsService
Manages human-in-the-loop (HITL) workflows. It allows external interfaces (like the Web Console) to list, inspect, and export security-sensitive actions requiring explicit authorization.- Key Data Structure:
ApprovalRecordschemas/proto/palyra/v1/gateway.proto#85-106 - Subject Types: Supports approvals for
TOOL,CHANNEL_SEND,SECRET_ACCESS,BROWSER_ACTION, andDEVICE_PAIRINGschemas/proto/palyra/v1/gateway.proto#53-61.
3. BrowserService
Implemented bypalyra-browserd, this service provides a high-level API for headless browser automation. It abstracts complex Chromium operations into discrete agent-friendly actions.
Browser Interaction Flow
This diagram illustrates how aNavigateRequest is handled across the protocol boundary.
Diagram: Browser Action Data Flow
Sources: schemas/proto/palyra/v1/browser.proto#19, crates/palyra-daemon/src/app/runtime.rs#86-98, crates/palyra-daemon/src/lib.rs#141-144.
Key RPCs:
- Session Management:
CreateSession,CloseSession,InspectSessionschemas/proto/palyra/v1/browser.proto#9-13. - Interactions:
Click,Type,Scroll,Highlight,Pressschemas/proto/palyra/v1/browser.proto#20-25. - Observation:
Screenshot,Observe(DOM snapshots),NetworkLog,ConsoleLogschemas/proto/palyra/v1/browser.proto#28-31.
4. VaultService
Provides secure storage for sensitive credentials. It uses a scoped key-value model where secrets are isolated byVaultScope (e.g., Global, Workspace, or Agent-specific).
- PutSecret: Stores encrypted bytes under a scope/key pair schemas/proto/palyra/v1/gateway.proto#177-184.
- VaultSecretMetadata: Returns non-sensitive info like
value_bytesand timestamps without revealing the secret itself schemas/proto/palyra/v1/gateway.proto#167-175.
5. CanvasService
Manages theCanvas subsystem, which allows agents to push dynamic, interactive UI surfaces to the user.
- CanvasBundle: Contains the Wasm/Assets required to render the UI schemas/proto/palyra/v1/gateway.proto#245-253.
- SubscribeCanvasUpdates: A server-streaming RPC that allows the Web Console to receive real-time state patches for a specific canvas schemas/proto/palyra/v1/gateway.proto#49-50.
Cross-Language Stub Generation
To ensure type safety across the monorepo, Protobuf definitions are compiled into native stubs for multiple languages. This process is governed bygenerate-stubs.sh schemas/generated/rust/protocol_stubs.rs#1.
Generated Artifacts
- Rust:
schemas/generated/rust/protocol_stubs.rsschemas/generated/rust/protocol_stubs.rs#1-58 - Kotlin:
schemas/generated/kotlin/ProtocolStubs.ktschemas/generated/kotlin/ProtocolStubs.kt#1-34 - Swift:
schemas/generated/swift/ProtocolStubs.swiftschemas/generated/swift/ProtocolStubs.swift#1-77
- Data Classes/Structs: Representation of all
messagetypes (e.g.,AuthProfile,BrowserSessionDetail). - Service Interfaces: Traits or protocols defining the RPC methods (e.g.,
AuthServiceClient).
| Service | Protocol Stub Module | Implementation Location |
|---|---|---|
| AuthService | palyra_auth_v1 | crates/palyra-daemon/src/application/auth.rs |
| BrowserService | palyra_browser_v1 | crates/palyra-browserd/src/service.rs |
| GatewayService | palyra_gateway_v1 | crates/palyra-daemon/src/gateway/mod.rs |