diff --git a/python/packages/autogen-core/src/autogen_core/tools/_function_tool.py b/python/packages/autogen-core/src/autogen_core/tools/_function_tool.py index 12cee716f23f..17eec0701a92 100644 --- a/python/packages/autogen-core/src/autogen_core/tools/_function_tool.py +++ b/python/packages/autogen-core/src/autogen_core/tools/_function_tool.py @@ -1,6 +1,7 @@ import asyncio import functools import warnings +import typing from textwrap import dedent from typing import Any, Callable, Sequence @@ -87,6 +88,12 @@ def __init__( ) -> None: self._func = func self._global_imports = global_imports + + # Validate type hints exist + hints = typing.get_type_hints(func) + if not hints: + raise TypeError(f"Function '{func.__name__}' has no type hints. All parameters must be annotated.") + signature = get_typed_signature(func) func_name = name or func.__name__ args_model = args_base_model_from_signature(func_name + "args", signature)