{"id":43478,"date":"2025-06-12T15:28:45","date_gmt":"2025-06-12T07:28:45","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/43478.html"},"modified":"2025-06-12T15:28:45","modified_gmt":"2025-06-12T07:28:45","slug":"langgraph%e5%9f%ba%e7%a1%80%e7%9f%a5%e8%af%86memorysaver-sqlitesaver-%ef%bc%88%e4%b8%89%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/43478.html","title":{"rendered":"LangGraph\u57fa\u7840\u77e5\u8bc6(MemorySaver\/SqliteSaver )\uff08\u4e09\uff09"},"content":{"rendered":"<h2>\u672c\u7bc7\u5185\u5bb9\u80cc\u666f<\/h2>\n<p>\u4e0d\u8bba\u662f\u7b80\u5355\u8fd8\u662f\u590d\u6742\u7684\u56fe&#xff0c;\u4e00\u4e2a\u660e\u663e\u7684\u9650\u5236\u662f&#xff1a;\u4e4b\u524d\u5185\u5bb9\u4e2d\u7684\u6240\u6709\u5b9e\u73b0\u90fd\u53ea\u80fd\u6267\u884c\u5355\u4e00\u4efb\u52a1\u3002\u4e5f\u5c31\u662f\u8bf4&#xff0c;\u4e00\u65e6\u56fe\u88ab\u7f16\u8bd1\u5e76\u6839\u636e\u7528\u6237\u7684\u8f93\u5165\u8fd0\u884c\u4ee5\u540e&#xff0c;\u5b83\u867d\u7136\u53ef\u4ee5\u6309\u7167\u65e2\u5b9a\u7684\u56fe\u6d41\u7a0b\u8f93\u51fa\u7ed3\u679c&#xff0c;\u4f46\u5728\u4e0b\u4e00\u6b21\u4ea4\u4e92\u65f6&#xff0c;\u8fd9\u4e2a\u56fe\u5c06\u65e0\u6cd5\u8bb0\u4f4f\u4e4b\u524d\u7684\u5bf9\u8bdd\u5185\u5bb9\u3002\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u4ee3\u7801\u8fdb\u884c\u6d4b\u8bd5&#xff0c;\u89c2\u5bdf\u8fd9\u4e00\u73b0\u8c61&#xff1a;<\/p>\n<p>mport getpass<br \/>\nimport os<br \/>\nfrom langchain_openai import ChatOpenAI<br \/>\nfrom typing import Annotated<br \/>\nfrom typing_extensions import TypedDict<br \/>\nfrom IPython.display import Image, display<br \/>\nfrom langgraph.graph import StateGraph, MessagesState, START, END<br \/>\nfrom langchain_core.messages import AnyMessage, SystemMessage, HumanMessage, ToolMessage<br \/>\nfrom langgraph.graph.message import add_messages<\/p>\n<p>from dotenv import load_dotenv<br \/>\nload_dotenv()<\/p>\n<p># \u5b9a\u4e49\u5927\u6a21\u578b\u5b9e\u4f8b<br \/>\nllm &#061; ChatOpenAI(model&#061;&#034;deepseek-chat&#034;)<\/p>\n<p># \u5b9a\u4e49\u72b6\u6001\u6a21\u5f0f<br \/>\nclass State(TypedDict):<br \/>\n    messages: Annotated[list, add_messages]<\/p>\n<p># \u5b9a\u4e49\u5927\u6a21\u578b\u4ea4\u4e92\u8282\u70b9<br \/>\ndef call_model(state: State):<br \/>\n    response &#061; llm.invoke(state[&#034;messages&#034;])<br \/>\n    return {&#034;messages&#034;: response}<\/p>\n<p># \u5b9a\u4e49\u7ffb\u8bd1\u8282\u70b9<br \/>\ndef translate_message(state: State):<br \/>\n    system_prompt &#061; &#034;&#034;&#034;<br \/>\n    Please translate the received text in any language into English as output<br \/>\n    &#034;&#034;&#034;<br \/>\n    messages &#061; state[&#039;messages&#039;][-1]<br \/>\n    messages &#061; [SystemMessage(content&#061;system_prompt)] &#043; [HumanMessage(content&#061;messages.content)]<br \/>\n    response &#061; llm.invoke(messages)<br \/>\n    return {&#034;messages&#034;: response}<\/p>\n<p># \u6784\u5efa\u72b6\u6001\u56fe<br \/>\nbuilder &#061; StateGraph(State)<\/p>\n<p># \u5411\u56fe\u4e2d\u6dfb\u52a0\u8282\u70b9<br \/>\nbuilder.add_node(&#034;call_model&#034;, call_model)<br \/>\nbuilder.add_node(&#034;translate_message&#034;, translate_message)<\/p>\n<p># \u6784\u5efa\u8fb9<br \/>\nbuilder.add_edge(START, &#034;call_model&#034;)<br \/>\nbuilder.add_edge(&#034;call_model&#034;, &#034;translate_message&#034;)<br \/>\nbuilder.add_edge(&#034;translate_message&#034;, END)<\/p>\n<p>async for chunk in simple_short_graph.astream(input&#061;{&#034;messages&#034;: [&#034;\u4f60\u597d&#xff0c;\u6211\u53ebbug&#034;]}, stream_mode&#061;&#034;values&#034;):<br \/>\n    message &#061; chunk[&#034;messages&#034;][-1].pretty_print()<br \/>\n# \u8fd0\u884c\u7ed3\u679c<br \/>\n&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; Human Message &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<\/p>\n<p>\u4f60\u597d&#xff0c;\u6211\u53ebbug<br \/>\n&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; Ai Message &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<\/p>\n<p>\u4f60\u597d&#xff0c;Bug&#xff01;\u8fd9\u4e2a\u540d\u5b57\u5f88\u6709\u8da3&#xff0c;\u662f\u6709\u4ec0\u4e48\u7279\u522b\u7684\u542b\u4e49\u5417&#xff1f;&#x1f604;  <\/p>\n<p>\u5982\u679c\u662f\u7a0b\u5e8f\u5458\u670b\u53cb\u7684\u8bdd&#xff0c;\u53eb\u201cBug\u201d\u53ef\u80fd\u81ea\u5e26\u201c\u53cdbug\u5149\u73af\u201d\u54e6&#xff01;\u9700\u8981\u5e2e\u5fd9debug\u8fd8\u662f\u5355\u7eaf\u60f3\u804a\u804a&#xff1f;\u968f\u65f6\u6b22\u8fce&#xff5e;  <\/p>\n<p>&#xff08;P.S. \u5982\u679c\u662f\u771f\u540d\u7684\u8bdd\u4e5f\u5f88\u9177&#xff0c;\u50cf\u300a\u866b\u866b\u7279\u5de5\u961f\u300b\u91cc\u7684\u89d2\u8272\u2728&#xff09;<br \/>\n&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; Ai Message &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<\/p>\n<p>Hello, Bug! That&#039;s a really interesting name \u2013 does it have any special meaning? &#x1f604;  <\/p>\n<p>If you&#039;re a programmer friend, being called &#034;Bug&#034; might come with built-in &#034;anti-bug powers&#034;! Do you need help debugging something, or just want to chat? You&#039;re always welcome here~  <\/p>\n<p>(P.S. If it&#039;s your real name, that&#039;s super cool too \u2013 like a character from *A Bug&#039;s Life* \u2728)  <\/p>\n<p>*(Note: Kept the playful tone, translated cultural references naturally (&#034;\u866b\u866b\u7279\u5de5\u961f&#034;\u2192A Bug&#039;s Life), and maintained the emoji\/formatting style. Added &#034;built-in&#034; for smoother tech humor flow.)*<\/p>\n<p>\u7b2c\u4e8c\u6b21\u8be2\u95ee&#xff1a;<\/p>\n<p>async for chunk in simple_short_graph.astream(input&#061;{&#034;messages&#034;: [&#034;\u8bf7\u95ee&#xff0c;\u6211\u53eb\u4ec0\u4e48&#xff1f;&#034;]}, stream_mode&#061;&#034;values&#034;):<br \/>\n    message &#061; chunk[&#034;messages&#034;][-1].pretty_print()<\/p>\n<p># \u8fd0\u884c\u7ed3\u679c<br \/>\n&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; Human Message &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<\/p>\n<p>\u8bf7\u95ee&#xff0c;\u6211\u53eb\u4ec0\u4e48&#xff1f;<br \/>\n&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; Ai Message &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<\/p>\n<p>\u4f60\u8fd8\u6ca1\u6709\u544a\u8bc9\u6211\u4f60\u7684\u540d\u5b57\u5462&#xff01;&#x1f60a; \u4f60\u53ef\u4ee5\u544a\u8bc9\u6211\u4f60\u7684\u540d\u5b57&#xff0c;\u6216\u8005\u6211\u53ef\u4ee5\u79f0\u547c\u4f60\u4e3a\u201c\u670b\u53cb\u201d\u6216\u5176\u4ed6\u4f60\u559c\u6b22\u7684\u6635\u79f0&#xff5e; \u4f60\u5e0c\u671b\u6211\u600e\u4e48\u79f0\u547c\u4f60\u5462&#xff1f;<br \/>\n&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; Ai Message &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<\/p>\n<p>You haven&#039;t told me your name yet! &#x1f60a; You can tell me your name, or I can call you &#034;friend&#034; or any other nickname you like~ How would you prefer me to address you?   <\/p>\n<p>\u901a\u8fc7\u4e24\u6b21\u8be2\u95ee&#xff0c;\u6211\u4eec\u53ef\u4ee5\u786e\u5b9a\u5f53\u524d\u7684&#096;graph&#096;\u5b9e\u4f8b\u4e0d\u5177\u5907\u4efb\u4f55\u7684\u4e0a\u4e0b\u6587\u8bb0\u5fc6\u80fd\u529b\u3002<\/p>\n<h2>Checkpointer<\/h2>\n<p>&#096;LangGraph&#096;\u6846\u67b6\u4e2d\u7684&#096;checkpointer&#096;\u505a\u7684\u5c31\u662f\u8fd9\u6837\u7684\u4e8b\u3002\u5177\u4f53\u6765\u8bf4&#xff0c;\u5b83\u5c31\u662f\u901a\u8fc7\u4e00\u4e9b\u6570\u636e\u7ed3\u6784\u6765\u5b58\u50a8&#096;State&#096;\u72b6\u6001\u4e2d\u4ea7\u751f\u7684\u4fe1\u606f&#xff0c;\u5e76\u4e14\u5728\u6bcf\u4e2a&#096;task&#096;\u5f00\u59cb\u65f6\u53bb\u8bfb\u53d6\u5168\u5c40\u7684\u72b6\u6001\u3002\u4e3b\u8981\u901a\u8fc7\u4ee5\u4e0b\u56db\u79cd\u65b9\u5f0f\u6765\u5b9e\u73b0&#xff1a;<\/p>\n<p>&#8211; MemorySaver&#xff1a;\u7528\u4e8e\u5b9e\u9a8c\u6027\u8d28\u7684\u8bb0\u5fc6\u68c0\u67e5\u70b9\u3002 &#8211; SqliteSaver \/ AsyncSqliteSaver&#xff1a;\u4f7f\u7528 &#096;SQLite&#096; \u6570\u636e\u5e93 \u5b9e\u73b0\u7684\u8bb0\u5fc6\u68c0\u67e5\u70b9&#xff0c;\u9002\u5408\u5b9e\u9a8c\u6027\u8d28\u548c\u672c\u5730\u5de5\u4f5c\u6d41\u7a0b\u3002 &#8211; PostgresSaver \/ AsyncPostgresSaver&#xff1a;\u4f7f\u7528 &#096;Postgres&#096; \u6570\u636e\u5e93\u5b9e\u73b0\u7684\u9ad8\u7ea7\u68c0\u67e5\u70b9&#xff0c;\u9002\u5408\u5728\u751f\u4ea7\u7cfb\u7edf\u4e2d\u4f7f\u7528\u3002 &#8211; \u652f\u6301\u81ea\u5b9a\u4e49\u68c0\u67e5\u70b9\u3002<\/p>\n<h3>MemorySaver<\/h3>\n<p>&#096;LangGraph&#096; \u6846\u67b6\u6709\u4e00\u4e2a\u5185\u7f6e\u7684\u6301\u4e45\u5c42&#xff0c;\u901a\u8fc7&#096;checkpointer&#096;\u5b9e\u73b0\u3002\u5f53\u4f7f\u7528&#096;checkpointer&#096;\u7f16\u8bd1\u56fe\u65f6&#xff0c;\u68c0\u67e5\u70b9\u4f1a\u5728\u6bcf\u4e2a\u8d85\u7ea7\u6b65\u9aa4\u4e2d\u4fdd\u5b58\u56fe\u72b6\u6001\u7684&#096;checkpoint&#096;\u3002\u8fd9\u4e9b&#096;checkpoint&#096;\u88ab\u4fdd\u5b58\u5230\u4e00\u4e2a&#096;thread&#096;\u4e2d&#xff0c;\u53ef\u4ee5\u5728\u56fe\u6267\u884c\u540e\u8bbf\u95ee\u3002<\/p>\n<p>\u4f7f\u7528\u65b9\u5f0f\u5f88\u7b80\u5355&#xff1a;<\/p>\n<p>from langgraph.checkpoint.memory import MemorySaver<br \/>\nmemory &#061; MemorySaver()<br \/>\ngraph_with_memory &#061; builder.compile(checkpointer&#061;memory)   # \u5728\u7f16\u8bd1\u56fe\u7684\u65f6\u5019\u6dfb\u52a0\u68c0\u67e5\u70b9 <\/p>\n<p>\u793a\u4f8b\u4e2d\u4f7f\u7528&#xff1a;<\/p>\n<p># \u5bfc\u5165\u68c0\u67e5\u70b9<br \/>\nfrom langgraph.checkpoint.memory import MemorySaver<\/p>\n<p># if not os.environ.get(&#034;OPENAI_API_KEY&#034;):<br \/>\n#     os.environ[&#034;OPENAI_API_KEY&#034;] &#061; getpass.getpass(&#034;Enter your OpenAI API key: &#034;)<br \/>\nfrom dotenv import load_dotenv<br \/>\nload_dotenv()<br \/>\nllm &#061; ChatOpenAI(model&#061;&#034;deepseek-chat&#034;)<\/p>\n<p>class State(TypedDict):<br \/>\n    messages: Annotated[list, add_messages]<\/p>\n<p>def call_model(state: State):<br \/>\n    response &#061; llm.invoke(state[&#034;messages&#034;])<br \/>\n    return {&#034;messages&#034;: response}<\/p>\n<p>def translate_message(state: State):<br \/>\n    system_prompt &#061; &#034;&#034;&#034;<br \/>\n    Please translate the received text in any language into English as output<br \/>\n    &#034;&#034;&#034;<br \/>\n    messages &#061; state[&#039;messages&#039;][-1]<br \/>\n    messages &#061; [SystemMessage(content&#061;system_prompt)] &#043; [HumanMessage(content&#061;messages.content)]<br \/>\n    response &#061; llm.invoke(messages)<br \/>\n    return {&#034;messages&#034;: response}<\/p>\n<p>builder &#061; StateGraph(State)<\/p>\n<p>builder.add_node(&#034;call_model&#034;, call_model)<br \/>\nbuilder.add_node(&#034;translate_message&#034;, translate_message)<\/p>\n<p>builder.add_edge(START, &#034;call_model&#034;)<br \/>\nbuilder.add_edge(&#034;call_model&#034;, &#034;translate_message&#034;)<br \/>\nbuilder.add_edge(&#034;translate_message&#034;, END)<\/p>\n<p>memory &#061; MemorySaver()<br \/>\n# \u5728\u7f16\u8bd1\u56fe\u7684\u65f6\u5019\u6dfb\u52a0\u68c0\u67e5\u70b9<br \/>\ngraph_with_memory &#061; builder.compile(checkpointer&#061;memory)   <\/p>\n<p># \u8fd9\u4e2a thread_id \u53ef\u4ee5\u53d6\u4efb\u610f\u6570\u503c<br \/>\nconfig &#061; {&#034;configurable&#034;: {&#034;thread_id&#034;: &#034;1&#034;}}<\/p>\n<p>for chunk in graph_with_memory.stream({&#034;messages&#034;: [&#034;\u4f60\u597d&#xff0c;\u6211\u53ebbug&#034;]}, config, stream_mode&#061;&#034;values&#034;):<br \/>\n    chunk[&#034;messages&#034;][-1].pretty_print()<\/p>\n<p>for chunk in graph_with_memory.stream({&#034;messages&#034;: [&#034;\u8bf7\u95ee\u6211\u53eb\u4ec0\u4e48&#xff1f;&#034;]}, config, stream_mode&#061;&#034;values&#034;):<br \/>\n    chunk[&#034;messages&#034;][-1].pretty_print()<\/p>\n<p>\u00a0\u7ed3\u679c\u5982\u4e0b&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"757\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250612072843-684a81ab6a8e7.png\" width=\"2386\" \/><\/p>\n<p>\u00a0\u5982\u679c\u5c06thread_id\u66f4\u6539\u4e4b\u540e&#xff1a;<\/p>\n<p>config &#061; {&#034;configurable&#034;: {&#034;thread_id&#034;: &#034;3&#034;}}<\/p>\n<p>for chunk in graph_with_memory.stream({&#034;messages&#034;: [&#034;\u8bf7\u95ee\u6211\u53eb\u4ec0\u4e48&#xff1f;&#034;]}, config, stream_mode&#061;&#034;debug&#034;):<br \/>\n    if chunk[&#034;type&#034;] &#061;&#061; &#034;checkpoint&#034;:<br \/>\n        # print(chunk)<br \/>\n        print(f&#034;Thread id:{chunk[&#039;payload&#039;][&#039;config&#039;][&#039;configurable&#039;][&#039;thread_id&#039;]}&#034;)<br \/>\n        print(f&#034;CheckPoint id :{chunk[&#039;payload&#039;][&#039;config&#039;][&#039;configurable&#039;][&#039;checkpoint_id&#039;]}&#034;)<\/p>\n<p>        for message in chunk[&#039;payload&#039;][&#039;values&#039;][&#039;messages&#039;]:<br \/>\n            print(f&#034;Message id:{message.id}&#xff0c;Message content:{message.content}&#034;) <\/p>\n<p>\u8fd0\u884c\u7ed3\u679c\u5982\u4e0b&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"415\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250612072844-684a81ac362b2.png\" width=\"1413\" \/><\/p>\n<p>\u5df2\u7ecf\u5b8c\u5168\u4e22\u5931\u4e86\u4e0a\u4e0b\u6587&#xff0c;\u65e0\u6cd5\u77e5\u9053\u4ee5\u524d\u7684\u6570\u636e\u3002\u00a0<\/p>\n<p>\u90a3\u4e48\u63a5\u4e0b\u6765\u8981\u8003\u8651\u7684\u662f&#xff1a; \u65e2\u7136\u6240\u5b9e\u9645\u8fdb\u884c\u5b58\u50a8\u7684\u662f &#096;Checkpointer&#096;&#xff0c; \u90a3\u4e48&#096;Checkpointer&#096;\u5982\u4f55\u53bb\u505a\u6301\u4e45\u5316\u7684\u5b58\u50a8\u5462&#xff1f;\u6b63\u5982\u6211\u4eec\u4e0a\u9762\u4f7f\u7528\u7684 &#096;MemorySaver&#096;&#xff0c; \u867d\u7136\u5728\u5f53\u524d\u7684\u4ee3\u7801\u8fd0\u884c\u73af\u5883\u4e0b\u53ef\u4ee5\u53bb\u6307\u5b9a\u7ebf\u7a0bID&#xff0c;\u83b7\u53d6\u5230\u5177\u4f53\u7684\u5386\u53f2\u4fe1\u606f&#xff0c;\u4f46\u662f&#xff0c;\u4e00\u65e6\u6211\u4eec\u91cd\u542f\u4ee3\u7801\u73af\u5883&#xff0c;\u5219\u6240\u6709\u7684\u6570\u636e\u90fd\u5c06\u88ab\u62b9\u9664\u3002\u90a3\u4e48\u4e00\u79cd\u6301\u4e45\u5316\u7684\u65b9\u6cd5\u5c31\u662f\u628a\u6bcf\u4e2a&#096;checkpointer&#096;\u5b58\u50a8\u5230\u672c\u5730\u7684\u6570\u636e\u5e93\u4e2d\u3002<\/p>\n<h3 style=\"background-color:transparent\">SqliteSaver<\/h3>\n<p>SqliteSaver&#096;\u662f&#096;checkponiter&#096;\u7684\u7b2c\u4e8c\u79cd\u5b9e\u73b0\u5f62\u5f0f&#xff0c;\u4e0d\u540c\u4e8e&#096;MemorySaver&#096;\u4ec5\u901a\u8fc7\u5b57\u5178\u7684\u5f62\u5f0f\u5c06\u72b6\u6001\u4fe1\u606f\u5b58\u50a8\u5728\u5f53\u524d\u7684\u8fd0\u884c\u73af\u5883\u4e0b&#xff0c;&#096;SqliteSaver&#096;\u505a\u7684\u662f\u6301\u4e45\u5316\u5b58\u50a8&#xff0c;\u8fd9\u4e2a\u65b9\u6cd5\u4f1a\u628a&#096;checkponiter&#096;\u5b9e\u9645\u7684\u5b58\u50a8\u5728\u672c\u5730\u7684&#096;SQLite&#096; \u6570\u636e\u5e93\u4e2d&#xff0c;\u540c\u65f6\u63d0\u4f9b\u4e86\u5f02\u6b65\u73af\u5883\u4e0b\u7684\u5b9e\u73b0&#096;AsyncSqliteSaver&#096;&#xff0c;\u9002\u7528\u4e8e\u8f7b\u91cf\u7ea7\u7684\u5e94\u7528\u843d\u5730\u573a\u666f\u3002<\/p>\n<p>\u8fd9\u91cc\u4e3a\u4e86\u6f14\u793a&#096;SqliteSaver&#096;\u7684\u6267\u884c\u539f\u7406&#xff0c;\u6211\u4eec\u624b\u52a8\u6784\u5efa\u4e00\u4e2a\u6d4b\u8bd5\u7684&#096;checkpointer&#096;&#xff0c;\u5176\u9ed8\u8ba4\u5b9e\u73b0\u7684\u662f\u4ece&#096;State&#096;\u4e2d\u8fdb\u884c\u63d0\u53d6\u3002<\/p>\n<p>checkpoint_data &#061; {<br \/>\n    &#034;thread_id&#034;: &#034;bug123&#034;,<br \/>\n    &#034;thread_ts&#034;: &#034;2025-06-11T07:23:38.656547&#043;00:00&#034;,<br \/>\n    &#034;checkpoint&#034;: {<br \/>\n        &#034;id&#034;: &#034;1ef968fe-1eb4-6049-bfff&#034;,<br \/>\n    },<br \/>\n    &#034;metadata&#034;: {&#034;timestamp&#034;: &#034;2025-06-11T07:23:38.656547&#043;00:00&#034;}<br \/>\n} <\/p>\n<p>\u5728\u4e0b\u5217\u7a0b\u5e8f\u4f7f\u7528\u6211\u4eec\u7684\u6d4b\u8bd5\u6570\u636e&#xff0c;\u5e76\u6301\u4e45\u5316\u5230sqllite\u4e2d\u3002<\/p>\n<p>import sqlite3<br \/>\nfrom langgraph.checkpoint.sqlite import SqliteSaver <\/p>\n<p>with SqliteSaver.from_conn_string(&#034;checkpoints20250611.sqlite&#034;) as memory:<br \/>\n    # \u4fdd\u5b58\u68c0\u67e5\u70b9&#xff0c;\u5305\u62ec\u65f6\u95f4\u6233<br \/>\n    saved_config &#061; memory.put(<br \/>\n        config&#061;{&#034;configurable&#034;: {&#034;thread_id&#034;: checkpoint_data[&#034;thread_id&#034;], &#034;thread_ts&#034;: checkpoint_data[&#034;thread_ts&#034;], &#034;checkpoint_ns&#034;: &#034;&#034;}},<br \/>\n        checkpoint&#061;checkpoint_data[&#034;checkpoint&#034;],<br \/>\n        metadata&#061;checkpoint_data[&#034;metadata&#034;],<br \/>\n        new_versions&#061; {&#034;writes&#034;: {&#034;key&#034;: &#034;value&#034;}}<br \/>\n    )<\/p>\n<p>    # \u68c0\u7d22\u68c0\u67e5\u70b9\u7684\u6570\u636e<br \/>\n    config &#061; {&#034;configurable&#034;: {&#034;thread_id&#034;: checkpoint_data[&#034;thread_id&#034;]}}<\/p>\n<p>    # \u83b7\u53d6\u7ed9\u5b9a thread_id \u7684\u6240\u6709\u68c0\u67e5\u70b9<br \/>\n    checkpoints &#061; list(memory.list(config))<br \/>\n    for checkpoint in checkpoints:<br \/>\n        print(checkpoint)<br \/>\n#\u8fd0\u884c\u7ed3\u679c<br \/>\nCheckpointTuple(config&#061;{&#039;configurable&#039;: {&#039;thread_id&#039;: &#039;bug123&#039;, &#039;checkpoint_ns&#039;: &#039;&#039;, &#039;checkpoint_id&#039;: &#039;1ef968fe-1eb4-6049-bfff&#039;}}, checkpoint&#061;{&#039;id&#039;: &#039;1ef968fe-1eb4-6049-bfff&#039;}, metadata&#061;{&#039;timestamp&#039;: &#039;2025-06-11T07:23:38.656547&#043;00:00&#039;, &#039;thread_id&#039;: &#039;bug123&#039;, &#039;thread_ts&#039;: &#039;2025-06-11T07:23:38.656547&#043;00:00&#039;}, parent_config&#061;None, pending_writes&#061;[])<\/p>\n<p>\u4ecesqllit\u4e2d\u8fdb\u884c\u67e5\u8be2\u6570\u636e&#xff1a;<\/p>\n<p># \u5efa\u7acb\u6570\u636e\u5e93\u8fde\u63a5<br \/>\nconn &#061; sqlite3.connect(&#034;checkpoints20250611.sqlite&#034;)<\/p>\n<p># \u521b\u5efa\u4e00\u4e2a\u6e38\u6807\u5bf9\u8c61\u6765\u6267\u884c\u4f60\u7684SQL\u67e5\u8be2<br \/>\ncursor &#061; conn.cursor()<\/p>\n<p># \u67e5\u8be2\u6570\u636e\u5e93\u4e2d\u6240\u6709\u8868\u7684\u540d\u79f0<br \/>\ncursor.execute(&#034;SELECT name FROM sqlite_master WHERE type&#061;&#039;table&#039;;&#034;)<\/p>\n<p># \u83b7\u53d6\u67e5\u8be2\u7ed3\u679c<br \/>\ntables &#061; cursor.fetchall()<br \/>\n# \u6253\u5370\u6240\u6709\u8868\u540d<br \/>\nfor table in tables:<br \/>\n    print(table)<br \/>\n# \u4ece\u68c0\u67e5\u70b9\u8868\u4e2d\u68c0\u7d22\u6240\u6709\u6570\u636e<br \/>\ncursor.execute(f&#034;SELECT * FROM checkpoints;&#034;)<br \/>\nall_data &#061; cursor.fetchall()<\/p>\n<p># \u6253\u5370\u68c0\u67e5\u70b9\u8868\u4e2d\u7684\u6240\u6709\u6570\u636e<br \/>\nprint(&#034;Data in the &#039;checkpoints&#039; table:&#034;)<br \/>\nfor row in all_data:<br \/>\n    print(row)<br \/>\n# \u7ed3\u679c\u5982\u4e0b<br \/>\n(&#039;bug123&#039;, &#039;&#039;, &#039;1ef968fe-1eb4-6049-bfff&#039;, None, &#039;msgpack&#039;, b&#039;\\\\x81\\\\xa2id\\\\xb71ef968fe-1eb4-6049-bfff&#039;, b&#039;{&#034;timestamp&#034;: &#034;2025-06-11T07:23:38.656547&#043;00:00&#034;, &#034;thread_id&#034;: &#034;bug123&#034;, &#034;thread_ts&#034;: &#034;2025-06-11T07:23:38.656547&#043;00:00&#034;}&#039;)<\/p>\n<p>\u5230\u6b64&#xff0c;\u6211\u4eec\u4e0d\u6a21\u62df\u6570\u636e&#xff0c;\u5c06\u771f\u5b9e\u8fd0\u884c\u4e2d\u7684\u6570\u636e\u4fdd\u5b58\u5728sqlLit\u6570\u636e\u5e93\u4e2d\u3002<\/p>\n<p>from langgraph.checkpoint.sqlite import SqliteSaver<br \/>\nfrom langgraph.prebuilt import create_react_agent<\/p>\n<p>with SqliteSaver.from_conn_string(&#034;checkpoints202506111958.sqlite&#034;) as checkpointer:<br \/>\n    graph &#061; create_react_agent(llm, &#034;&#034;, checkpointer&#061;checkpointer)<br \/>\n    display(Image(graph.get_graph().draw_mermaid_png()))<\/p>\n<p>    config &#061; {&#034;configurable&#034;: {&#034;thread_id&#034;: &#034;1&#034;}}<\/p>\n<p>    for chunk in graph.stream({&#034;messages&#034;: [&#034;\u4f60\u597d&#xff0c;\u6211\u53ebbug&#034;]}, config, stream_mode&#061;&#034;values&#034;):<br \/>\n        chunk[&#034;messages&#034;][-1].pretty_print()<\/p>\n<p>\u6211\u4eec\u5728\u6b21\u4ecesqlite\u6570\u636e\u5e93\u54a8\u8be2&#xff0c;\u662f\u5426\u80fd\u8bfb\u53d6\u6570\u636e<\/p>\n<p>import asyncio<br \/>\nfrom contextlib import AsyncExitStack<br \/>\nfrom langgraph.checkpoint.sqlite.aio import AsyncSqliteSaver<br \/>\nfrom langgraph.prebuilt import create_react_agent<\/p>\n<p>stack &#061; AsyncExitStack()<br \/>\nmemory &#061; await stack.enter_async_context(AsyncSqliteSaver.from_conn_string(&#034;checkpoints202506111958.sqlite&#034;))<\/p>\n<p>graph &#061; create_react_agent(llm, &#034;&#034;, checkpointer&#061;memory)<\/p>\n<p>config &#061; {&#034;configurable&#034;: {&#034;thread_id&#034;: &#034;1&#034;}}<\/p>\n<p>async for chunk in graph.astream({&#034;messages&#034;: [&#034;\u8bf7\u95ee\u6211\u521a\u624d\u95ee\u4e86\u4ec0\u4e48\u95ee\u9898&#xff1f;&#034;]}, config, stream_mode&#061;&#034;values&#034;):<br \/>\n    chunk[&#034;messages&#034;][-1].pretty_print() <\/p>\n<p>\u7ed3\u679c\u5982\u4e0b&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"394\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250612072844-684a81ac68565.png\" width=\"1132\" \/><\/p>\n<p>\u8bf4\u660e\u5df2\u7ecf\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u5230\u5b58\u50a8\u7684\u4e0a\u4e0b\u6587\u4fe1\u606f\u3002\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb695\u6b21\uff0c\u70b9\u8d5e5\u6b21\uff0c\u6536\u85cf6\u6b21\u3002\u4e0d\u8bba\u662f\u7b80\u5355\u8fd8\u662f\u590d\u6742\u7684\u56fe\uff0c\u4e00\u4e2a\u660e\u663e\u7684\u9650\u5236\u662f\uff1a\u4e4b\u524d\u5185\u5bb9\u4e2d\u7684\u6240\u6709\u5b9e\u73b0\u90fd\u53ea\u80fd\u6267\u884c\u5355\u4e00\u4efb\u52a1\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u4e00\u65e6\u56fe\u88ab\u7f16\u8bd1\u5e76\u6839\u636e\u7528\u6237\u7684\u8f93\u5165\u8fd0\u884c\u4ee5\u540e\uff0c\u5b83\u867d\u7136\u53ef\u4ee5\u6309\u7167\u65e2\u5b9a\u7684\u56fe\u6d41\u7a0b\u8f93\u51fa\u7ed3\u679c\uff0c\u4f46\u5728\u4e0b\u4e00\u6b21\u4ea4\u4e92\u65f6\uff0c\u8fd9\u4e2a\u56fe\u5c06\u65e0\u6cd5\u8bb0\u4f4f\u4e4b\u524d\u7684\u5bf9\u8bdd\u5185\u5bb9\u3002\u901a\u8fc7\u4e24\u6b21\u8be2\u95ee\uff0c\u6211\u4eec\u53ef\u4ee5\u786e\u5b9a\u5f53\u524d\u7684`graph`\u5b9e\u4f8b\u4e0d\u5177\u5907\u4efb\u4f55\u7684\u4e0a\u4e0b\u6587\u8bb0\u5fc6\u80fd\u529b\u3002<\/p>\n","protected":false},"author":2,"featured_media":43475,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[66,3503,81],"topic":[],"class_list":["post-43478","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-ai","tag-langgraph","tag-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>LangGraph\u57fa\u7840\u77e5\u8bc6(MemorySaver\/SqliteSaver )\uff08\u4e09\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/43478.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"LangGraph\u57fa\u7840\u77e5\u8bc6(MemorySaver\/SqliteSaver )\uff08\u4e09\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb695\u6b21\uff0c\u70b9\u8d5e5\u6b21\uff0c\u6536\u85cf6\u6b21\u3002\u4e0d\u8bba\u662f\u7b80\u5355\u8fd8\u662f\u590d\u6742\u7684\u56fe\uff0c\u4e00\u4e2a\u660e\u663e\u7684\u9650\u5236\u662f\uff1a\u4e4b\u524d\u5185\u5bb9\u4e2d\u7684\u6240\u6709\u5b9e\u73b0\u90fd\u53ea\u80fd\u6267\u884c\u5355\u4e00\u4efb\u52a1\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u4e00\u65e6\u56fe\u88ab\u7f16\u8bd1\u5e76\u6839\u636e\u7528\u6237\u7684\u8f93\u5165\u8fd0\u884c\u4ee5\u540e\uff0c\u5b83\u867d\u7136\u53ef\u4ee5\u6309\u7167\u65e2\u5b9a\u7684\u56fe\u6d41\u7a0b\u8f93\u51fa\u7ed3\u679c\uff0c\u4f46\u5728\u4e0b\u4e00\u6b21\u4ea4\u4e92\u65f6\uff0c\u8fd9\u4e2a\u56fe\u5c06\u65e0\u6cd5\u8bb0\u4f4f\u4e4b\u524d\u7684\u5bf9\u8bdd\u5185\u5bb9\u3002\u901a\u8fc7\u4e24\u6b21\u8be2\u95ee\uff0c\u6211\u4eec\u53ef\u4ee5\u786e\u5b9a\u5f53\u524d\u7684`graph`\u5b9e\u4f8b\u4e0d\u5177\u5907\u4efb\u4f55\u7684\u4e0a\u4e0b\u6587\u8bb0\u5fc6\u80fd\u529b\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/43478.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-12T07:28:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250612072843-684a81ab6a8e7.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/43478.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/43478.html\",\"name\":\"LangGraph\u57fa\u7840\u77e5\u8bc6(MemorySaver\/SqliteSaver )\uff08\u4e09\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-06-12T07:28:45+00:00\",\"dateModified\":\"2025-06-12T07:28:45+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/43478.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/43478.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/43478.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"LangGraph\u57fa\u7840\u77e5\u8bc6(MemorySaver\/SqliteSaver )\uff08\u4e09\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"LangGraph\u57fa\u7840\u77e5\u8bc6(MemorySaver\/SqliteSaver )\uff08\u4e09\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/43478.html","og_locale":"zh_CN","og_type":"article","og_title":"LangGraph\u57fa\u7840\u77e5\u8bc6(MemorySaver\/SqliteSaver )\uff08\u4e09\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb695\u6b21\uff0c\u70b9\u8d5e5\u6b21\uff0c\u6536\u85cf6\u6b21\u3002\u4e0d\u8bba\u662f\u7b80\u5355\u8fd8\u662f\u590d\u6742\u7684\u56fe\uff0c\u4e00\u4e2a\u660e\u663e\u7684\u9650\u5236\u662f\uff1a\u4e4b\u524d\u5185\u5bb9\u4e2d\u7684\u6240\u6709\u5b9e\u73b0\u90fd\u53ea\u80fd\u6267\u884c\u5355\u4e00\u4efb\u52a1\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u4e00\u65e6\u56fe\u88ab\u7f16\u8bd1\u5e76\u6839\u636e\u7528\u6237\u7684\u8f93\u5165\u8fd0\u884c\u4ee5\u540e\uff0c\u5b83\u867d\u7136\u53ef\u4ee5\u6309\u7167\u65e2\u5b9a\u7684\u56fe\u6d41\u7a0b\u8f93\u51fa\u7ed3\u679c\uff0c\u4f46\u5728\u4e0b\u4e00\u6b21\u4ea4\u4e92\u65f6\uff0c\u8fd9\u4e2a\u56fe\u5c06\u65e0\u6cd5\u8bb0\u4f4f\u4e4b\u524d\u7684\u5bf9\u8bdd\u5185\u5bb9\u3002\u901a\u8fc7\u4e24\u6b21\u8be2\u95ee\uff0c\u6211\u4eec\u53ef\u4ee5\u786e\u5b9a\u5f53\u524d\u7684`graph`\u5b9e\u4f8b\u4e0d\u5177\u5907\u4efb\u4f55\u7684\u4e0a\u4e0b\u6587\u8bb0\u5fc6\u80fd\u529b\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/43478.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-06-12T07:28:45+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250612072843-684a81ab6a8e7.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/43478.html","url":"https:\/\/www.wsisp.com\/helps\/43478.html","name":"LangGraph\u57fa\u7840\u77e5\u8bc6(MemorySaver\/SqliteSaver )\uff08\u4e09\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-06-12T07:28:45+00:00","dateModified":"2025-06-12T07:28:45+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/43478.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/43478.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/43478.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"LangGraph\u57fa\u7840\u77e5\u8bc6(MemorySaver\/SqliteSaver )\uff08\u4e09\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/43478","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=43478"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/43478\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/43475"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=43478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=43478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=43478"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=43478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}