{"id":2563,"library":"langgraph-runtime-inmem","title":"LangGraph Runtime (In-Memory)","description":"The `langgraph-runtime-inmem` library provides an in-memory implementation for the LangGraph API server's state management, enabling local development and testing of LangGraph agents without requiring an external database. It's designed for ephemeral, single-process usage. Currently at version 0.27.3, it follows the rapid release cadence of the broader LangGraph ecosystem, with frequent updates.","status":"active","version":"0.27.3","language":"en","source_language":"en","source_url":"https://github.com/langchain-ai/langgraph-runtime-inmem","tags":["langchain","langgraph","AI","LLM","runtime","in-memory","fastapi","development"],"install":[{"cmd":"pip install langgraph-runtime-inmem","lang":"bash","label":"Install core library"}],"dependencies":[{"reason":"Core dependency for defining and compiling graphs.","package":"langgraph","optional":false},{"reason":"Used to build the API server that exposes the runtime.","package":"fastapi","optional":false},{"reason":"ASGI server for running the FastAPI application.","package":"uvicorn","optional":false}],"imports":[{"symbol":"InMemoryGraphRuntime","correct":"from langgraph_runtime_inmem import InMemoryGraphRuntime"},{"note":"This is the FastAPI application instance used to serve the graphs.","symbol":"app","correct":"from langgraph_runtime_inmem.server import app"}],"quickstart":{"code":"from langgraph.graph import StateGraph\nfrom langgraph_runtime_inmem import InMemoryGraphRuntime\nfrom langgraph_runtime_inmem.server import app\n\n# 1. Define a simple LangGraph\ndef create_simple_graph():\n    builder = StateGraph(dict)\n    builder.add_node(\"start\", lambda x: {\"step\": \"start\"})\n    builder.add_node(\"end\", lambda x: {\"step\": \"end\"})\n    builder.add_edge(\"start\", \"end\")\n    builder.set_entry_point(\"start\")\n    return builder.compile()\n\n# 2. Instantiate the in-memory runtime\nruntime = InMemoryGraphRuntime()\n\n# 3. Register your graph with a unique ID\nmy_graph = create_simple_graph()\nruntime.add_graph(\"my_first_graph\", my_graph)\n\nprint(\"Graph 'my_first_graph' registered with the InMemoryGraphRuntime.\")\nprint(\"To run the API server, execute:\")\nprint(\"uvicorn langgraph_runtime_inmem.server:app --host 0.0.0.0 --port 8000\")\nprint(\"You can then interact with the graph via HTTP, e.g., POST /graph/my_first_graph/invoke\")\n\n# Example of direct interaction (not via HTTP, for demonstration):\n# state = runtime.invoke(\"my_first_graph\", {}, config={})\n# print(f\"Direct invocation result: {state}\")\n","lang":"python","description":"This quickstart demonstrates how to define a LangGraph, instantiate the `InMemoryGraphRuntime`, and register the graph. It also provides instructions on how to launch the FastAPI server using `uvicorn` to make the graph accessible via HTTP."},"warnings":[{"fix":"For persistent or distributed state management, use other LangGraph runtime implementations (e.g., backed by a database) or implement your own custom state store.","message":"The `InMemoryGraphRuntime` is ephemeral. All state (including graph run history and current step) is stored only in RAM and will be lost if the server process restarts. It does not support shared state across multiple server instances.","severity":"gotcha","affected_versions":"All"},{"fix":"Ensure your environment uses Python 3.11 or a later version.","message":"This library requires Python 3.11 or newer. Attempting to install or run with older Python versions will result in dependency resolution errors or runtime failures.","severity":"breaking","affected_versions":"All"},{"fix":"Refer to the release notes for both libraries and keep them updated to compatible versions. Generally, use the latest versions of both.","message":"Version alignment between `langgraph-runtime-inmem` and `langgraph` is crucial. Significant API changes in `langgraph` often require corresponding updates in `langgraph-runtime-inmem` to maintain compatibility.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}