Framework integration
LangGraph compression
LangGraph builds stateful, multi-step LLM workflows. Each node receives the full state, which grows with every step. Compression keeps state compact.
LangGraph state compression
from langgraph.graph import StateGraph
from supercompress import Compressor
comp = Compressor()
def compress_state(state, next_node_query):
"Compress the accumulated state before the next node."
compressed = comp.compress(
state.get("accumulated_context", ""), next_node_query
)
state["accumulated_context"] = compressed.compressed_text
return state
# Add to your LangGraph workflow
graph = StateGraph(AgentState)
graph.add_node("compress", compress_state)
graph.add_edge("compress", "next_node")
Frequently asked questions
Should I compress at every node?
Yes. Compress before each node execution to prevent state bloat across multiple steps.
Does compression affect LangGraph's persistence?
No. The compressed state is persisted like any other state field.
Try it yourself
Paste your long prompt into the playground, ask a question, and see what SuperCompress keeps and removes. Free, no signup needed.