fix: minor memory issues in studio and added real weather api tool #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🐛 Fix: Memory Loading Issues in LangGraph Studio + Weather API Enhancement
Problem
When running agents with long-term memory in LangGraph Studio (
langgraph dev), memory was not loading properly for users, and hot-reloading causedModuleNotFoundErrorcrashes.Root Causes Identified
1. Namespace Type Mismatch
The
load_memory()andcreate_memory()functions were using inconsistent types for the namespace:load_memory()usedstate["customer_id"](integer)create_memory()usedstr(state["customer_id"])(string)This meant memory was stored at namespace
("memory_profile", "1")but loaded from("memory_profile", 1)- two different namespaces!2. Pydantic Model Serialization Issue
The
create_memory()function was storing Pydantic model instances directly:When LangGraph's disk-backed store pickles this, it saves class references (e.g.,
__agents__memory_enabled_music_store_supervisor_with_interrupt.UserProfile). During hot-reload, Python can't find these module references → crash.3. Memory Format Handling
The
format_user_memory()function only handled Pydantic models with attributes, but after retrieval from the store, data could be either a dict or a Pydantic model.Changes Made
agents/memory_enabled_music_store_supervisor_with_interrupt.pyFixed namespace consistency (line 142):
Fixed memory serialization (line 205):
Fixed memory format handling (lines 128-132):
agents/lg101-weather-agent.pyTesting
ModuleNotFoundErrorImpact
.langgraph_apifolder after code changesRelated Issues
Fixes memory loading in LangGraph Studio for agents using long-term memory store.