fix(docs): Update example code in Test Docs #1825
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Updated agent invocation to use structured messages and configuration
Overview
This PR updates the documentation example for
agent.invoke()to correctly demonstrate:{"messages": [HumanMessage(...)]}config={"configurable": {"thread_id": "<session-id>"}}InMemorySaverPreviously, the example omitted or incorrectly used the
configargument, which caused confusion and errors when users attempted to maintain session-based memory.This update provides a fully functional example that aligns with current agent APIs.
Type of change
Type: Update existing documentation
Related issues/PRs
None
Checklist
docs devsrc/docs.jsonif neededAdditional notes
This update ensures that the documentation demonstrates the correct pattern for invoking agents that use checkpointing or session-based memory. Without a
configurable.thread_id, each call creates a new memory session, making it impossible to persist user context.The updated, working example is shown below: