<#758 fix: always use .aio() for Flyte tasks in Fu...
# flyte-github
a
#758 fix: always use .aio() for Flyte tasks in FunctionTool.execute() Pull request opened by AdilFayyaz Summary: • FunctionTool.execute() was only calling task.aio() for async tasks; sync tasks fell through to asyncio.to_thread(self.func, ...), bypassing the Flyte task infrastructure entirely • Fix: always call task.aio() when a task is present, regardless of whether the underlying function is async Test plan: • test_function_tool_execute_sync_flyte_task_uses_aio — verifies task.aio() is called (not raw func) for sync Flyte tasks • test_function_tool_execute_async_flyte_task_uses_aio — verifies task.aio() is called for async Flyte tasks • test_function_tool_execute_flyte_task — verifies correct result is returned for sync Flyte tasks • Run full suite: cd plugins/anthropic && uv run pytest tests/test_agents.py flyteorg/flyte-sdk