lif d4e623d069
fix: Raise error when async function is passed to Tool (#10264)
* fix: Raise error when async function is passed to Tool

- Added validation in Tool.__post_init__ to check if function is async
- Added validation in create_tool_from_function for early error detection
- Updated docstring to clarify that functions must be synchronous
- Added tests for both Tool init and @tool decorator with async functions

Closes #9580

* fix: Remove redundant async check from create_tool_from_function

Per reviewer feedback, the async validation is only needed in the
Tool class itself, since create_tool_from_function creates a Tool.

- Remove async check from create_tool_from_function
- Update docstrings to remove async-related notes
- Remove redundant tests for async functions in from_function tests
- Add release note

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add docstring note and tests for async function validation

- Updated Tool class docstring to indicate function must be synchronous
- Added test_from_function_async_raises_error test
- Added test_tool_decorator_async_raises_error test

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-19 12:40:38 +01:00
..