Lu_Wang_ENB_DBX
Databricks Employee
Databricks Employee

Use two layers:

  1. Short-term: LangGraph checkpointer for thread/session state.
  2. Long-term: for your case, prefer Databricks Managed Memory if available; otherwise use self-managed Lakebase. Managed memory is the simplest cross-session option and works with LangGraph; short-term should still stay in the LangGraph checkpointer.

Delta design for long-term memory

If you specifically want Delta tables, keep them simple and semantic:

  • user_memories
    • user_id
    • memory_type (preference, fact, summary)
    • topic (timezone, formatting, project, etc.)
    • memory_text
    • source_session_id
    • importance
    • confidence
    • created_at
    • updated_at
    • expires_at nullable
    • is_active

Optional:

  • memory_events for raw append-only writes/audit
  • session_summaries for one summary per conversation/session

Design rule: store distilled facts/preferences/summaries, not every message. Databricks internal guidance also separates semantic memory such as facts/preferences from short-term session state and recommends fewer long-term objects than short-term ones.

Short-term → long-term: what and when

Save to long-term only when the info is:

  • stable user preference
  • reusable fact
  • durable project context
  • end-of-session summary

Do not save transient tool output or every turn. Internal notes explicitly say long-term write does not need to happen every step and should be smaller than short-term memory.

Good trigger points:

  • explicit user statement: “I prefer…”, “Remember that…”
  • session end
  • after task completion
  • periodic background summarization/consolidation job

Load long-term on next login

At app start:

  • identify user_id
  • fetch top memories for that user
  • inject only the most relevant ones into the prompt/context
  • keep the rest searchable as a tool

For managed memory, Databricks recommends per-user scope and searching within that scope; one agent can also read personal scope plus shared org scope.

Best references

  • Managed agent memory docs — best current reference for cross-session memory with scope/path model.
  • agent-langgraph-advanced template — shows AsyncCheckpointSaver for short-term and AsyncDatabricksStore for long-term in LangGraph.
  • Lakebase AI Integration hands-on lab — explicitly covers short-term with CheckpointSaver and long-term with DatabricksStore for LangGraph.

Recommendation

For classic compute + LangGraph:

  • use LangGraph checkpointer for short-term
  • if allowed, use Managed Memory for long-term
  • if you must build it yourself in Delta, use one distilled user_memories table + optional session_summaries table, and write only curated memories