Short-Term Dialogue
Conversation history is the dialogue for one agent session: user messages,
assistant responses, and tool calls/results. Pass a stable session_id on each
run to have ISH load that session's previous messages and append the new turn.
To retain the dialogue after the process exits, also attach a persistence store
backed by a database. Without both settings, ISH does not provide durable
conversation history.
Write dialogue to a SQLite database
This Python example stores the conversation in the session_messages table in
./data/agent-state.sqlite3. On the second run, the same session_id loads the
prior dialogue before sending the next request:
import asyncio
from ish import Agent, SQLiteLogger
async def main():
store = SQLiteLogger(db_path="./data/agent-state.sqlite3")
await store.initialize()
agent = Agent(name="assistant", model="gpt-4o-mini", persistence=store)
await agent.run("My project is called Quartz.", session_id="project-chat-7")
answer = await agent.run(
"What is my project called?", session_id="project-chat-7"
)
print(answer.content)
await store.close()
asyncio.run(main())
The database path selects the SQLite file. If you use PersistenceStore in
another SDK, configure its path to the same file. For PostgreSQL, SQL Server,
Redis, or another application-managed database, implement a StorageConnector;
the connector decides which database and tables or key space hold the records.
| SDK | Session ID setting |
|---|---|
| Python | agent.run(prompt, session_id="project-chat-7") |
| TypeScript | AgentOptions.session_id |
| Go | AgentRunRequest.SessionId |
| C# | AgentRunRequest.SessionId |
| Java | AgentRequest.sessionId(...) |
| Rust | AgentRunRequest.session_id |
For database setup and durable write modes, see SQLite WAL. For a database you already operate, see Custom Storage Connectors.
Three kinds of agent state
ISH uses short-term memory for the dialogue in one session and long-term memory for reusable knowledge that can cross sessions:
- Short-term dialogue is the ordered user, assistant, and tool history for
one
session_id. It is stored insession_messageswhen persistence is configured, then loaded into later runs that use the same session ID. - Long-term agent memory is reusable knowledge the agent can search or save
through
MemoryStore. It is in memory by default and becomes durable when configured with a persistence store and namespace. In normal agent use, the agent can decide to save useful knowledge through its memory tool; ISH does not silently archive every dialogue turn as a memory. - Working context is mutable task state shared with tools or collaborating
agents. Use
ContextStorefor named JSON values and documents. It is in memory by default; opt into database storage with a persistence store and namespace. Context is working state, not the dialogue transcript or the agent's long-term memory.
These stores can use the same SQLite database file or StorageConnector, while
keeping separate tables/collections and boundaries: session ID for dialogue,
namespace for context and memory, and scope/key within an agent memory namespace. See
the Memory overview for the comparison and data layout.