docs: Document stateful MCP session usage (Playwright)#522
Open
Dushyant Acharya (Dotify71) wants to merge 1 commit into
Open
docs: Document stateful MCP session usage (Playwright)#522Dushyant Acharya (Dotify71) wants to merge 1 commit into
Dushyant Acharya (Dotify71) wants to merge 1 commit into
Conversation
Dushyant Acharya (Dotify71)
force-pushed
the
docs/stateful-session-guidance
branch
from
June 12, 2026 01:53
cb1f2a4 to
e88e5f4
Compare
Author
|
Hi Mason Daugherty (@mdrxy)! Since the related issue #33966 was closed as expected behavior (stateless client by default), this PR properly documents how users should implement the stateful session pattern to avoid the browser termination confusion. Could you take a quick look when you have a chance? Happy to make any adjustments! |
…right) This documents the crucial difference between `client.get_tools()` (stateless, creates a new MCP session per tool invocation) and `client.session()` (stateful, maintains connection across multiple tools). This addresses the common pitfall where browser sessions terminate immediately after navigation when using Playwright MCP tools with agents. Resolves langchain-ai/langchain#33966
Dushyant Acharya (Dotify71)
force-pushed
the
docs/stateful-session-guidance
branch
from
June 24, 2026 16:04
e88e5f4 to
a98eac5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Resolves langchain-ai/langchain#33966
Summary
This PR documents the crucial difference between
client.get_tools()(stateless, creates a new MCP session per tool invocation) andclient.session()(stateful, maintains connection across multiple tools).This addresses the common pitfall where browser sessions terminate immediately after navigation when using Playwright MCP tools with agents, as reported in langchain-ai/langchain#33966. As noted by maintainers in that issue, this documentation belongs in the MCP adapters repository rather than the core langchain agent documentation.
Changes
MultiServerMCPClient.get_tools()to explicitly warn developers about the stateless per-call session behavior.examples/stateful_playwright_example.py) demonstrating a working Playwright agent.