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.
- Python
- TypeScript
- Rust
- Go
- C#
- Java
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())
import { Agent, IshClient, PersistenceStore } from "ish-harness";
const client = new IshClient();
const store = new PersistenceStore(client, {
path: "./data/traces.db",
mode: "DiskSync",
});
const agent = new Agent({
name: "audited_assistant",
model: { provider: "openai_chat", name: "gpt-4o-mini" },
persistence_handle: store.handle,
});
try {
const result = await agent.run("Summarize today's deployment checklist.");
console.log(result.content);
store.flush();
} finally {
agent.close();
store.close();
client.close();
}
use ish_harness::persistence::SqliteWalLogger;
let logger = SqliteWalLogger::new("./data/traces.db")?;
logger.start_trace("tr-001", "audited_assistant", "Summarize deployment checklist.", 1_735_000_000.0)?;
logger.finish_trace("tr-001", 1_735_000_001.0, "completed")?;
logger.flush()?;
package main
import (
"fmt"
ish "github.com/ish-harness/ish-harness/sdks/go"
)
func main() {
client, err := ish.NewClient()
if err != nil {
panic(err)
}
defer client.Close()
store, err := ish.NewPersistenceStore(client, "./data/traces.db", "DiskSync", nil, "")
if err != nil {
panic(err)
}
defer store.Close()
result, err := client.RunAgent(ish.AgentRunRequest{
AgentName: "audited_assistant",
Model: &ish.AgentModel{Provider: "openai_chat", Name: "gpt-4o-mini"},
PersistenceHandle: store.Handle,
UserPrompt: ish.StringPtr("Summarize today's deployment checklist."),
})
if err != nil {
panic(err)
}
_ = store.Flush()
fmt.Println(result)
}
using Ish.Harness;
using var client = new IshClient();
using var store = new PersistenceStore(client, path: "./data/traces.db", mode: "DiskSync");
using var request = new AgentRunRequest
{
AgentName = "audited_assistant",
Model = new AgentModel { Provider = "openai_chat", Name: "gpt-4o-mini" },
PersistenceHandle = store.Handle,
UserPrompt = "Summarize today's deployment checklist.",
};
var result = client.Run(request);
store.Flush();
Console.WriteLine(result);
import io.github.ishharness.IshClient;
import io.github.ishharness.PersistenceStore;
import java.nio.file.Path;
try (var client = new IshClient(Path.of(System.getenv("ISH_NATIVE_LIBRARY")));
var store = new PersistenceStore(client, "./data/traces.db", "DiskSync", null, null);
var request = new IshClient.AgentRequest(
"gpt-4o-mini",
"Help review deployment checklists.",
"Summarize today's deployment checklist.")
.provider("openai_chat")
.agentName("audited_assistant")
.persistenceHandle(store.handle())) {
var result = client.runAgent(request);
store.flush();
System.out.println(result);
}
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:
| Data | What it records | How it helps recovery |
|---|---|---|
| Run history | Agent runs and model/tool activity | Inspect a run after it finishes |
| Conversation history | Messages associated with a session | Continue the conversation with the same session_id |
| Workflow steps and snapshots | Completed outputs and approval state | Reuse completed work and resume after interruption |
| Runner checkpoints | The latest saved agent state | Continue a run without repeating completed model/tool work |
| Evaluation runs | Case results and report summaries | Verify and compare evaluation results |
| External action records | Request ID and action status | Check 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.
| Data | Constructor settings | Storage boundary |
|---|---|---|
| Dialogue history (short-term conversation) | Persistence handle plus session_id on each agent run | Keyed by session ID |
| Working context (short-term task state) | Persistence store plus namespace on ContextStore | Keyed by namespace |
| Long-term memory | Persistence store plus namespace on MemoryStore | Keyed 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.
Related pages
- 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_intentscrash reconciliation.