create_tool_calling_agent raises ValueError: This function requires a .bind_tools method be implemented on...

Wrapping a chat model with .withfallbacks([fallbackmodel]) and passing the result to createtoolcallingagent raised ValueError: This function requires a .bindtools method be implemented on the LLM. The same error also hit AzureChatOpenAI users importing from langchaincommunity. The code worked fine without withfallbacks; hasattr on the wrapped model showed bind_tools missing (False vs True on the raw model). Reported on langchain 0.1.16 / langchain-core 0.1.43.

The root cause: withfallbacks wraps the model in a Runnable that hid bindtools, so the agent factory could not find the method. A maintainer linked the fix in PR #22139, which forwards bindtools through fallbacks: upgrade to langchain-core>=0.2.2. For the AzureChatOpenAI variant, the fix was importing the model from the right package instead of the legacy path, which a reporter confirmed resolved it: from langchainopenai import AzureChatOpenAI (replacing from langchaincommunity.chatmodels import AzureChatOpenAI). Source: https://github.com/langchain-ai/langchain/issues/20499

Source: https://github.com/langchain-ai/langchain/issues/20499