Skip to main content
NATS is Ravi’s central pub/sub backbone. All messages, prompts, tool calls, and responses flow through it as events on hierarchical topics.

Concepts

  • Topic/Subject — Hierarchical namespace separated by . (e.g., ravi.session.main.prompt)
  • Event — JSON payload published to a subject
  • Wildcards* matches one level, > matches multiple levels
  • Connection — Direct TCP to nats://127.0.0.1:4222 (no HTTP/WebSocket intermediary)

Session Events

Events scoped to a session name (e.g., agent-main-abc123). The prompt topic goes via JetStream WorkQueue stream (SESSION_PROMPTS). All others are plain NATS pub/sub.

Inbound Events (Channels to Bot)

Inbound channel messages arrive through Omni JetStream subjects such as message.received.{channelType}.{instanceId} and are routed into sessions by OmniConsumer, not published as Ravi pub/sub aliases like whatsapp.*.inbound. Emoji reactions are normalized to the canonical trigger subject ravi.inbound.reaction; whatsapp.*.reaction is not published. Reaction events are correlation signals. Use targetMessageId to look up routine-owned state; do not assume the event includes the original chat, caption, media metadata, or domain object.

Delivery Events (Bot to Gateway)

Media Events

Type values: image, video, audio, document.

Contact and Approval Events

Instance Events

Audit Events

System and Config Events

CLI Tool Events

When agents execute CLI tools, events are emitted:
Example: ravi.agent:main:main.cli.contacts.add Standalone CLI commands that are not tied to a session use _cli as the session token:

Copilot Events (Claude Code Bridge)

Events from Claude Code sessions, published by the hook script:

Copilot Payload Envelope

JetStream Streams

Programmatic API