DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to give an agent memory that lasts across sessions with Langgraph

Combine short-term working memory and long-term memory so an assistant remembers users between conversations.

Short answer: Install with pip install -U langgraph; then read the Comprehensive memory guide for short-term and long-term memory; keep in-progress reasoning in short-term memory and save durable facts to long-term memory. All steps.

Who it is forA builder of a support or tutoring assistant that forgets every user the moment a session ends.

The problemStateless agents make users repeat themselves and cannot build on past conversations.

The outcomeAn agent with working memory for the current task and persistent memory it reads back in later sessions.

What you need first

  • Python and pip
  • An LLM provider for your agent's model calls
  • Optional: a LangSmith account for tracing and the LangSmith Deployment platform
  • For JavaScript or TypeScript, the separate LangGraph.js library

Steps

  1. Install with pip install -U langgraph
  2. Read the Comprehensive memory guide for short-term and long-term memory
  3. Keep in-progress reasoning in short-term memory and save durable facts to long-term memory
  4. Start a new session for the same user and confirm the agent recalls what it stored
  5. Trace a few runs in LangSmith to check what is written to and read from memory

Prompt for your agent

Using langchain-ai/langgraph, give my <assistant> short-term memory for the current conversation and long-term memory keyed by user, following the Comprehensive memory docs. Demonstrate it remembering a fact from a previous session.

Caveat. LangSmith is a separate LangChain product; the README does not state its pricing, so check before relying on it in production.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for langchain-ai/langgraph and "Give an agent memory that lasts across sessions"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer