agentsclimarketplace

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

Install
npx -y skills add kjuhwa/skills-hub --skill sqlite-session-persistence

Assembled 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_path is ~/.agents_sessions.db if 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 RedisSession instead
  • 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.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.