Skip to main content

Session Resume

PraisonAI automatically resumes conversations when you use the same session_id. When SessionConfig.mirror_runtime_state=True, persisted sessions also restore runtime_state alongside messages — useful for replaying tool call IDs when handing off between native and plugin runtimes. See Session Runtime State.

How It Works

Session ID Strategies

User-Based Sessions

Conversation-Based Sessions

Auto-Generated (Default)

If you don’t provide a session_id, one is auto-generated:

CLI Resume

Concurrent Writes

Multiple bot workers writing to the same session_id are safe — history saves use a single locked atomic write under the hood, so no worker sees an empty history mid-update. This applies to:
  • Messaging bots (praisonai bot telegram, discord, slack, whatsapp)
  • Multi-process deployments resuming the same session key
  • Managed agents streaming chunks back to the user
You do not need to add a custom lock around agent.start().

Best Practices

  1. Consistent session_ids - Same ID = same conversation thread
  2. User isolation - Include user_id in session_id for multi-user apps
  3. Persistent storage - Use PostgreSQL for production, SQLite for development