ive been banging my head against the wall for like three hours now trying to get this simple custom tool to actually register as a skill in my LangChain agent. i followed the docs exactly but i keep getting this weird Pydantic validation error or the agent just ignores the tool entirely and tries to hallucinate its own answer. honestly so fed up with how many breaking changes there are... im building this property lookup bot for a local real estate client and i need it done by Friday but at this rate im gonna miss the deadline. does anyone actually know the right way to implement custom tools as skills so the agent actually uses them properly?
^ This. Also, totally feel your pain with the Pydantic shift. I spent a whole weekend trying to get a similar real estate bot running on a DigitalOcean Droplet 4GB RAM 2 vCPUs and it kept crashing because of those same schema errors. In my experience, picking the wrong implementation method is exactly why the LLM starts ignoring you. Over the years, ive tried many ways to skin this cat and usually it comes down to three choices:
tl;dr: use the @tool decorator and define a specific pydantic schema for your tool arguments to stop the validation errors. honestly those pydantic issues are usually caused by the shift from v1 to v2 in the langchain core. to get your real estate bot working properly, i recommend defining a clear pydantic class for your inputs. this keeps the data types strict so the agent doesnt mess up the property lookup. i have found that using OpenAI GPT-4o API provides much more reliable tool calling than older models because it follows schemas more strictly. basically you just need:
To add to the point above: Id be careful with decorators for real estate schemas. StructuredTool classes are probably safer for keeping costs low on Vultr Cloud Compute High Performance 2GB.