Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
Session Resume
PraisonAI automatically resumes conversations when you use the same session_id.
How It Works
from praisonaiagents import Agent
# First run - agent with memory and session
agent = Agent(
name="Bot",
memory={
"db": "postgresql://postgres:praison123@localhost/praisonai",
"session_id": "session-001"
}
)
response = agent.start("My favorite color is blue")
print(response)
# Later run (same session_id) - automatically resumes
agent2 = Agent(
name="Bot",
memory={
"db": "postgresql://postgres:praison123@localhost/praisonai",
"session_id": "session-001"
}
)
response = agent2.start("What's my favorite color?")
# Agent remembers: "Your favorite color is blue"
print(response)
Session ID Strategies
User-Based Sessions
from praisonaiagents import Agent
user_id = "user123"
agent = Agent(
name="Assistant",
memory={
"db": "mydata.db",
"session_id": f"user-{user_id}-main"
}
)
Conversation-Based Sessions
from praisonaiagents import Agent
import uuid
agent = Agent(
name="Assistant",
memory={
"db": "conversations.db",
"session_id": f"conv-{uuid.uuid4().hex[:8]}"
}
)
Auto-Generated (Default)
If you don’t provide a session_id, one is auto-generated:
from praisonaiagents import Agent
agent = Agent(
name="Assistant",
memory={"db": "mydata.db"} # session_id auto-generated
)
CLI Resume
# Show history
praisonai persistence resume \
--session-id "my-session" \
--conversation-url "postgresql://localhost/mydb" \
--show-history
# Continue conversation
praisonai persistence resume \
--session-id "my-session" \
--conversation-url "postgresql://localhost/mydb" \
--continue "What did we discuss?"
Best Practices
- Consistent session_ids - Same ID = same conversation thread
- User isolation - Include user_id in session_id for multi-user apps
- Persistent storage - Use PostgreSQL for production, SQLite for development