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
- Warp's six non-engineering teams all run on Linear and Claude Code — mon__lim · 2026-09-11
- Is inference latency becoming the biggest bottleneck for production AI agents? — Euphoric_Sea632 · 2026-09-11
- Anthropic researcher: 99% of engineers now run swarms of 300+ self-improving agents — AlishaOutridge · 2026-09-11
- Gergely Orosz: Shipping 10x PRs With AI Agents, Sites Fill With Small Regressions — ducha_aiki · 2026-09-11
- Same Echo Maze prompt, three frontier models: all passed visually but shipped the same hidden bug — eyishazyer · 2026-09-11
- Astra storyboards plus Minimax H3 per-shot generation boost video success rates — Hailuo_AI · 2026-09-11