mirror of
https://github.com/hwchase17/langchain.git
synced 2026-07-13 20:47:15 +00:00
Apply patch [skip ci]
This commit is contained in:
@@ -64,6 +64,23 @@ if TYPE_CHECKING:
|
||||
STRUCTURED_OUTPUT_ERROR_TEMPLATE = "Error: {error}\n Please fix your mistakes."
|
||||
|
||||
|
||||
class MCPSessionConfig(TypedDict):
|
||||
"""Configuration for MCP session management in agents.
|
||||
|
||||
When provided, enables stateful session management for MCP tools,
|
||||
maintaining persistent connections across multiple tool invocations.
|
||||
"""
|
||||
|
||||
client: Required[Any]
|
||||
"""The MCP client instance (e.g., MultiServerMCPClient)."""
|
||||
|
||||
server_name: Required[str]
|
||||
"""The name of the MCP server to connect to (e.g., 'playwright', 'database')."""
|
||||
|
||||
auto_cleanup: NotRequired[bool]
|
||||
"""Whether to automatically cleanup the session when the agent is destroyed. Defaults to True."""
|
||||
|
||||
|
||||
def _normalize_to_model_response(result: ModelResponse | AIMessage) -> ModelResponse:
|
||||
"""Normalize middleware return value to ModelResponse."""
|
||||
if isinstance(result, AIMessage):
|
||||
@@ -1643,3 +1660,4 @@ __all__ = [
|
||||
"create_agent",
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user