Start with the connection replacement boundary
Microsoft Agent Framework Python 1.23.0 introduced ownership-aware connection recovery alongside a breaking Model Context Protocol (MCP) migration on October 22, 2026. Pull request #9583 says the recovery change requires replacement of an ended caller-owned client before another remote procedure call reaches it. The practical question is which component has permission to replace a failed connection. Sources: Microsoft
The migration spans Core, AG-UI, declarative, hosting, and other packages; several consumers raise their Core minimum to 1.23. The release also lists lifecycle documentation, task-context isolation, and removal of DevUI’s stale-connection workaround. Treat the upgrade as a coordinated dependency change and preserve the complete lockfile before investigating transport failures. Sources: Microsoft
MCP 2.x names the Python SDK generation, not a single wire-protocol version. Microsoft’s sample documentation describes negotiation through server/discover with modern servers. Older peers use a fallback to initialize. Include both generations in migration tests if the application uses them. Sources: Microsoft
Check context entry in a clean installation
Discussion #9613 describes a minimal environment where Core and MCP installed, but context entry failed because subscription recovery required Tenacity. The service operator’s assistant-authored report describes success after adding Tenacity 9.1.4. It ran on Windows with Python 3.12.14 and gives the following installation command. Sources: GitHub
python -m pip install \
"agent-framework-core==1.23.0" \
"mcp==2.3.0" \
"tenacity==9.1.4"The reported smoke test made one public read, exposed only get_creation, disabled prompt loading, and checked a three-field result projection. It used no model or credentials and reportedly exited its context normally. The test covered installation and adapter behavior, not disconnect recovery. An import-only check would miss the reported context-entry failure. Sources: GitHub
- Create a clean environment with Core 1.23.0 and MCP 2.3.0, the versions in the report. Attempt context entry and preserve the complete exception chain.
- Create a separate environment adding the reported Tenacity 9.1.4 dependency. Repeat the same operation.
- Repeat with the standard framework installation and compare resolved dependencies.
- Record package versions, dependency consistency results, Python patch version, operating system, and server version for each run. Sources: GitHub
Audit SDK objects and error classification
The compatibility pull request moves MCP integration to httpx2, updates hosting and conversion code, and removes legacy Tasks APIs. Microsoft documents that WebSocket transport was removed in Python 1.23. Microsoft’s sample documentation says MCP Tasks remain unsupported. Audit direct SDK use alongside framework constructors, including custom parsers, mocks, authentication adapters, and exception handlers. Sources: Microsoft
Issue #7446 identifies the interface changes in the table below, including renamed attributes and numeric timeout values. Use the issue as an audit checklist rather than a final release specification. The attribute changes concern SDK objects. Check serialized payloads and server tool schemas separately before renaming application JSON keys. Sources: Microsoft
Table
Direct SDK migration audit
| Earlier usage | Migration target |
|---|---|
| McpError | MCPError |
| Older error-construction shape | Code, message, and optional data arguments |
| Timedelta-based read timeout | Numeric seconds |
| mimeType | mime_type |
| structuredContent | structured_content |
| isError | is_error |
| inputSchema | input_schema |
The SDK migration documentation assigns different errors to HTTP 404 responses depending on whether a session exists. An established session yields code -32600 for termination; a missing session yields -32601 for not found. Other HTTP 4xx and 5xx responses produce -32603 for a server error response. Handlers expecting positive 32600 or the old transport-context HTTPStatusError path no longer match those cases. Test ordinary HTTP errors, expired sessions, and definitive connection loss separately. Sources: Model Context Protocol
Microsoft’s documentation names different libraries for custom HTTP clients. Microsoft Learn’s cookie guidance names httpx.AsyncClient. The migration pull request moves MCP transport support to httpx2. Verify accepted client types against the pinned implementation before copying that example. Sources: Microsoft Learn, Microsoft
Choose the owner before adding recovery
Microsoft documents framework-owned construction through a URL for HTTP or a command for standard input/output transport, or stdio. For caller ownership, enter mcp.Client first, pass it through mcp_client, and keep it entered throughout the agent or workflow run. Agent Framework does not enter, close, replace, or recreate that client. Microsoft also prohibits combining mcp_client with a URL, command, headers, or transport-construction options. Sources: Microsoft Learn, Microsoft
The following scaffolds assume a local server exposing an echo tool. The first delegates lifecycle management to the framework; the second follows Microsoft’s documented caller-owned nesting. The scaffolds and proposed acceptance tests have not been executed. Python 1.23.0 includes the ownership-aware recovery change: an ended caller-owned client requires replacement before another remote procedure call reaches it. The architectural contracts describe the moving main branch. Current Microsoft Learn and sample documentation also should not be treated as specifications for the 1.23.0 release. Check constructor options, client types, session behavior, and cancellation details against the pinned version. Establish normal entry, invocation, and exit before introducing failures. Sources: Microsoft, Microsoft Learn
from agent_framework import MCPStreamableHTTPTool
async def framework_owned(url):
async with MCPStreamableHTTPTool(
name="probe",
url=url,
load_prompts=False,
) as tool:
return await tool.call_tool("echo", text="hello")from mcp import Client
from agent_framework import MCPStreamableHTTPTool
async def caller_owned(url):
async with Client(server=url) as client:
async with MCPStreamableHTTPTool(
name="probe",
mcp_client=client,
load_prompts=False,
) as tool:
result = await tool.call_tool("echo", text="hello")
# Test client usability here, before leaving its owning context.
return resultMicrosoft’s architectural guidance says both high-level ownership modes use mcp.Client and have no session. MCPTool.session applies only to the deprecated low-level ClientSession path. Microsoft documents that caller-supplied low-level sessions remain uncached. They receive no automatic retries for missing-resource or missing-template responses. Application ownership allows a client lifetime shared across operations. The application handles replacement and orderly closure. Sources: Microsoft
Separate reconnection from operation replay
Pull request #9583 guards discovery, liveness checks, tool calls, and prompt calls against definitive caller-owned connection loss. It describes a replacement error before reconnect logging or a second remote procedure call to the ended client, while leaving framework-owned recovery unchanged. Test each guarded path independently, including discovery and liveness checks. Sources: Microsoft
Use a controllable local server and assign each invocation a unique identifier. Log receipt, completion, connection identity, and cleanup so reconnect attempts cannot hide duplicate work. The table below proposes checks for both ownership modes, including a write that completes just before its response disappears.
Table
Proposed connection ownership acceptance tests
| Scenario | Framework-owned check | Caller-owned check |
|---|---|---|
| Normal read and exit | Check entry and cleanup | Check client usability after wrapper exit |
| Definitive loss during discovery | Record replacement and discovery attempts | Check replacement error and absence of a substitute or second call |
| Loss during tool or prompt call | Record reconnect and operation attempts separately | Check that replacement is required |
| Write completes; response is lost | Detect duplicates by invocation ID | Detect duplicates by invocation ID |
| Application supplies replacement | Not applicable | Check operation with a newly entered client and wrapper |
| Tool error with live transport | Check for transport-loss misclassification | Check that the healthy client is preserved |
Replacing a connection and replaying an operation are separate events. An exception after a write does not prove the write failed. For write tools, test idempotency and expose duplicate execution before enabling application retries.
Make cancellation and cleanup observable
Microsoft’s architectural guidance says canceled queued connection requests should be skipped, while cancellation before acceptance of a new connection triggers teardown. Canceling a redundant connect must preserve an established connection, and canceling a close waiter must not interrupt teardown. Use barriers or events to reach these boundaries deterministically instead of relying on short sleeps. Sources: Microsoft
- Cancel a queued connection request before setup starts.
- Cancel after transport establishment but before successful setup is accepted.
- Cancel a redundant connection request while another connection remains healthy.
- Cancel an in-flight slow tool call.
- Cancel the task awaiting close while teardown is blocked.
- Shut down with active calls, then repeat shutdown.
Count transport entries and exits, outstanding tasks, HTTP-client closures, and stdio child-process exits. Give cleanup an explicit deadline and fail the test if resources remain. For caller-owned clients, close the wrapper, check that the client still works, then exit its owning context. Also reverse that order deliberately and check for a clear failure without hidden replacement.
Run the matrix across HTTP and stdio, modern and legacy peers, and any retained low-level session path. Include multiple wrappers sharing one caller-owned client if that matches production. Record recovery and cleanup durations, duplicate invocations, and leaked resources separately from normal connection and call latency. Use those observations as migration acceptance criteria, including explicit checks for shutdown completion.