{"id":4606,"library":"langgraph-utils","title":"LangGraph Utilities","description":"This library (version 0.0.7.4) provides utility functions specifically designed to convert LangChain tool objects into JSON format and vice versa. Its primary purpose is to help serialize and deserialize structured tool definitions, facilitating easier storage and transport within applications built with LangChain and LangGraph. The release cadence appears to be infrequent, with the latest version uploaded in May 2025.","status":"active","version":"0.0.7.4","language":"en","source_language":"en","source_url":"https://github.com/langchain-ai/langgraph","tags":["langgraph","langchain","utilities","tooling","serialization","json"],"install":[{"cmd":"pip install langgraph-utils==0.0.7.4","lang":"bash","label":"Install specific version"},{"cmd":"pip install langgraph-utils","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Provides the StructuredTool objects that this library serializes and deserializes.","package":"langchain","optional":false},{"reason":"The utilities are intended for use within LangGraph applications.","package":"langgraph","optional":false}],"imports":[{"note":"This function converts a list of LangChain StructuredTool objects into a JSON string.","symbol":"create_tools_json","correct":"from langgraph_utils import create_tools_json"}],"quickstart":{"code":"import os\nfrom typing import List, Dict, Any\nfrom langchain_core.tools import StructuredTool\nfrom langgraph_utils import create_tools_json\n\n# Mock a LangChain StructuredTool\n# In a real application, you would import and define actual tools.\nclass MockTool(StructuredTool):\n    name: str = \"mock_tool\"\n    description: str = \"A mock tool for demonstration.\"\n    args_schema: Dict[str, Any] = {\"param\": {\"type\": \"string\", \"description\": \"A parameter\"}}\n    \n    def _run(self, param: str) -> str:\n        return f\"MockTool executed with: {param}\"\n\n    async def _arun(self, param: str) -> str:\n        return f\"MockTool async executed with: {param}\"\n\n\nmock_tools = [\n    MockTool(name='search_internet', description='Searches the internet for information'),\n    MockTool(name='get_weather', description='Fetches current weather for a location')\n]\n\ntools_json_string = create_tools_json(mock_tools)\nprint(f\"Serialized Tools: {tools_json_string}\")\n\n# Example of deserialization (assuming a hypothetical deserialize_tools_json function exists or custom logic)\n# This library's PyPI description focuses on 'create_tools_json', but also mentions 'and vice versa'.\n# For full deserialization, you might need to implement custom logic or use other LangChain utilities.\n# For illustrative purposes, we'll just show the structure.\nimport json\ndeserialized_data = json.loads(tools_json_string)\nprint(f\"Deserialized data structure: {deserialized_data[0]['name']}\")","lang":"python","description":"This quickstart demonstrates how to use `create_tools_json` to serialize a list of mock LangChain `StructuredTool` objects into a JSON string. While the `langgraph-utils` PyPI description mentions conversion 'and vice versa', the `create_tools_json` function is explicitly detailed. For deserialization, you would typically use standard JSON parsing and potentially recreate `StructuredTool` instances based on the JSON structure."},"warnings":[{"fix":"Refer to the official PyPI page for `langgraph-utils` for the precise functionality and exposed methods.","message":"The official PyPI description for `langgraph-utils` (version 0.0.7.4) specifies its role as a 'LangChain Tools JSON Converter', focusing on `create_tools_json`. This is more specific than the broader 'Utilities for Langchain and langgraph' summary provided in some contexts. Ensure this specific JSON conversion functionality aligns with your needs.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always pin major versions of `langchain` and `langgraph`. Regularly check their migration guides (e.g., LangGraph v1 migration guide) and test your serialization/deserialization logic when upgrading core LangChain/LangGraph libraries.","message":"LangChain and LangGraph APIs, including tool definitions (`StructuredTool`), undergo updates. Breaking changes, especially in major LangChain/LangGraph versions (e.g., LangGraph v1.0), could affect how tools are defined or interpreted, potentially impacting the serialization/deserialization process.","severity":"breaking","affected_versions":"Potentially LangChain >= 0.2, LangGraph >= 1.0"},{"fix":"Define a clear `TypedDict` or Pydantic model for your graph state. Validate tool inputs and outputs rigorously within your nodes. Utilize LangGraph's checkpointing and LangSmith for debugging complex state transitions.","message":"If `langgraph-utils` is used within a larger LangGraph application, pay close attention to state management. Incorrectly serialized or deserialized tool definitions, or state changes during parallel execution, can lead to unexpected tool calls or graph behavior.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}