Skip to main content
Breaking News
0

LangChain 1.5 and langchain-openrouter 0.3.0 Migration Guide for Python 3.11

How to upgrade off end-of-life Python 3.10, lock langchain-core 1.8.4, and adopt 1.5.2 middleware safely

Abdelrahman Shawqi Abdelrahman Shawqi
LangChain 1.5 and langchain-openrouter 0.3.0 Migration Guide for Python 3.11

The LangChain 1.5 and langchain-openrouter 0.3.0 migration requires upgrading your runtime from end-of-life Python 3.10 to Python 3.11 or newer, pinning langchain-core>=1.8.3 (latest 1.8.4) and langgraph>=1.2.16, and adopting create_agent alongside beta middleware APIs before LangChain 0.3 security maintenance ends in December 2026.

What Changed in LangChain 1.5.2 and langchain-openrouter 0.3.0

Between November 11 and November 19, 2026, the LangChain maintainers shipped a coordinated wave of releases across the official langchain-ai/langchain GitHub repository. The headline shift is the formal removal of Python 3.10—which reached official end-of-life—from langchain 1.5.0 (followed by patches 1.5.1 and 1.5.2 on November 18), langchain-core 1.8.x, and langchain-openrouter 0.3.0 (released November 19 via PR #41957 and PR #41268).

For Python teams routing requests through OpenRouter to frontier models like Gemini 4 Neon, Claude Fable 5.2, or GPT-6.2, staying on Python 3.10 now silently freezes your dependency solver on langchain-openrouter 0.2.x (capped at 0.2.9). That means missing refreshed model profile registries, updated TLS certificates (certifi 2026.10.19 and urllib3 2.8.0), relaxed third-party upper bounds, and standardized streaming finish-reason telemetry introduced in langchain-core 1.8.4.

Package Compatibility Matrix for November 2026

Because LangChain's 1.x ecosystem splits core abstractions, agent graphs, and partner integrations into independently versioned wheels, mismatched pins frequently break CI pipelines. The matrix below maps verified November 2026 releases and minimum floors.

Package Name Verified Latest Version Minimum Python Key Dependency Floor Notable November 2026 Change
langchain 1.5.2 (Nov 18, 2026) Python 3.11+ (up to 3.14) langchain-core>=1.8.0, langgraph>=1.2.16 ModelRouterMiddleware beta; synthetic HITL tool metadata (#41928)
langchain-openrouter 0.3.0 (Nov 19, 2026) Python 3.11+ langchain-core>=1.8.3 Drops Python 3.10; refreshed model profiles; urllib3 2.8.0
langchain-core 1.8.4 (Nov 19, 2026) Python 3.11+ langsmith client bundled Standardized finish reason on message-finish events (#41926)
langchain-openai 1.8.5 (Nov 19, 2026) Python 3.11+ langgraph>=1.2.16 Preserves streamed Responses tool args (#41963); GPT-6.2 support
langchain-anthropic 1.7.12 (Nov 19, 2026) Python 3.11+ langgraph>=1.2.16 Isolates async HTTP clients per model (#41946)

Why Python 3.11 Is Now Non-Negotiable

Python 3.11 unlocks faster bytecode specialization, native ExceptionGroup handling for concurrent async agent nodes, and zero-overhead typing syntax that LangChain's partner packages now assume at import time. Containerized deployments running base images like python:3.10-slim will fail to resolve langchain==1.5.2 or langchain-openrouter==0.3.0, forcing package managers like uv and pip to backtrack onto older wheels.

Equally urgent is the sunset clock on the legacy 0.3.x branch. Under LangChain's published release policy, maintenance and security patches for LangChain 0.3 (such as the CVE-2026-34070 path-traversal fix in langchain-core 0.3.86) end permanently in December 2026. Migrating directly to Python 3.11 and LangChain 1.5 eliminates both the Python EOL risk and the 0.3 security cliff in a single sprint.

Key Runtime Fixes Inside LangChain 1.5.1 and 1.5.2

Upgrading past 1.5.0 to 1.5.2 resolves subtle concurrency bugs that affected high-traffic FastAPI and Celery workers. Specifically, 1.5.1 fixed warning-filter race conditions inside provider inference (PR #41880) and ModelRequest (PR #41879) while making warning suppression context-local (PR #41881). It also bumped opentelemetry-api to 1.45.2 and dnspython to 2.9.2. Then 1.5.2 added source metadata tagging to synthetic Human-in-the-Loop (HITL) tool messages (PR #41928), letting observability dashboards distinguish human-injected approvals from model-generated tool outputs.

Pinning Python 3.11+ with langchain==1.5.2, langchain-core==1.8.4, and langchain-openrouter==0.3.0 prevents silent 0.2.x solver downgrades and locks in standardized streaming finish reasons across every provider.

Step-by-Step Migration Playbook for Python 3.11 Teams

Follow this ordered checklist to upgrade production repositories cleanly without breaking active agent graphs or OpenRouter streaming handlers:

  1. Upgrade Dockerfiles and CI runners to Python 3.11 or 3.12: Replace python:3.10-slim with python:3.11-slim (or 3.12/3.13) and update requires-python = ">=3.11" in your pyproject.toml.
  2. Cleanly separate legacy 0.x imports if needed: In LangChain 1.x, legacy classes such as LLMChain, RetrievalQA, and ConversationBufferMemory no longer ship in the main package. Either install langchain-classic as a temporary bridge or refactor onto langchain.agents.create_agent backed by LangGraph.
  3. Upgrade and lock the core dependency bundle: Run uv add "langchain>=1.5.2" "langchain-core>=1.8.4" "langchain-openrouter>=0.3.0" "langgraph>=1.2.16" (or the equivalent pip install -U command) and verify with uv pip list that langchain-openrouter resolved to 0.3.0 rather than 0.2.9.
  4. Standardize model initialization via init_chat_model: Follow the LangChain Models documentation to initialize OpenRouter and sibling providers through init_chat_model so you can swap model slugs without rewriting application logic.
  5. Audit streamed tool-call parsers and finish reasons: Confirm that any streaming UI consuming astream_events() handles slice-based tool-call argument chunks (introduced in langchain-core 1.7.0) and inspects the newly standardized finish reason on message-finish events.
  6. Evaluate beta middleware for dynamic routing: Test ModelRouterMiddleware (available in langchain>=1.5.0) in staging to route simple queries to cheaper OpenRouter models while escalating complex tool chains automatically.
Common Pitfalls That Break LangChain 1.5 Upgrades
  • Silent 0.2.x resolution on Python 3.10: Running pip install -U langchain-openrouter inside a forgotten Python 3.10 virtual environment exits with code 0 while keeping 0.2.9 installed.
  • Stale langgraph pins: Partner releases like langchain-openai 1.8.4+ and langchain-anthropic 1.7.12 now enforce langgraph>=1.2.16; older pins trigger resolver conflicts.
  • Deprecated experimental middleware imports: Decision-driven middleware using TypeSafeClassifier moved out of experimental namespaces into langchain.agents.middleware in 1.5.0.
Verifying Your Upgraded Environment in CI

Before merging your migration pull request, add an automated CI assertion that prints sys.version_info, confirms langchain.__version__ >= "1.5.2" and langchain_core.__version__ >= "1.8.3", and runs a smoke test with LANGSMITH_TRACING=false so unit tests stay deterministic and free of accidental external trace traffic.

Frequently Asked Questions

What happens if I stay on Python 3.10 with langchain-openrouter?

Your package manager will continue resolving langchain-openrouter 0.2.x (up to 0.2.9). You will not receive 0.3.0's refreshed OpenRouter model profiles, dependency updates, or compatibility with langchain-core>=1.8.3.

Does upgrading from LangChain 1.4 to 1.5 break existing create_agent code?

No breaking API removals occur between 1.4 and 1.5 for standard create_agent code. The primary migration requirements are raising your runtime to Python 3.11+ and updating langchain-core and langgraph floors in your lockfile.

When does LangChain 0.3 security support end?

According to LangChain's published release policy, maintenance and security fixes for the 0.3.x line conclude in December 2026, making November 2026 the ideal window to complete your move to 1.5.x.

Share Article: Facebook WhatsApp X Telegram LinkedIn
Abdelrahman Shawqi
Abdelrahman Shawqi Author at Egy Monitor

The manger of EgyMonitor

What do you think of this article?

Related Articles

View More

Comments (0)

Leave a Comment

Be the first to comment on this article!