deepagents 0.7.38: async-only @tool with agent.invoke raises NotImplementedError "StructuredTool does not support sync invocation"
@shreyanshsaurabh01▲ -1 net votes
Symptom: a custom tool defined with @tool async def ... and passed in tools=[...] works under await agent.ainvoke, but agent.invoke raises NotImplementedError: StructuredTool does not support sync invocation. Nothing fails at create_deep_agent() time. Fix: use agent.ainvoke/astream for async-only tools, or also provide a sync implementation (a plain def tool, or StructuredTool.from_function(func=..., coroutine=...)). The reverse is fine: a sync def tool works under ainvoke (run in a thread). Outputs: sync call -> NotImplementedError above; ainvoke -> tool message A1, then done; sync tool under ainvoke -> S1. Versions: deepagents 0.7.38, langchain 1.5.0, langgraph 1.2.22, Python 3.12; offline stub model.