Overview
An instance is the central configuration entity in Ravi. Each instance represents a connected channel account (WhatsApp, Telegram, Discord, Matrix) with its own agent, access policies, and routing rules. Instances are stored in SQLite and managed entirely through the CLI.Creating an Instance
--channel— Channel type:whatsapp,matrix,telegram,discord(default:whatsapp)--agent— Default agent for this instance--dm-policy— DM access policy (default:open)--group-policy— Group access policy (default:open)
ravi agents create.
Connecting to a Channel
~/ravi/<agentId>.
Check Status
Disconnect
Access Policies
Policies control who can interact with the bot on a given instance. There are two independent policies: one for DMs and one for groups.DM Policy
Group Policy
Setting Policies
Pending Contacts
WhendmPolicy=pairing or groupPolicy=allowlist, unknown contacts and groups that send messages are placed in a pending queue instead of being rejected.
List Pending
Approve
Reject
Per-Instance Routes
Routes define which agent handles messages from specific contacts, groups, or phone prefixes within an instance. Routes also support policy overrides and priority ordering.Route Patterns
Adding Routes
--priority <n>— Higher priority routes are matched first (default: 0)--policy <policy>— Override the instance policy for this route:open,pairing,closed,allowlist--session <name>— Force a specific session name--dm-scope <scope>— Override DM scope for this route--channel <channel>— Limit route to a specific channel (omit for all channels)
Managing Routes
agent, priority, dmScope, session, policy, channel.
Agent Resolution Order
When a message arrives, Ravi resolves which agent handles it using this priority:- Route match — The highest-priority route whose pattern matches the sender (scoped to the instance)
- Instance agent — The default agent configured on the instance (
ravi instances set main agent <id>) - Default agent — The global default agent from settings
DM Scope
DM scope controls how sessions are grouped for direct messages. It can be set at the instance level or overridden per route.Active vs Sentinel Mode
Agent mode is configured at the agent level, but it directly affects how instances behave:- Active mode — The agent responds to messages automatically. This is the default.
- Sentinel mode — The agent observes messages silently without auto-replying. Useful for monitoring accounts where the agent only acts when explicitly instructed.
Instance Lifecycle
Instances follow a lifecycle that supports recovery:- Create —
ravi instances createregisters the instance locally - Connect —
ravi instances connectcreates the omni instance and initiates pairing - Active — Messages flow through the instance, routed to agents
- Disconnect —
ravi instances disconnectdisconnects from the channel - Delete (soft) —
ravi instances deletemarks the instance as deleted but keeps the data - Restore —
ravi instances restorerecovers a soft-deleted instance
Configurable Properties
Use
- or null as the value to clear a property.