Sqlite session persistence
Skill kjuhwa/skills-hub/skills/session-management/sqlite-session-persistence
Persist agent conversation history to SQLite for durable multi-turn sessions across process restarts.From its SKILL.md
npx -y skills add kjuhwa/skills-hub --skill sqlite-session-persistenceAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.2 KB, 366 tokens by cl100k_base, as published. Nobody here has run it
sqlite-session-persistence
Use SQLiteSession(session_id, db_path="...") to persist conversation history to a local SQLite database. History survives process restarts and can be shared across multiple processes reading the same file.
When to apply
Single-server deployments, CLI tools, or development environments where you need persistent multi-turn conversation without a separate database service.
Core snippet
import asyncio
from agents import Agent, Runner, SQLiteSession
agent = Agent(name="Assistant", instructions="Reply very concisely.")
async def main():
session_id = "user_123_conversation"
session = SQLiteSession(session_id, db_path="conversations.db")
# Turn 1 — new conversation
result = await Runner.run(
agent,
"What city is the Golden Gate Bridge in?",
session=session,
)
print(f"Turn 1: {result.final_output}")
# Turn 2 — history loaded from SQLite
result = await Runner.run(agent, "What state is it in?", session=session)
print(f"Turn 2: {result.final_output}")
asyncio.run(main())
# After process restart, run again with the same session_id — history is preserved
Key notes
- Default
db_pathis~/.agents_sessions.dbif not specified - Session ID is the lookup key; use a stable per-user or per-conversation ID
- SQLite is single-writer; for multi-process writes, use
RedisSessioninstead - Install:
pip install openai-agents(SQLite included); Redis:pip install 'openai-agents[redis]' - History compaction can be enabled via
RunConfig(session_settings=SessionSettings(compaction=...))
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.