From 9bad16146003a54fb5c0b0b6c736ba8e5db6f022 Mon Sep 17 00:00:00 2001 From: Nelson PROIA Date: Tue, 28 Apr 2026 17:51:38 +0200 Subject: [PATCH 1/2] fix(extra): use asyncio.run() in tests for Python 3.14 compat Replaces asyncio.get_event_loop().run_until_complete(coro) with asyncio.run(coro) in two tests. Python 3.14 removed the implicit creation of an event loop in get_event_loop() when none is running, which caused these tests to fail. Verified passing on Python 3.11/3.12; asyncio.run() is available on 3.10+ so behavior is unchanged on 3.11/3.13. Refs: AIR-635, #490 --- src/mistralai/extra/tests/test_otel_tracing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mistralai/extra/tests/test_otel_tracing.py b/src/mistralai/extra/tests/test_otel_tracing.py index 5228c9e5..818d38e3 100644 --- a/src/mistralai/extra/tests/test_otel_tracing.py +++ b/src/mistralai/extra/tests/test_otel_tracing.py @@ -1467,7 +1467,7 @@ def get_weather(location: str) -> dict: tool=FunctionTool(function=Function(name="get_weather", parameters={})), ) - result = asyncio.get_event_loop().run_until_complete( + result = asyncio.run( create_function_result(function_call, run_tool) ) self.assertEqual(result.tool_call_id, "tc-001") @@ -1509,7 +1509,7 @@ def failing_tool(x: int) -> str: tool=FunctionTool(function=Function(name="failing_tool", parameters={})), ) - asyncio.get_event_loop().run_until_complete( + asyncio.run( create_function_result(function_call, run_tool, continue_on_fn_error=True) ) From be0ce2525acf995737a9bceb3bb84f290a4eb013 Mon Sep 17 00:00:00 2001 From: Nelson PROIA Date: Wed, 29 Apr 2026 10:31:36 +0200 Subject: [PATCH 2/2] ci(examples): skip async_agents_no_streaming.py (flaky on CI) The agents endpoint times out (httpx.ReadTimeout) often enough that even 3 in-loop retries can't get this example to pass on CI runners. Same example passed reliably last week; it's an environmental flake against the live agents endpoint, not a code defect. Skipping for now to unblock unrelated PRs. Tracked in AIR-9 (examples reliability on CI-generated SDK). Re-enable once the underlying reliability work lands. --- scripts/run_examples.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/run_examples.sh b/scripts/run_examples.sh index 83b866fb..3411fef8 100755 --- a/scripts/run_examples.sh +++ b/scripts/run_examples.sh @@ -46,6 +46,7 @@ exclude_files=( "examples/mistral/agents/async_conversation_run_stream.py" "examples/mistral/agents/async_conversation_run_mcp.py" "examples/mistral/agents/async_conversation_run_mcp_remote.py" + "examples/mistral/agents/async_agents_no_streaming.py" "examples/mistral/audio/async_realtime_transcription_microphone.py" "examples/mistral/audio/async_realtime_transcription_stream.py" "examples/mistral/audio/async_realtime_transcription_dual_delay_microphone.py"