Use this file to discover all available pages before exploring further.
SQLite provides local file-based SQL database persistence, perfect for development, prototypes, and single-instance applications that need reliable data storage without external dependencies.
from praisonaiagents import Agent, dbagent = Agent( name="LocalBot", instructions="You are a helpful assistant.", db=db(database_url="sqlite:///agent_conversations.db"), session_id="local-session")response = agent.chat("Hello! Can you remember this conversation?")print(response) # Conversation automatically saved to SQLite
2
Custom Database Path
from praisonaiagents import Agent, dbimport tempfileimport os# Create database in specific locationdb_path = os.path.join(tempfile.gettempdir(), "my_agent.db")my_db = db.SQLiteDB(path=db_path)agent = Agent( name="CustomBot", instructions="You are a helpful assistant.", db=my_db, session_id="custom-session")agent.chat("This is stored in my custom location!")
from praisonaiagents import Agent, db# Custom SQLite database with specific optionsmy_db = db.SQLiteDB( path="./data/agents.db", # SQLite-specific options can be configured via the database URL)agent = Agent( name="ConfiguredBot", instructions="You are a helpful assistant.", db=my_db, session_id="configured-session")
from praisonaiagents import Agent, db# First conversationagent1 = Agent( name="Assistant", db=db(database_url="sqlite:///memory.db"), session_id="user-alice")agent1.chat("My favorite color is blue")agent1.chat("I work as a software engineer")# Simulate application restartagent1 = None# Resume conversation - automatically loads historyagent2 = Agent( name="Assistant", db=db(database_url="sqlite:///memory.db"), session_id="user-alice" # Same session ID)response = agent2.chat("What's my favorite color and job?")print(response) # Will reference blue color and software engineering