Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 06:00 UTC
fix(py): use `inspect.iscoroutinefunction` for custom tool async checks (#5289)
This PR: - closes https://github.com/ComposioHQ/composio/issues/5264 - replaces the two `asyncio.iscoroutinefunction` checks in `custom_tool.py` with `inspect.iscoroutinefunction`, so registering custom tools no longer emits a `DeprecationWarning` on Python 3.14+ - removes the now-unused `asyncio` import, which the repo's Ruff config flags - keeps async-tool rejection unchanged: both helpers agree on `async def`, bound async methods, `functools.partial`, `AsyncMock`, and `inspect.markcoroutinefunction` on Python 3.11, 3.12, and 3.15 - builds on the fix by @AbhishekOjha0789 (commit f17406e, kept with original authorship), who could not open the PR because PR creation is restricted to collaborators ## Verification - Python 3.15.1, `-W error::DeprecationWarning`, `tests/test_custom_tools.py` + `tests/test_tool_router.py`: 108 failures on `next`, all from this warning; 333 passed with the fix (isolated env, since the locked `pydantic-core` has no 3.15 wheel) - Locked Python 3.12 env: full `python/tests` suite 2487 passed, 215 skipped - `ruff check --config config/ruff.toml composio/ tests/`, `ruff format --check`, and `SDK_RELEASE_NOTE_BASE=origin/next pnpm validate:changesets` pass; mypy reports nothing in `custom_tool.py` --------- Co-authored-by: Abhishek Ojha <abhishekojha0789@gmail.com>