Skip to main content

Persistence

Persistence keeps traces and supported run state after the SDK process exits. The default storage is SQLite, backed by one Rust engine and available through each language SDK. Use a StorageConnector when your application needs to store the same records in a database or service it already operates.

import asyncio
from ish import Agent, SQLiteLogger


async def main() -> None:
persistence = SQLiteLogger(db_path="./data/traces.db")
await persistence.initialize()

agent = Agent(
name="audited_assistant",
model="gpt-4o-mini",
persistence=persistence,
)
try:
result = await agent.run("Summarize today's deployment checklist.")
print(result.content)
await persistence.flush()
finally:
agent.close()
await persistence.close()


asyncio.run(main())

Where saved data goes​

SQLite keeps a recovery log so it can restore committed changes after an interruption. Select DiskSync when each write should be committed before the call returns, or Tiered when grouped writes are useful. Before updating workflow progress, ISH saves any earlier buffered changes first. The details below are for readers who need to understand storage behavior; the example shows the usual setup.

SQLite​

SQLite is useful for local development and single-host deployments because it does not require a separate database service. The Control Plane tools use the configured SQLite WAL database for trace data by default. You can select another path with the CLI --db option.

ish-server logs --db ./data/traces.db

SQLite WAL mode supports concurrent readers while a writer is active, subject to SQLite's transaction and filesystem constraints. Actual throughput and latency depend on workload, configuration, and storage; this documentation makes no fixed latency guarantee.

What SQLite stores​

SQLite persistence stores the records needed to inspect runs and resume durable work:

DataWhat it recordsHow it helps recovery
Run historyAgent runs and model/tool activityInspect a run after it finishes
Conversation historyMessages associated with a sessionContinue the conversation with the same session_id
Workflow steps and snapshotsCompleted outputs and approval stateReuse completed work and resume after interruption
Runner checkpointsThe latest saved agent stateContinue a run without repeating completed model/tool work
Evaluation runsCase results and report summariesVerify and compare evaluation results
External action recordsRequest ID and action statusCheck uncertain work before retrying an external action

Session messages are stored when the run supplies a session_id along with a persistence store; a later run with the same session ID can load that history. Without those settings, ISH does not provide durable conversation history.

ContextStore and MemoryStore are separate stores and remain in memory by default. To keep either after the process exits, create it with the same persistence store and a stable namespace. Context stores working values and documents; memory stores searchable facts organized by scope and key. A namespace keeps one user's, project's, or tenant's data separate from another's. Python Context can also hold regular Python objects, which stay in that process only. AgentsMdMemory continues to use repository files for instructions and recorded pitfalls.

DataConstructor settingsStorage boundary
Dialogue history (short-term conversation)Persistence handle plus session_id on each agent runKeyed by session ID
Working context (short-term task state)Persistence store plus namespace on ContextStoreKeyed by namespace
Long-term memoryPersistence store plus namespace on MemoryStoreKeyed by namespace and scope

The same persistence handle can back all three; they use distinct record collections and keys. Use a stable, application-controlled namespace and avoid putting secrets into searchable memory.

For a database-file example for each store, see Short-Term Dialogue, Context, and Memory. For the SQLite path and durability modes, see SQLite WAL; for application-managed databases, see Custom Storage Connectors.

Use another storage backend​

The Python SQLPersistence helper accepts SQLite DSNs. To use PostgreSQL, SQL Server, Redis, or another application-managed backend, implement a custom storage connector.

  • SQLite WAL — durability, buffering, and SQLite settings.
  • State snapshots — pause for approval, resume safely, and inspect saved agent progress after an interruption.
  • Custom Storage Connectors — the five-operation connector contract, atomic revisions, and database adapter patterns.
  • Durable workflows — workflow claim leases and side_effect_intents crash reconciliation.