New Tool Radar

AI Agents & Automation

How to Summarize Agent Memory Before a Long Task

Summarize an agent memory into its durable facts before a long task, so the task starts from a short summary, not a full history.

Schematic with three steps: List the facts the task needs; Summarize the memory to those facts only; Start the long task from the summary.

A long task that starts with the full conversation history pays for every old turn on every model call. The cheaper start is a summary: distill the memory into the durable facts the task needs, then hand the agent the summary instead of the history. Langflow’s LLM preprocessing does this for memory bases, distilling each batch of messages into a compact summary before embedding. Write the summary with the task in mind: only the facts this task needs, in bullets, with anything stale or already superseded left out.

What you need

  • An agent with a long conversation history behind it
  • A list of the facts the coming task actually needs
  • A summary step: preprocessing, a summarizer agent, or a manual summary

Step 1: List the facts the task needs

Before summarizing, write the facts the long task will use. A summary written without that list keeps everything and saves nothing.

Step 2: Summarize the memory to those facts only

Run the preprocessing or summarizer over the history and keep only the facts on the list, in short bullets. Drop greetings, dead ends, and facts the task has already superseded.

Step 3: Start the long task from the summary

Give the agent the summary as its starting context, not the full history, and confirm its first actions use the summarized facts. If it asks for history you dropped, the list was incomplete.

Worked example: synthetic memory summary

The table below is a synthetic example. It shows the expected result of summarizing memory; no agent was run.

Check Expected Result
Summary lists task facts Yes Pass
Greetings and dead ends dropped Yes Pass
Task starts from the summary Yes Pass
Agent asks for dropped history No Pass

Expected result (UNTESTED). the task starts from a short summary of the facts it needs, with greetings and dead ends dropped. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • A summary can drop a fact the task turns out to need, so keep the source history reachable.
  • Summarizing is itself a model call, so it pays only when the task is long enough.
  • A summary written for one task may miss facts a later task needs.
  • Stale facts in the summary are worse than no facts, so re-check them before the task starts.

Sources

See all