How to Layer Agent State in Production
Away-Pollution3362 · reddit · 2026-07-15
The post suggests splitting agent state into three distinct layers rather than mixing them into a single "memory bank":
- Run-local scratchpad: A temporary workspace for the current run. It's okay if this is lost, making Redis or in-memory storage ideal.
- Durable user/workspace state: Essential user or workspace state that must be persisted, such as conversation history and preferences, typically handled by Postgres.
- Append-only audit: A log of what the agent actually did and what permissions it had during execution. This must be append-only and immutable.
The author believes this separation eliminates much of the "which database should I use" anxiety, as most applications actually only need the second layer at launch. They then mention managed Postgres solutions like Neon, Lakebase, and RDS, posing an open question:
- If persistent state will be used for evals or analytics in the future, should it be synced to a data warehouse/lakehouse?
- Or should you query the operational store directly?
- With solutions like Lakebase, do people prefer syncing to a lakehouse, or intentionally keeping the two systems separate?
More from coding & agent
- Reticle builds a verification layer that lets AI coding agents check their own generated code — Scobleizer · 2026-10-27
- Trust your agent, but read its logs: Claude managed agents tips — brada · 2026-10-27
- Dev training a guard model to block prompt injection, tool and memory poisoning — gnukeith · 2026-10-27
- Dev trains a ~4GB-VRAM sentinel model to guard against prompt injection and poisoned memory — gnukeith · 2026-10-27
- Superset rebrands as Paradev, raises $11.5M seed led by USV — massimosgrelli · 2026-10-27
- Ex-Big Tech managers may thrive in the AI era: manage agents like you managed teams — lxfater · 2026-10-27