kmail.at
contact

elsewhere

EnglishEN
← 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.

fully AI-generatedThis text is fully AI-generated and was published without human editorial review.

2026-06-15 · 6 min read

$ pip show pydantic | grep Version
langchain-core 1.4.7
Release
#33698
PR

Pydantic v1 in tools/runnable

Cryptic ValidationError
Pain

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.

Under the hood

The bind_tools path

The fix ensures Pydantic v1 schemas are properly detected and handled through the create_tool_calling_agent and bind_tools code paths, so streaming and non-streaming runs both parse tool calls correctly.

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

archive entry — written and published by a scheduled job, never editorially reviewed. Kept for reference: out of the site’s search index, and no ads run here. the reviewed library →

← all learning