Description
In the description of #5687, it mentioned that the error is wrapped in a ToolException after the fix. However, it raised the following error instead in my test: Error: ('Failed to enter context manager.', ExceptionGroup('unhandled errors in a TaskGroup', [ConnectError('All connection attempts failed')]))”.
Code Sample
This is the sample code example as #5667.
import asyncio
import os
import dotenv
from agent_framework import Agent, MCPStreamableHTTPTool
from agent_framework.openai import OpenAIChatCompletionClient
from httpx import AsyncClient
dotenv.load_dotenv()
async def http_mcp_example():
"""Example using an HTTP-based MCP server."""
client = OpenAIChatCompletionClient(
azure_endpoint=os.environ["AI_PLATFORM_ENDPOINT"],
api_key=os.environ["AI_PLATFORM_API_KEY"],
model="gpt-5.4-2026-03-05",
)
try:
async with (
MCPStreamableHTTPTool(
name="Microsoft Learn MCP",
url="https://127.0.0.1:12345/mcp", # Simulate downed MCP server.
http_client=AsyncClient(verify=False),
) as mcp_server,
Agent(
client=client,
name="DocsAgent",
instructions="You help with Microsoft documentation questions.",
) as agent,
):
result = await agent.run(
"How to create an Azure storage account using az cli?", tools=mcp_server
)
print(result)
except Exception as e: # The error is not handled due the bug.
print(f"Error: {e}")
if __name__ == "__main__":
asyncio.run(http_mcp_example())
Error Messages / Stack Traces
Error: ('Failed to enter context manager.', ExceptionGroup('unhandled errors in a TaskGroup', [ConnectError('All connection attempts failed')]))
Package Versions
agent-framework: 1.3.0
Python Version
Python: 3.14
Additional Context
No response
Description
In the description of #5687, it mentioned that the error is wrapped in a
ToolExceptionafter the fix. However, it raised the following error instead in my test:Error: ('Failed to enter context manager.', ExceptionGroup('unhandled errors in a TaskGroup', [ConnectError('All connection attempts failed')]))”.Code Sample
Error Messages / Stack Traces
Error: ('Failed to enter context manager.', ExceptionGroup('unhandled errors in a TaskGroup', [ConnectError('All connection attempts failed')]))Package Versions
agent-framework: 1.3.0
Python Version
Python: 3.14
Additional Context
No response