Skip to main content
The Channel subsystem in Palyra facilitates integration with external communication platforms (e.g., Discord, Slack, Telegram) and internal testing harnesses. It provides a unified interface for the daemon to receive inbound messages, route them to the appropriate agent runs, and dispatch outbound responses through the correct provider adapters.

Architecture Overview

The architecture is split between the palyra-connectors crate, which contains the generic provider logic and storage, and the palyra-daemon, which implements the ChannelPlatform to orchestrate these connectors within the daemon’s lifecycle.

System Components and Routing Flow

The following diagram illustrates how a message travels from an external platform into the Palyra ecosystem and back. Message Routing and Dispatch Sources: crates/palyra-daemon/src/channels.rs#135-169, crates/palyra-connectors/src/core/supervisor.rs#1-50, crates/palyra-connectors/tests/simulator_harness.rs#41-71

ChannelPlatform and Supervisor

The ChannelPlatform is the central management point within the daemon. It initializes the ConnectorSupervisor, which manages the lifecycle of individual ConnectorInstance records and their associated worker loops. For details on the supervisor internals and the provider trait, see Connector Supervisor and Provider Implementations.

Message Routing (ChannelRouter)

Routing is handled by the ConnectorRouter trait. In the daemon, this is implemented by GrpcChannelRouter, which translates connector events into gRPC calls targeted at the Gateway’s run lifecycle crates/palyra-daemon/src/channels.rs#154-155.
EntityRole
InboundMessageEventNormalized representation of a message from any platform crates/palyra-connectors/src/core/protocol.rs#1-20.
RouteInboundResultDecision from the router on whether to accept a message and how to respond immediately crates/palyra-connectors/tests/simulator_harness.rs#48-70.
ConnectorConversationTargetMapping of platform-specific IDs (e.g., Guild/Channel) to a unified conversation ID crates/palyra-connectors/src/core/protocol.rs#50-60.

Provider Integrations

Palyra supports multiple provider types, though their implementation status varies:
  1. Discord: Fully supported integration using webhooks and bot tokens. Includes complex governance for message mutations (edits/deletions) crates/palyra-daemon/src/channels/discord.rs#155-190.
  2. Echo: An internal test provider that simply reflects messages back to the sender, used for CI and local development crates/palyra-connectors/src/providers/mod.rs#19-19.
  3. Slack/Telegram: Currently defined as Deferred availability in the provider registry crates/palyra-connectors/src/providers/mod.rs#126-135.
For a deep dive into the primary integration, see Discord Integration.

Administrative and Console Interfaces

The daemon exposes APIs for managing channels through both the Admin and Console surfaces. Channel Management API Mapping Sources: crates/palyra-daemon/src/transport/http/handlers/admin/channels/mod.rs#16-31, crates/palyra-daemon/src/transport/http/handlers/console/channels/mod.rs#14-24, crates/palyra-cli/src/commands/channels/mod.rs#30-56

Child Pages