Skip to main content

Langgraph checkpointer Plugin for Mysql

Project description

Unfazed Checkpointer

unfazed-checkoutpointer is a unfazed plugin for langgraph.

important:

  • only support async methods now.
  • only support mysql/tidb protocol now.

reference docs:

Usage

Install unfazed-checkpointer

make sure you already installed unfazed

pip install unfazed-checkpointer

Migrate the DB

currently we only support mysql or tidb

# for the first migration
unfazed-cli init-db


# for the upgrade
unfazed-cli migrate
unfazed-cli upgrade

Use it in your code

import uuid

from langchain_core.runnables import RunnableConfig
from langgraph.graph import END, START, StateGraph
from langgraph.types import Command as LangGraphCommand
from langgraph.types import interrupt

from unfazed_checkpointer.services import TortoiseCheckpointSaver

# ==================== State & Nodes ====================


class SimpleState(t.TypedDict):
    foo: str
    bar: t.Annotated[list[str], operator.add]



class InterruptState(t.TypedDict):
    foo: str
    bar: t.Annotated[list[str], operator.add]


def interrupt_node(state: InterruptState) -> dict[str, t.Any]:
    """Runs second, interrupts and modifies foo on resume."""
    approved = interrupt("Do you want to proceed?")
    return {"foo": f"a-approved:{approved}", "bar": ["a"]}

async def main():
    workflow = StateGraph(SimpleState)
    workflow.add_node("node", interrupt_node)
    workflow.add_edge(START, "node")
    workflow.add_edge("node", END)
    checkpointer = TortoiseCheckpointSaver()
    graph = workflow.compile(checkpointer=checkpointer)
    thread_id = str(uuid.uuid4())
    config: RunnableConfig = {"configurable": {"thread_id": thread_id}}
    await graph.ainvoke(
            t.cast(SimpleState, {"foo": "init", "bar": ["init"]}), config
        )

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unfazed_checkpointer-0.0.1.tar.gz (95.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unfazed_checkpointer-0.0.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file unfazed_checkpointer-0.0.1.tar.gz.

File metadata

  • Download URL: unfazed_checkpointer-0.0.1.tar.gz
  • Upload date:
  • Size: 95.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for unfazed_checkpointer-0.0.1.tar.gz
Algorithm Hash digest
SHA256 80ce7d00dfd9532213999f94fb96eeceac5dceabb37e5384747edf661250377c
MD5 bad708d7ba2f049650f9488b249ae97b
BLAKE2b-256 399f1d8fed41da88627806e18022a2582c062473e5066ebaee409e87b31ab6d3

See more details on using hashes here.

File details

Details for the file unfazed_checkpointer-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: unfazed_checkpointer-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for unfazed_checkpointer-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a852370cef137077e485049be1ea479b29bfafbdb5a395a47c39e9d39f000063
MD5 56da181b6bd6d127f49c80a8f0ec41eb
BLAKE2b-256 4cadd1cfad061d16e4f07ad3d4a25a00d2c36ee448c55385017bd211814cb002

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page