Logo
Upgrading to LangGraph 1.0: A Complete Migration Guide
LangGraphAILangChainTypeScriptMigration GuideAgent Development

Upgrading to LangGraph 1.0: A Complete Migration Guide

Colin McNamara
Oct 22 2025

Upgrading to LangGraph 1.0: A Complete Migration Guide

Introduction

LangGraph 1.0 was officially released on October 17, 2025, marking a significant milestone for the low-level agent orchestration framework. This guide walks through our real-world upgrade from LangGraph 0.3.1 to 1.0.0, including all the challenges we faced and how we solved them.

TL;DR: If your code already uses Annotation.Root, you're 90% ready for LangGraph 1.0. The main work involves updating dependencies and handling Zod v4 breaking changes.

What Changed in LangGraph 1.0?

LangGraph 1.0 is a stability-focused release with no breaking changes for code using modern patterns. The key improvements include:

  • Battle-tested in production at companies like Uber, LinkedIn, and Klarna
  • Enhanced type safety and developer ergonomics
  • Better integration with LangChain v1
  • Requires Zod v4 (major breaking change for error handling)
  • Compatible with OpenAI SDK v6

Prerequisites Check

Before starting, verify your current implementation:

# Check current versions
npm list @langchain/langgraph @langchain/core @langchain/openai zod

# Check if you're using Annotation.Root (the modern pattern)
grep -r "Annotation.Root" src/

If you see Annotation.Root in your graphs, you're already using 1.0-compatible patterns! πŸŽ‰

Our Starting Point

Before Upgrade:

  • @langchain/langgraph: 0.3.1
  • @langchain/core: 0.3.57
  • @langchain/openai: 0.3.17
  • zod: 3.23.8
  • openai: 4.29.2

After Upgrade:

  • @langchain/langgraph: 1.0.0
  • @langchain/core: 1.0.1
  • @langchain/openai: 1.0.0
  • zod: 4.1.12
  • openai: 6.6.0

Step-by-Step Upgrade Process

Step 1: Update Package Dependencies

First, update your package.json:

{
  "dependencies": {
    "@langchain/core": "^1.0.1",
    "@langchain/langgraph": "^1.0.0",
    "@langchain/openai": "^1.0.0",
    "zod": "^4.1.12",
    "openai": "^6.6.0"
  }
}

Then install:

npm install

Expected Issue: You'll likely see peer dependency warnings. Don't worryβ€”we'll resolve these.

Step 2: Handle Zod v4 Breaking Changes

This was the biggest challenge in our upgrade. Zod v4 renamed the errors property to issues.

Before (Zod v3):

const validation = schema.safeParse(data);
if (!validation.success) {
  const errorMessage = validation.error.errors[0].message;
  toast.error(errorMessage);
}

After (Zod v4):

const validation = schema.safeParse(data);
if (!validation.success) {
  const errorMessage = validation.error.issues[0].message;
  toast.error(errorMessage);
}

Bulk Fix Command:

# Find all instances
grep -r "\.error\.errors" src/ --include="*.ts" --include="*.tsx"

# Replace them all (macOS)
find src -name "*.tsx" -o -name "*.ts" | xargs sed -i '' 's/\.error\.errors\[/\.error\.issues\[/g'

# Replace them all (Linux)
find src -name "*.tsx" -o -name "*.ts" | xargs sed -i 's/\.error\.errors\[/\.error\.issues\[/g'

Files we updated: 21 files across form validation and API error handling.

Step 3: Verify LangGraph Graph Implementations

The good news: no code changes needed if you're already using Annotation.Root!

Example of 1.0-compatible code:

import { Annotation, StateGraph } from "@langchain/langgraph";

// This pattern is LangGraph 1.0 compatible
const GraphAnnotation = Annotation.Root({
  messages: Annotation<BaseMessage[]>({
    reducer: (current, update) => [...current, ...update],
    default: () => [],
  }),
  productName: Annotation<string>({
    reducer: (_, update) => update ?? "",
    default: () => "",
  }),
});

// Extract type for use in nodes
type GraphState = typeof GraphAnnotation.State;

// Create graph (no changes needed)
const workflow = new StateGraph(GraphAnnotation)
  .addNode("process", processNode)
  .addNode("analyze", analyzeNode)
  .addEdge("__start__", "process")
  .addEdge("process", "analyze")
  .addEdge("analyze", "__end__");

const graph = workflow.compile();

Old Pattern (Don't use this):

// ❌ This is the OLD pattern
import { StateGraph, StateGraphArgs } from "@langchain/langgraph";

interface WorkflowState {
  messages: BaseMessage[];
}

const stateChannels: StateGraphArgs<WorkflowState>["channels"] = {
  messages: {
    reducer: (current, update) => current.concat(update),
    default: () => [],
  },
};

const workflow = new StateGraph<WorkflowState>({ channels: stateChannels });

Step 4: Fix OpenAI SDK v6 Compatibility Issues

If you're using a custom OpenAI router (like Requesty or OpenRouter), you'll need to update your fetch wrapper.

Before (OpenAI SDK v4):

export function getLangChainConfig() {
  return {
    openAIApiKey: process.env.API_KEY,
    configuration: {
      baseURL: process.env.BASE_URL,
      fetch: async (url: string, init: any) => {
        // Custom fetch logic
        return fetch(url, init);
      }
    }
  };
}

After (OpenAI SDK v6 + LangChain v1):

export function getLangChainConfig() {
  return {
    apiKey: process.env.API_KEY,  // Changed from openAIApiKey
    configuration: {
      baseURL: process.env.BASE_URL,
      // Updated fetch signature
      fetch: async (url: RequestInfo | URL, init?: RequestInit) => {
        // Custom fetch logic with proper types
        return fetch(url, init);
      }
    }
  };
}

Key changes:

  1. openAIApiKey β†’ apiKey
  2. Fetch signature: (url: string, init: any) β†’ (url: RequestInfo | URL, init?: RequestInit)

Step 5: Run Tests and Build

# Run unit tests
npm test

# Check TypeScript compilation
npx tsc --noEmit

# Run production build
npm run build

Our Results:

  • βœ… 32/32 tests passing (100%)
  • βœ… Zero TypeScript errors
  • βœ… Clean production build
  • βœ… No deprecation warnings

Common Issues and Solutions

Issue 1: Peer Dependency Conflicts

Symptom:

npm error invalid: @langchain/core@1.0.1 (peer dependency conflict)

Solution: Check peer dependencies for all packages:

npm view @langchain/langgraph@1.0.0 peerDependencies

Ensure openai package supports Zod v4:

npm install openai@^6.6.0

OpenAI SDK v6.6.0+ supports Zod ^3.25 || ^4.0.

Issue 2: React Hook Dependency Warnings

Symptom:

Warning: React Hook useEffect has a missing dependency: 'handleFiles'

Solution: Wrap the function in useCallback:

import { useCallback } from "react";

const handleFiles = useCallback((files: File[]) => {
  // Your logic here
}, [/* dependencies */]);

useEffect(() => {
  // Now safe to use handleFiles
}, [handleFiles]);

Issue 3: Runtime Zod Errors

Symptom:

TypeError: Cannot read property 'errors' of undefined

Solution: You missed some instances. Search for remaining .errors references:

grep -rn "\.error\.errors" src/

Issue 4: 403 Errors with Custom Routers

Symptom: Getting 403 errors from OpenRouter/Requesty after upgrade.

Solution: Update your custom fetch wrapper for OpenAI SDK v6 compatibility. Use proper Headers object:

const customFetch = async (url: RequestInfo | URL, init?: RequestInit) => {
  const headers = new Headers(init?.headers);
  headers.delete('content-length'); // Let fetch recalculate

  return fetch(url, {
    ...init,
    headers,
  });
};

Quality Assurance Testing

We used specialized QA agents to validate the upgrade:

1. EvidenceQA Agent

Screenshot-obsessed QA that requires visual proof:

  • βœ… Verified package versions
  • βœ… Confirmed Zod v4 runtime behavior
  • βœ… Validated all 5 graph implementations
  • βœ… 100% test success rate

2. Code Reviewer Agent

Automated code quality checks:

  • βœ… Dependency safety analysis
  • βœ… Zod migration completeness
  • βœ… Type safety verification
  • βœ… No code smells introduced

Results: Production-ready with 4 minor cleanup items (deprecated configs, legacy test files).

Performance Impact

Before vs After:

  • Build time: ~2 minutes (unchanged)
  • Test suite: 0-1ms per test (unchanged)
  • Bundle size: 118-385 kB per route (unchanged)
  • Memory usage: No significant change

Conclusion: Zero performance regression.

Optional Cleanup Tasks

After the core upgrade, we addressed these quality improvements:

1. Remove Deprecated npm Config

# .npmrc
# Comment out deprecated options
# public-hoist-pattern[]=*prisma*

2. Delete Legacy Test Files

rm test-kosher-catcher.js  # Old CommonJS test file

3. Add Integration Tests

Create test-langgraph-integration.js:

import { runGraph } from './src/libs/myGraph.ts';

async function testGraphExecution() {
  const result = await runGraph({ input: "test" });
  console.assert(result !== null, "Graph should return result");
  console.log("βœ… Integration test passed");
}

testGraphExecution();

Best Practices for LangGraph 1.0

1. Always Use Annotation.Root

// βœ… Good
const GraphAnnotation = Annotation.Root({
  field: Annotation<string>({
    reducer: (x, y) => y ?? x,
    default: () => "",
  }),
});

// ❌ Avoid
const stateChannels = { field: null };

2. Extract Types for Type Safety

type GraphState = typeof GraphAnnotation.State;

async function myNode(state: GraphState): Promise<Partial<GraphState>> {
  // Fully typed!
  return { field: state.field.toUpperCase() };
}

3. Use Appropriate Reducers

const GraphAnnotation = Annotation.Root({
  // Arrays: accumulate
  messages: Annotation<BaseMessage[]>({
    reducer: (current, update) => [...current, ...update],
    default: () => [],
  }),

  // Objects: merge
  analysis: Annotation<{ status: string; data: any }>({
    reducer: (current, update) => ({ ...current, ...update }),
    default: () => ({ status: "pending", data: null }),
  }),

  // Primitives: replace (no reducer needed)
  simpleValue: Annotation<string>({
    default: () => "",
  }),
});

4. Enable Streaming for Better UX

const graph = workflow.compile();

// Stream events
const stream = graph.streamEvents(input, {
  version: "v2",
});

for await (const event of stream) {
  if (event.event === "on_chat_model_stream") {
    console.log(event.data.chunk.content);
  }
}

Migration Checklist

Use this checklist for your upgrade:

  • [ ] Update package.json with 1.0 versions
  • [ ] Run npm install
  • [ ] Fix all Zod v4 changes (.errors β†’ .issues)
  • [ ] Update OpenAI client config if using custom routers
  • [ ] Verify graphs use Annotation.Root pattern
  • [ ] Run npx tsc --noEmit (fix TypeScript errors)
  • [ ] Run npm test (ensure 100% pass rate)
  • [ ] Run npm run build (verify clean build)
  • [ ] Test in development environment
  • [ ] Update integration tests
  • [ ] Review and commit changes
  • [ ] Deploy to staging
  • [ ] Validate in production

Conclusion

Our LangGraph 1.0 upgrade was successful with:

  • Time invested: ~3 hours (including QA and cleanup)
  • Lines changed: 27 files, 863 insertions, 100 deletions
  • Breaking issues: 0 (after following this guide)
  • Production readiness: 100%

The key to a smooth upgrade is:

  1. Already using Annotation.Root pattern
  2. Thorough handling of Zod v4 changes
  3. Comprehensive testing with QA agents
  4. Updating custom integrations (routers, fetch wrappers)

Final verdict: LangGraph 1.0 is production-ready and worth upgrading to. The framework is more stable, better typed, and fully compatible with modern LangChain tooling.

Resources

About This Upgrade

This upgrade was performed on October 21, 2025, for the Always Cool AI platform. Our codebase includes:

  • 5 LangGraph implementations (CRV compliance, Kosher analysis, FDA compliance)
  • 32 comprehensive compliance tests
  • Integration with Requesty router for multi-LLM support
  • Production deployment on Vercel

Questions or issues with your upgrade? Feel free to reference this guide or reach out to the LangGraph community for support.

Last updated: October 21, 2025

Share This Post:

Related Articles

Emerging LLM Security Threats: DarkMind and Beyond
AI SecurityLLMCybersecurityDarkMindDeepSeek

Emerging LLM Security Threats: DarkMind and ...

As large language models (LLMs) become increasingly integrated into our digital infrastructure, new security vulnerabilities continue to emerge. Recent research has uncovered sophisticated attack...

Colin McNamara
Mar 01 2025
Using Mermaid Diagrams in Blog Posts
tutorialdiagramsmermaidtechnical-writing

Using Mermaid Diagrams in Blog Posts

Effective technical communication often requires visual representation of complex concepts. Always Cool AI's blog platform now supports Mermaid diagrams, allowing you to embed flowcharts, sequence...

Colin McNamara
Mar 01 2025
Upgrading to LangGraph 1.0: A Complete Migration Guide | Always Cool AI