Skip to main content

ChannelDescriptor

Defined in the protocols module.
AI Agent Optional self-description a channel adapter may expose. A channel plugin declares — in one place, at registration — everything the gateway needs to treat it as first-class:
  • config_fields: its config keys, merged into ChannelConfigSchema at runtime instead of being dropped;
  • system_prompt_hint: a hint injected whenever that channel is active so the agent knows which platform it is replying on and its constraints.
The YAML schema, the onboarding wizard, and the agent prompt all read this single contract. Protocol-only (no heavy imports) so it stays in core; the wrapper subsystems (_config_schema.py, onboard.py, prompt assembly) are the consumers. The two required members above are enough to be first-class: the onboarding wizard derives its prompts directly from config_fields (both env-backed secrets and plain config keys). A descriptor MAY additionally expose an optional setup(io) hook for bespoke, multi-step flows the field list cannot express; the wizard calls it when present and merges the returned values. Because it is optional, a minimal descriptor (like the example below) omits it — so this Protocol is intentionally not used as an isinstance type guard; consumers read attributes with getattr fallbacks instead. Example (implementation ships in a praisonai.channels plugin):: class IRCDescriptor: config_fields = [ ChannelField(“server”, required=True, prompt=“IRC server host”), ChannelField(“nickserv_password”, secret=True, env=“IRC_NICKSERV_PASSWORD”), ] system_prompt_hint = ( “You are replying on IRC: plain text only, one short line.” ) register_platform(“irc”, IRCBot, descriptor=IRCDescriptor())

Properties

List[ChannelField]
No description available.
str
No description available.

Methods

setup()

Optional interactive setup returning collected config/env values.

Source

View on GitHub

praisonaiagents/bots/protocols.py at line 208