Overview
A session is a persistent conversation between an agent and a user (or system). Each session has a unique key, an associated agent, and optional channel routing for message delivery. Sessions store conversation history, token counts, model overrides, and metadata. Sessions are the communication boundary, not the unit of tracked work. Useravi tasks when the work needs an owner, progress, and a terminal state. Use ravi eval when you need reproducible measurement or regression checks.
Session Types
Permanent Sessions
The default type. Permanent sessions persist indefinitely until explicitly reset or deleted.Ephemeral Sessions
Sessions with a time-to-live (TTL). When the TTL expires, the session is automatically deleted. Ten minutes before expiration, the agent receives a system notification with CLI commands to extend, keep, or delete the session. The ephemeral lifecycle:- A session is made ephemeral with
set-ttl - The countdown starts from the current time
- At T-10 minutes, the agent receives a
[System] Inform:warning - The agent can
extend(add more time),keep(make permanent), ordelete - If no action is taken, the session is automatically deleted by the runner
Session Keys
Every session is identified by a hierarchical key that encodes the agent, channel, scope, and peer.Key Format
Group and Thread Keys
Groups and threads are always fully isolated regardless of DM scope:Special Session Keys
Certain features create their own isolated sessions:Listing Sessions
Session Details
Reading History
@@SILENT@@) are excluded.
Inspecting Session Trace
Usesessions trace when you need to understand what happened in a real session
end to end. Unlike sessions read, trace includes channel ingress, routing,
dispatch decisions, runtime startup, adapter requests, tool activity, assistant
messages, response emission, delivery observations, and terminal turn state.
SQLite is the canonical source for this inspection path. NATS and daemon logs
can help with live or process-level debugging, but they are not required to
reconstruct the persisted session trace.
--show-system-prompt resolves the latest system prompt for the session; it
does not require a visible turn row in the selected trace window. User prompt
and raw request payloads remain turn/request-scoped.
When reading a trace, first check whether the sequence reached
adapter.request. If it did, Ravi built the final provider request. If it did
not, look earlier in channel, routing, prompt, dispatch, and
runtime.start rows.
Common incident cues from --explain:
SDE incident golden path for “the agent saw my message but did not reply”:
For abort or context-loss reports, check
session.abort, session.timeout,
turn.interrupted, provider_session_id_before, provider_session_id_after,
and the system prompt hash. resume=false with an existing provider session id
is suspicious unless a reset, delete, fork, provider/model change, or runtime
capability explains it.
Safe examples should use placeholders such as <name>, <turn_id>, and
<source_message_id>. Do not paste real phone numbers, group ids, customer
prompts, context keys, tokens, or provider session ids into docs or shared
incident notes.
Managing Sessions
Rename
Model Override
Thinking Level
Reset
Delete
Ephemeral Sessions
Make a Session Ephemeral
30m, 5h, 1d.
Extend
Make Permanent
Cross-Session Messaging
Sessions can communicate with each other using five message types. This enables multi-agent coordination and information sharing. For tracked execution with progress, dispatchravi tasks instead of treating session messaging as backlog management.
Message Types
Send
The most versatile command. Supports three modes:send is still fire-and-forget. Internally it injects an informational prompt with source attribution. Use -w only when the caller needs to wait for and stream the response.
sessions send is not a direct external-message primitive. It prompts a Ravi session; it does not itself publish visible text to WhatsApp, Telegram, Matrix, or another channel. For visible channel delivery, use the session’s normal response path or an explicit channel/media/outbound command.
Use -a <agent> to auto-create the session if it does not exist:
/reset, /info, and /exit commands.
Inform
Send context information. The agent can silently acknowledge (@@SILENT@@) if the information is not relevant:
Execute
Send a task for the agent to perform. The agent uses tools and completes the work without necessarily responding:Ask / Answer Workflow
The ask/answer pattern enables structured multi-agent coordination:- Answer immediately if it already knows
- Otherwise, ask the question in its chat and relay answers back
- Keep forwarding related follow-ups (not just the first reply)
Channel Overrides
All messaging commands support channel and target overrides:Source Attribution
All cross-session messages include a[from: <sessionKey>] tag so the receiving agent knows who sent it. For ask/answer, an optional sender parameter provides end-user attribution.
Scope Isolation
Sessions respect REBAC permissions. When scope enforcement is active:sessions listonly shows accessible sessionssessions inforeturns “not found” for inaccessible sessionssessions send/ask/answercannot target sessions outside the caller’s scope- Modify operations (rename, reset, delete, set-model, set-thinking, set-ttl, extend, keep) require modify permission