Apply patch [skip ci]

This commit is contained in:
open-swe[bot]
2025-11-14 14:46:12 +00:00
parent 7067db3874
commit e91605e0c4

View File

@@ -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",
]