kmail.at
← learning

langchain · difficulty ◆◆

Pydantic v1 Support Fix in tools/runnable

Bind Pydantic v1 tools without a forced v2 migration.

Reliable tool calling should not require a Pydantic v2 migration. This fix keeps v1 teams shipping.

2026-06-15 · 6 min read

$ pip show pydantic | grep Version

What it does

LangChain has been migrating to Pydantic v2, but many projects still rely on v1. The fix in langchain-core==1.4.7 (PR #33698) corrects how tools/runnable handles Pydantic v1 models around serialization, deserialization, and tool-binding with Runnable objects. Before the fix, using @tool decorators or BaseTool subclasses with v1 schemas could raise ValidationError or silently corrupt data during streaming runs.

Why it matters

If you run LangChain on an older codebase that hasn’t migrated to Pydantic v2, tool-calling chains could fail at runtime with cryptic validation errors, especially when you use ChatOpenAI.bind_tools([my_pydantic_v1_tool]), define tools with v1 BaseModel input schemas, or rely on Tool.from_defaults() with v1 models. The fix means you no longer need to upgrade to v2 just to use tool calling reliably.

Example

$ Bind a Pydantic v1-style tool and invoke
Model: gpt-4o
Tool calls: [{'name': 'web_search', 'args': {'query': 'pizza place', 'region': 'Brooklyn'}, 'id': '...'}]
Result: Results for 'pizza place' in Brooklyn

No ValidationError is raised; the tool schema is parsed and invoked correctly.

Common flags

@tool(args_schema=SearchInput)
Attach a Pydantic v1 model as the input schema
Tool.from_defaults()
Create a tool instance with default config on v1 schemas

History

Origin

Fixed in langchain-core==1.4.7 (2026-06-12), PR #33698, covered in the June 15 tutorial.

Compatibility layer

The fix patches the v1 compatibility layer so v1 schemas are detected and handled throughout the bind_tools and agent-creation code paths.

Fun facts

Pros & cons

pros

  • + Tool calling works on v1
  • + No forced migration
  • + Covers serialization and streaming

cons

  • − Core-only fix
  • − v1 remains deprecated upstream

Takeaways

  1. 1Check your Pydantic version with pip show pydantic.
  2. 2Bind v1-schema tools with bind_tools() after upgrading core to 1.4.7.
  3. 3Test streaming tool calls to confirm the parser stays correct.

Related commands

← all learning