Why Postgres
- Transactional session writes — commit or roll back cleanly.
- JSONB for flexible message shapes without schema migrations on every change.
- Universal deployment — no team is scared of installing Postgres.
- Rich indexing (GIN on JSONB) makes memory queries fast enough for chat.
Advertisement
What gets persisted
- Sessions (row per session, JSONB for metadata).
- Messages (row per turn, ordered by ts).
- Events (structured audit log of every runtime decision).
- Task state (for long-running / paused tasks).
Advertisement
Plugging in
PostgresSessionStore store = PostgresSessionStore.builder()
.dataSource(dataSource)
.tablePrefix("adk_")
.build();
runtime.setSessionStore(store);