History Fidelity and Summarization, Multimodal Placeholders, Checkpointer Persistence
Keep a long conversation's history from getting distorted inside a multi-agent graph, add a summarization node that compresses early content, and persist execution state with a checkpointer.
Today's Goals
- Implement a summarization node that generates a summary and keeps key information once history grows too long
- Wire in LangGraph's checkpointer to persist the graph's execution state
- Resume an unfinished execution from a checkpoint and run it to completion
Yesterday's graph splits tasks, runs in parallel, and bounces work back for a redo, at nine model calls a run. It leaves two problems unsolved: two rounds of the review loop make the history unreadable, and all of it lives in memory, so a crashed process wastes nine model calls' worth of money. Today deals with both.
Plain-Language Walkthrough
A site log may be summarized; the excavation depth may not be dropped
A construction site keeps a daily log. Three months in, the log is a stack, so the project manager writes a summary at the end of each phase compressing that stack into two pages. But a few things can only be copied verbatim, never rewritten: how deep the excavation went, which batch the concrete came from, which day the client approved a change in writing, and who signed. The next trade builds to those numbers and the inspector assigns accountability by those signatures — a summary may read beautifully, and one wrong number there is an incident.
That is history fidelity: compression is necessary, and a small subset of what gets compressed must still be there afterwards, traceable to who said it at which step.
Draw the boundary between the three layers of memory first — each has had its own day and they blur together easily:
- D6 is short-term context compression. Its object is the request about to be sent to the model: over the limit, swap a few early rounds for a summary before sending, and the compressed result is not persisted, being recomputed next round.
- D12 is long-term memory. Its object is cross-session user facts and preferences, which do not enter the message array but live in a vector store, retrieved and injected on demand.
- Today is graph execution state. Its object is this graph's entire state at this instant — messages, workspace, review rounds, attachments, degradation flag, all of it. It must be compressible and also storable, retrievable, and restartable from some earlier moment.
The difference is not magnitude, it is what happens when something is lost. Lose what D6 compressed and this round answers slightly worse, with the original still in the transcript; today's compression targets the graph state itself, which the checkpoint persists verbatim, so every later resume on this thread reads the compressed version. Loss here is permanent.
Multi-agent adds one more difficulty, and it is where the word fidelity comes from. D17's Critic judges an output by whether "this conclusion was written by the executor or requested by the user." A flattened narrative summary — "the user asked about orders and refunds, and the assistant proposed a plan" — reads smoothly and lets the Critic judge nothing: it cannot tell which sentence is the output under review and which is the acceptance criterion. In a single agent a summary loses detail; in a multi-agent system a summary loses the criteria.
So today's summary carries a requirement harder than D6's: every compressed message leaves two coordinates in the summary, its index and its speaker. The implementation is one line, as you will see. The genuinely hard question is the next one: once this state is compressed, where do you intend to store it?
Interview questions
How should agent memory be layered? What belongs in short-term context, in summaries, and in long-term memory — and what happens when each is lost?记忆应该怎么分层?短期上下文、摘要、长期记忆分别放什么、丢了会怎么样?
Common in ChinaCommon overseasBasic#memory#context-management#multi-agent🔒 Unlock this chapter to see the answer keys.
When summarizing a long conversation, how do you keep the critical information from being lost — and what is different about this in a multi-agent system?长对话做摘要时,怎么保证关键信息不丢?在多 Agent 场景下这件事有什么特别的?
Common in ChinaCommon overseasIntermediate#context-compression#multi-agent#reliability🔒 Unlock this chapter to see the answer keys.
What do you need to watch out for when replaying execution from a checkpoint? Give failure modes you would actually hit.从 checkpoint 恢复执行(replay)需要注意什么?说几个真实会踩的坑。
Common in ChinaCommon overseasDeep dive#checkpointing#replay#reliability🔒 Unlock this chapter to see the answer keys.
What problem does a checkpointer solve in a multi-agent system, and what does it cost?checkpointer 在多 Agent 系统里解决了什么问题?它的代价是什么?
Common in ChinaCommon overseasIntermediate#checkpointing#cost#operations🔒 Unlock this chapter to see the answer keys.
