Skip to main content
The palyrad daemon is the central orchestrator of the Palyra platform. It manages the lifecycle of AI agent interactions, enforces security policies, maintains long-term memory via a journaled store, and provides the transport layer for both human operators and automated connectors.

Overview and Gateway State

At the heart of the daemon is the GatewayRuntimeState, which acts as the shared memory and coordination point for all active processes. It holds references to the model providers, the policy engine, the tool execution environment, and the active session registry.

Core Components

System Architecture Diagram

This diagram illustrates the flow from external inputs through the core daemon’s internal subsystems. Sources: crates/palyra-daemon/src/gateway.rs#40-82, crates/palyra-daemon/src/lib.rs#73-83

Major Subsystems

The daemon’s functionality is partitioned into several specialized subsystems, each documented in detail in child pages.

Gateway and Session Orchestration

The Orchestrator is responsible for the “Run Loop.” When a message is received via RouteMessage, the daemon initializes a RunStateMachine. It pulls context from the JournalStore, queries the LLM via the ModelProvider, and executes tools if proposed.

Journal Store and Persistence

All interactions are persisted in a hash-chained audit log. This ensures that the agent’s “memory” and the operator’s audit trail are immutable and verifiable. It also handles RAG (Retrieval-Augmented Generation) via the MemoryEmbeddingProvider.

HTTP Transport and Admin API

The daemon exposes an Axum-based HTTP server providing RESTful endpoints for the Web Console and administrative tasks. This includes /admin/v1/ for system management and /console/v1/ for operator interactions.

gRPC and QUIC Transport

For high-performance, bidirectional streaming (such as real-time log tailing or CLI interactions), the daemon uses gRPC over both TCP and QUIC. It supports mTLS for secure node-to-node communication.

Cron and Background Tasks

The daemon includes a built-in scheduler for recurring tasks, such as periodic skill audits, memory maintenance (vacuuming), and scheduled agent routines.

Usage Governance

To prevent runaway costs or resource exhaustion, the UsageGovernance subsystem tracks token usage and enforces budget limits per session or principal.

Code Entity Map: Request Flow

The following diagram bridges the natural language concept of a “Request” to the specific code entities and files that handle it within palyrad. Sources: crates/palyra-daemon/src/gateway.rs#56-82, crates/palyra-daemon/src/model_provider.rs#176-181, crates/palyra-daemon/src/journal.rs#232-248

Configuration

The daemon is configured via a TOML file (typically palyra.toml). The schema is defined by the RootFileConfig struct, which includes sections for gateway, model_provider, storage, and identity.
Config SectionPurposeCode Reference
daemonNetwork binding and portscrates/palyra-common/src/daemon_config_schema.rs#92-95
gatewaygRPC/QUIC and TLS settingscrates/palyra-common/src/daemon_config_schema.rs#99-112
model_providerLLM API keys and model selectioncrates/palyra-common/src/daemon_config_schema.rs#195-212
memoryRetention policies and RAG limitscrates/palyra-common/src/daemon_config_schema.rs#145-151
Sources: crates/palyra-common/src/daemon_config_schema.rs#64-81

Child Pages