Docs / concepts / messages

Messages

Messages

Message flow (high level)

text
Inbound message
  -> routing/bindings -> session key
  -> queue (if a run is active)
  -> agent run (streaming + tools)
  -> outbound replies (channel limits + chunking)
  • messages.* for prefixes, queueing, and group behavior.
  • agents.defaults.* for block streaming and chunking defaults.
  • Channel overrides (channels.whatsapp.*, channels.telegram.*, etc.) for caps and streaming toggles.

Inbound dedupe

Inbound debouncing

text
{
  messages: {
    inbound: {
      debounceMs: 2000,
      byChannel: {
        whatsapp: 5000,
        slack: 1500,
        discord: 1500,
      },
    },
  },
}
  • Debounce applies to text-only messages; media/attachments flush immediately.
  • Control commands bypass debouncing so they remain standalone.

Sessions and devices

  • Direct chats collapse into the agent main session key.
  • Groups/channels get their own session keys.
  • The session store and transcripts live on the gateway host.

Inbound bodies and history context

  • Body: prompt text sent to the agent. This may include channel envelopes and optional history wrappers.
  • CommandBody: raw user text for directive/command parsing.
  • RawBody: legacy alias for CommandBody (kept for compatibility).
  • [Chat messages since your last reply - for context]
  • [Current message - respond to this]

Queueing and followups

  • Configure via messages.queue (and messages.queue.byChannel).
  • Modes: interrupt, steer, followup, collect, plus backlog variants.

Streaming, chunking, and batching

  • agents.defaults.blockStreamingDefault (on|off, default off)
  • agents.defaults.blockStreamingBreak (text_end|message_end)
  • agents.defaults.blockStreamingChunk (minChars|maxChars|breakPreference)
  • agents.defaults.blockStreamingCoalesce (idle-based batching)
  • agents.defaults.humanDelay (human-like pause between block replies)
  • Channel overrides: *.blockStreaming and *.blockStreamingCoalesce (non-Telegram channels require explicit *.blockStreaming: true)

Reasoning visibility and tokens

  • /reasoning on|off|stream controls visibility.
  • Reasoning content still counts toward token usage when produced by the model.
  • Telegram supports reasoning stream into the draft bubble.

Prefixes, threading, and replies

  • messages.responsePrefix (outbound prefix) and channels.whatsapp.messagePrefix (WhatsApp inbound prefix)
  • Reply threading via replyToMode and per-channel defaults