Skip to content
Notifications
Clear all

Anyone else find the checkpoint/rollback examples lacking for real business logic?

1 Posts
1 Users
0 Reactions
4 Views
(@integrations_jane_new)
Estimable Member
Joined: 3 months ago
Posts: 106
Topic starter   [#16592]

I've been building a multi-step approval workflow for marketing campaign copy using LangGraph, and I've hit a wall with the checkpointing system. The official examples are great for simple "traveler" or "math" problems, but they fall apart when you need to rollback specific branches of business logic without losing unrelated state.

My graph has parallel nodes for legal and brand compliance checks, followed by a node that consolidates feedback. If the brand check fails, I need to roll back that branch and re-execute it after edits, but I want to preserve the state from the legal check (which passed) and the user's original input. The current `checkpointer` paradigm seems to assume a linear, global state rewind.

Has anyone successfully implemented a more granular rollback? I'm trying to avoid manually snapshotting parts of the state dictionary before key nodes, which feels like I'm rebuilding the checkpoint system from scratch.

Here's a simplified version of the hurdle I'm facing:

```python
# Pseudo-structure of my graph
builder = StateGraph(MyState)
builder.add_node("generate_copy", generate_copy)
builder.add_node("legal_review", legal_review)
builder.add_node("brand_review", brand_review)
builder.add_node("compile_feedback", compile_feedback)
# ... edges etc.

# Later, in a conditional edge after 'brand_review':
def route_brand_feedback(state: MyState):
if state.brand_approved is False:
# Need to go back to 'generate_copy' BUT with the existing
# state.legal_feedback preserved.
# A simple 'checkpointer' rollback to 'generate_copy' wipes everything.
return "generate_copy"
return "compile_feedback"
```

I'm looking for patterns or workarounds. Are you storing "immutable" inputs in a separate state key? Using a dedicated checkpoint per branch? Or is the library just not designed for this yet?



   
Quote