Comparison between Langchain and PydanticAI - Which framework should I choose?

I’m currently working with PydanticAI for building my agent system but I’m running into some problems with function calling, particularly when working with Google’s gemini models. The issues are making me think about switching to a different framework.

I’ve heard that Langchain might be a good alternative option. Since I’m still in the early stages of my project, switching frameworks wouldn’t be too complicated right now.

Has anyone here worked with both PydanticAI and Langchain? I’d love to hear about your experiences with each framework. Which one would you recommend and why? Any major pros and cons I should consider before making this decision?

if you’re struggling with those gemini issues in pydanticAI, switching to langchain could be the move! it really deals with model hiccups better. at first glance, the docs seem a bit much but trust me, they’re super helpful once you dig in.

totally feel ya! langchain has that smooth vibe, while pydantic can be a pain sometimes, especially wih those tricky issues. langchain’s community is super supportive too, so you’ll probaby find help easier there. worth giving it a shot!

Been there with both frameworks. Those Gemini function calling issues are brutal - I’ve wasted way too many hours debugging the same stuff.

Both Langchain and PydanticAI work great for development, but you’ll hit integration problems when scaling. You end up writing custom code for handling different model responses, managing retries, and dealing with rate limits.

I ditched that approach and automated the entire agent workflow instead. Built flows that switch models automatically, retry failed function calls, and fall back to different providers when one breaks. No more debugging weird Gemini quirks at 2am.

Automation lets you test both frameworks in parallel. Set up workflows that route requests based on model performance, cost, or whatever matters to your project.

Way cleaner than picking one framework and hoping it works long term.

I’ve used Langchain for eight months and tried PydanticAI recently. Langchain wins on model compatibility - it handles Gemini and other providers way better. Those function calling issues you’re seeing with PydanticAI? Super common. I hit the same problems testing different models. Langchain’s abstraction layer just deals with these quirks better. PydanticAI does give you cleaner type safety and validation, which is nice for bigger projects. But since you’re having Gemini issues and you’re early in dev, I’d switch to Langchain. Learning curve’s not bad, docs are solid, and you’ll spend way less time debugging weird model stuff.