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
- A roundup of AI agents and MCP resources, including how to evaluate agents — _jaydeepkarale · 2026-07-21
- A full course shows how to build and deploy an AI agent with OpenAI and LangChain — _jaydeepkarale · 2026-07-21
- A beginner guide to AI agents points readers to a Stanford webinar — _jaydeepkarale · 2026-07-21
- A practical guide on how to evaluate AI agents — _jaydeepkarale · 2026-07-21
- MCP is headed toward easier scale, event-driven extensions, and workable file uploads — EricBuess · 2026-07-21
- Developers debate the missing composition model for AI agents — threepointone · 2026-07-21