Skip to main content
The palyra-daemon (palyrad) is the central execution engine of the Palyra ecosystem. It acts as the “brain” that orchestrates agentic workflows, manages long-term memory via the Journal, and exposes multiple interface surfaces for users and external systems. It is designed as a multi-tenant, secure-by-default service that handles everything from real-time gRPC streams to background cron routines.

GatewayRuntimeState

The GatewayRuntimeState is the primary coordinator within the daemon. It maintains the in-memory state of active runs, caches for tool approvals, and handles the lifecycle of the orchestration engine. For details on the orchestration loop, see Gateway and Orchestration Engine.

Daemon Component Interaction

The following diagram illustrates how the GatewayRuntimeState bridges the network interfaces to the underlying persistence and execution layers. System Component Map Sources: crates/palyra-daemon/src/gateway.rs#40-82, crates/palyra-daemon/src/transport/http/router.rs#18-133

Network Interfaces

The daemon exposes three distinct API surfaces to accommodate different callers and security requirements.

1. gRPC Gateway

The gRPC interface, defined in gateway.proto, is used for high-performance, bidirectional communication. It is the primary interface for the RunStream endpoint, which allows clients to interact with agents in real-time.

2. HTTP Admin API (/admin/v1)

A restricted surface for system-level operations, typically used by CLI tools or automated infrastructure.

3. HTTP Console API (/console/v1)

The backend for the Palyra Web Console. It provides a rich set of handlers for session management, agent configuration, and diagnostic tools. For details on the HTTP layer, see HTTP Transport Layer and API Router.

Subsystem Overviews

Persistence and Journaling

All system events, message transcripts, and state changes are recorded in the JournalStore. This SQLite-backed engine ensures that every action taken by an agent is auditable and recoverable.

Model and Embedding Providers

The daemon abstracts LLM interactions through the ModelProvider and EmbeddingsProvider traits. This allows Palyra to switch between OpenAI, Anthropic, or local models seamlessly.

Background Tasks and Governance

The daemon includes a background scheduler for cron jobs and routines, alongside a governance engine that tracks token usage and enforces budgets.

Code Entity Map

The following table maps logical architectural concepts to their primary implementation files.
Architectural ConceptPrimary Code EntityFile Path
Execution EngineGatewayRuntimeStatecrates/palyra-daemon/src/gateway.rs
State MachineRunStateMachinecrates/palyra-daemon/src/orchestrator.rs
PersistenceJournalStorecrates/palyra-daemon/src/journal.rs
HTTP Routingbuild_routercrates/palyra-daemon/src/transport/http/router.rs
LLM InterfaceModelProvidercrates/palyra-daemon/src/model_provider.rs
Secrets ManagementVaultcrates/palyra-daemon/src/gateway.rs#28-28
Sources: crates/palyra-daemon/src/lib.rs#74-109, crates/palyra-daemon/src/gateway/runtime.rs#35-55

Child Pages