Skip to content

LangGraph Upgrade to Fix tools_condition Import #43

@StamKavid

Description

@StamKavid

Issue Description

The application is encountering an import error when trying to use tools_condition from langgraph.prebuilt:

ImportError: cannot import name 'tools_condition' from 'langgraph.prebuilt' (unknown location)

Root Cause

The tools_condition function was introduced in LangGraph version 0.6.x, but the current dependency constraint allows for older versions that don't include this function.

Current State

  • Current dependency: langgraph>=0.2.70 (in pyproject.toml)
  • Required version: langgraph>=0.6.3
  • Error location: Import statements using from langgraph.prebuilt import tools_condition

Solution

Update the LangGraph dependency version constraint in pyproject.toml:

# Before
langgraph>=0.2.70

# After  
langgraph>=0.6.3

Steps to Implement

  • Update pyproject.toml with new version constraint
  • Run uv lock to update the lock file
  • Run uv sync to install the updated packages
  • Test that tools_condition can be imported successfully
  • Verify all existing LangGraph functionality still works
  • Update any code that might be affected by API changes

Testing Checklist

  • Import test: from langgraph.prebuilt import tools_condition
  • Backend starts without import errors
  • All existing LangGraph workflows continue to function
  • Docker build succeeds with new dependencies

Files to Modify

  • philoagents-api/pyproject.toml (line 13)

Migration Notes

LangGraph 0.6.x may include breaking changes. Review the LangGraph changelog for any API changes that might affect existing code.

Related Issues

  • Dependency management
  • Import errors
  • Backend startup failures

Priority

High - This blocks the application from starting correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions