Skip to content

docs: fix delete_old_messages example to properly demonstrate deletion effect#4009

Open
Udit Sharma (uditstocks) wants to merge 1 commit into
langchain-ai:mainfrom
uditstocks:fix/delete-old-messages-demo
Open

docs: fix delete_old_messages example to properly demonstrate deletion effect#4009
Udit Sharma (uditstocks) wants to merge 1 commit into
langchain-ai:mainfrom
uditstocks:fix/delete-old-messages-demo

Conversation

@uditstocks
Copy link
Copy Markdown

Overview

The existing delete_old_messages example in the short-term memory documentation failed to properly demonstrate
the deletion effect. After deleting the earliest two messages, the agent could still recall the user's name "Bob" because
the AI's own first response had echoed the name - and that response survived the deletion window.

This PR fixes the example by inserting an unrelated conversation turn (a cat poem)
between the name introduction and the name recall query. This naturally pushes the
name-containing messages out of the window, so when the agent is asked "what's my name?"
it correctly responds that it doesn't know.

Type of change

[Update existing documentation]

Checklist

  • I have read the contributing guidelines
  • I have tested my changes locally using docs dev
  • All code examples have been tested and work correctly

Related issues/PRs

closes #3894

Additional notes

The fix is minimal and surgical - only the example code and output block are changed.
No API behavior, no logic, no navigation changes. The updated output block is taken
from an actual local run to ensure accuracy.

@github-actions github-actions Bot added the external User is not a member of langchain-ai label May 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for opening a docs PR, Udit Sharma (@uditstocks)! When it's ready for review, please add the relevant reviewers:

  • @npentrel or @lnhsingh (LangChain)

@github-actions github-actions Bot added langchain For docs changes to LangChain oss labels May 14, 2026
@uditstocks Udit Sharma (uditstocks) force-pushed the fix/delete-old-messages-demo branch from b739c77 to 18bf2d3 Compare May 14, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external User is not a member of langchain-ai langchain For docs changes to LangChain oss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[langchain]: 'delete_old_messages' The deletion effect was not effectively demonstrated.

1 participant