🆕 Starting new session: my-projectSession created successfully!┌─────────────────────┬────────────────────────────┐│ Property │ Value │├─────────────────────┼────────────────────────────┤│ Session ID │ my-project ││ Created │ 2024-12-16 15:30:00 ││ Status │ active ││ Messages │ 0 │└─────────────────────┴────────────────────────────┘You can now run commands with this session context.Use: praisonai "your prompt" --session my-project
📊 Session Details: my-project┌─────────────────────┬────────────────────────────┐│ Property │ Value │├─────────────────────┼────────────────────────────┤│ Session ID │ my-project ││ Created │ 2024-12-16 15:30:00 ││ Last Active │ 2024-12-16 15:45:00 ││ Status │ active ││ Total Messages │ 12 ││ User Messages │ 6 ││ Agent Messages │ 6 ││ Total Tokens │ 4,523 ││ Storage Size │ 45 KB │└─────────────────────┴────────────────────────────┘Recent Messages:────────────────────────────────────────────────────[User] Can you explain the authentication flow?[Agent] Based on the code, the authentication...────────────────────────────────────────────────────[User] How do I add OAuth support?[Agent] To add OAuth support, you would need to...────────────────────────────────────────────────────
Session Commands: praisonai session start <name> - Start a new session praisonai session list - List all sessions praisonai session resume <name> - Resume a session praisonai session show <name> - Show session details praisonai session delete <name> - Delete a session praisonai session help - Show this helpUsing Sessions with Prompts: praisonai "prompt" --session <name> - Run with session context
# First messagepraisonai "What is Python?" --session learning# Follow-up (context preserved)praisonai "How do I install it?" --session learning# Another follow-uppraisonai "Show me a hello world example" --session learning
Expected Output (third message):
📂 Session: learning (3 messages)╭────────────────────────────────── Response ──────────────────────────────────╮│ Based on our conversation about Python, here's a hello world example: ││ ││ ```python ││ print("Hello, World!") ││ ``` ││ ││ After installing Python as we discussed, save this to a file called ││ `hello.py` and run it with `python hello.py` │╰──────────────────────────────────────────────────────────────────────────────╯
# Session with memorypraisonai "Remember my preferences" --session project --memory# Session with knowledgepraisonai "Search the docs" --session project --knowledge# Session with planningpraisonai "Plan the implementation" --session project --planning
Automatically save sessions after each agent run using the --auto-save flag:
# Auto-save session with each interactionpraisonai "Analyze this code" --auto-save my-project# Continue the conversation (auto-saved)praisonai "Now refactor it" --auto-save my-project
from praisonaiagents import Agentagent = Agent( name="Assistant", memory=True, context=True, # Enable context management for history)# Agent now has context from previous sessionsagent.start("What did we discuss yesterday?")
from praisonaiagents import AgentFlowManagermanager = WorkflowManager()# Execute with checkpoints (saves after each step)result = manager.execute( "deploy-workflow", checkpoint="deploy-v1")# Resume from checkpoint if interruptedresult = manager.execute( "deploy-workflow", resume="deploy-v1")# List all checkpointscheckpoints = manager.list_checkpoints()# Delete a checkpointmanager.delete_checkpoint("deploy-v1")
Sessions are automatically scoped to your current project. PraisonAI detects your project by finding the git repository root, or uses the current working directory as a fallback.Project identification:
Project ID: First 8 characters of SHA256 hash of project root path
Git detection: Uses git rev-parse --show-toplevel with 5-second timeout
Fallback: Current working directory if not in a git repository
Store sessions in different backends for production deployments:
# List sessions with SQLite backendpraisonai session list --storage-backend sqlite --storage-path ~/.praisonai/sessions.db# List sessions with Redis backend (for distributed systems)praisonai session list --storage-backend redis://localhost:6379# List sessions with file backend (default)praisonai session list --storage-backend file --storage-path ~/.praisonai/sessions
Multiple praisonai processes can safely share the same session — the CLI store reloads, merges, and writes under an exclusive lock so no messages are lost when the TUI, --interactive mode, and praisonai "…" --session all touch the same file.
# Terminal 1: keep the TUI open on a sessionpraisonai tui launch --session my-project# Terminal 2: same session, ad-hoc message via --interactivepraisonai "Add a one-line summary" --interactive --session my-project# Both messages end up in ~/.praisonai/sessions/my-project.json# in arrival order — no silent drops.
praisonai session show and praisonai session resume always reflect the latest on-disk state — the in-process cache is invalidated automatically when another process writes (mtime-based check).This concurrent-save safety was added in PR #1854. For the equivalent feature in the SDK-level store, see Multi-Process Safety.
This applies to the default file-backed session store. The sqlite / redis:// backends in the Storage Backend Options table above handle concurrency via the database itself; the CLI does not add its own merge layer there.
Blocking exclusive on write, shared (LK_RLCK) on read
Other (Pyodide, minimal embedded CPython)
None — logs a one-time warning
Single-process is safe; concurrent writers may corrupt session files
If you see this warning: File locking unavailable on this platform (fcntl not available); concurrent writers may corrupt session files.This means you’re running on an environment without native file locking. Restrict to a single process, or migrate to a DB-backed storage backend (link to the sqlite / redis options in the Storage Backend Options table above).
On Windows, sessions are stored under %USERPROFILE%\.praison\sessions\{session_id}.json following the OS convention via Path.home(). Cross-platform locking was added in PR #1837. Concurrent multi-process writes (e.g. TUI + praisonai --interactive sharing the same session directory) are preserved without message loss as of PR #1885 and PR #1892. For the SDK-level session store with the same cross-platform guarantees, see Session Persistence.Example usage across platforms:
# Windows (PowerShell)praisonai session start my-projectpraisonai "Analyze this file" --session my-project# Same commands work identically on macOS / Linux