Meta AI uses a second AI agent as a memory coach to keep long tasks on track

Meta AI uses a second AI agent as a memory coach to keep long tasks on track

Meta AI researchers describe a recurring failure in long-running AI agents: they recognize a constraint early, then violate it later while fixing something unrelated; they see a command fail, then retry a near-identical version soon after; they diagnose an error pattern, then treat the same pattern as new later on. The authors call this "behavioral state decay": the information that should guide the agent's decisions gets scattered across a growing task history, can end up buried deep in the context window or fall out of it entirely, and even when it stays in the transcript it may stop reliably shaping behavior. Meta AI says simply giving agents longer histories does not fix this.

Existing memory systems are built to store, update and retrieve information, which works for personalization and recall across sessions, but they don't solve a different problem: deciding when a memory is useful enough to surface. Too few reminders and the agent repeats mistakes; too many add latency, burn tokens and distract it from the current step. The authors say this is a different job from summarization, which only decides what to retain: their system decides whether a stored execution state should influence the agent's very next move.

The proposed design pairs an unmodified "action agent" with a separate "memory agent." At fixed intervals, the memory agent reviews a sliding window of recent steps, updates a structured memory bank through predefined tool calls rather than freely overwriting it, and then either adds a brief reminder to the action agent's next call or stays silent. The memory bank has three parts: a private status field (progress and outstanding risks, never shown to the action agent), Knowledge Memory (stable facts such as requirements, file paths, configurations), and Procedural Memory (what was tried and what happened, including failed commands, fixes and rejected hypotheses). The authors say the module can be dropped into existing agents and harnesses as a plug-and-play component, and that unlike a general advisor model it only issues memory-based reminders rather than broader strategic advice.

The team tested it on Terminal-Bench 2.0, which evaluates autonomous agents in realistic command-line environments, and tau2-Bench, which tests conversational tool use in airline, retail and telecom scenarios. Claude Opus 4.6 played the memory agent in the experiments (the model has since received updates). With the older Claude Sonnet 4.5 as the action agent, the system solved 46 percent of Terminal-Bench tasks on the first attempt, against a 38 percent baseline. On tau2-Bench, the task-weighted average rose from 55 to 62 percent, though gains were uneven: airline and retail scores each rose by about 10 percentage points, telecom by only 3. The researchers say the unevenness suggests the memory agent intervenes at different rates depending on the task rather than following a fixed rule. Using the stronger Opus 4.6 as the action agent, gains shrank but did not disappear: 2.4 percentage points on Terminal-Bench and 2.5 on tau2-Bench, suggesting the system does more than compensate for a weaker model.

Ablations show why the design works: giving the action agent the full memory bank at every step performed worse than the full system; removing the option to stay silent, so a reminder fired at every step, stayed competitive but produced less consistent gains across domains; an advisor-style version without a persistent memory bank helped in some areas and hurt in others. The combination of a maintained memory bank with selective reminders performed best, and it outperformed Mem0, a production memory layer that retrieves records through search, because the memory agent also judges whether and how a stored state should enter the loop as a targeted reminder. In one tau2-Bench Airline example, a user falsely claimed Gold status; the baseline agent granted compensation based on the claim, while the memory agent reminded it to rely on the verified tool data instead. Most remaining errors, the researchers say, came from calibration rather than memory, such as treating a speculative inference with too much confidence.

The main version needs no specially trained model and runs as a prompted agent. The team also trained a smaller open model, Qwen3.5-27B, as the memory agent while keeping a much larger action model frozen; without training it hurt performance, supervised fine-tuning recovered the loss, and reinforcement learning further improved its decisions about when to recall a stored state. Meta AI lists open questions, including training the memory and action agents jointly, teaching the system to invoke memory on its own schedule rather than a fixed interval, and determining when literal memories beat task-specific abstractions. Meta AI has published the project's code on GitHub. The article notes Meta is not alone in tackling this: the open-source Mastra framework uses two background agents to monitor and compress conversations instead of keeping full history in context, the GAM system targets the same "context rot" problem and also benchmarks against Mem0, and other researchers are building lifelong AI memory systems that can add, revise and forget knowledge.

Key facts

  • Meta AI pairs an unmodified 'action agent' with a separate 'memory agent' that reviews recent steps and decides whether to inject a targeted reminder or stay silent, to counter what the researchers call 'behavioral state decay.'
  • With Claude Sonnet 4.5 as the action agent, the system solved 46 percent of Terminal-Bench 2.0 tasks on the first attempt versus a 38 percent baseline, and raised the tau2-Bench task-weighted average from 55 to 62 percent.
  • Gains varied by domain: tau2-Bench airline and retail scores each rose about 10 percentage points, telecom only 3; with the stronger Claude Opus 4.6 as the action agent, gains shrank to 2.4 points on Terminal-Bench and 2.5 on tau2-Bench but did not vanish.
  • Ablations show a persistent memory bank combined with the option to stay silent beats both giving the full memory bank at every step and a version that always outputs a reminder; the approach also outperformed the Mem0 memory layer.
  • The main version needs no special training, but a smaller open model, Qwen3.5-27B, needed supervised fine-tuning and reinforcement learning to serve as memory agent without hurting performance; Meta AI has published the code on GitHub.

Why it matters

Long-running AI agents routinely lose track of constraints they already discovered, retry commands that already failed, and re-diagnose errors they already solved, because the state that should guide their decisions gets scattered or buried across a growing task history. Meta AI's finding that longer context windows alone do not fix this points at a structural gap in how agents are built, not just a capacity limit: existing memory systems are tuned for storing and retrieving facts across sessions, not for deciding, moment to moment, whether a stored fact should actually change the agent's next move.

Who it affects

The work targets builders of long-horizon autonomous agents, from coding assistants working through multi-step tasks to conversational agents handling customer service workflows like the airline, retail and telecom scenarios in tau2-Bench. The authors frame it as a component for existing agent harnesses rather than a new agent model, so it is aimed at teams building on top of an action model rather than end users.

How to use it

The system runs as a prompted 'memory agent' paired with an unchanged 'action agent'; no specially trained model is required for the main version, though the authors also show a smaller open model, Qwen3.5-27B, can be taught the same role through supervised fine-tuning followed by reinforcement learning. Meta AI has published the project's code on GitHub, and the authors describe it as a plug-and-play addition to existing agents and harnesses, offering only memory-based reminders rather than broader strategic advice. No pricing or licensing terms are given in the source.

How solid is it

The results come from a Meta AI research paper tested on two established benchmarks, Terminal-Bench 2.0 for command-line agent tasks and tau2-Bench for conversational tool use, with gains reported for both a weaker action model (Claude Sonnet 4.5) and a stronger one (Claude Opus 4.6), which rules out the improvement being purely a crutch for a weak model. The team ran ablations isolating which parts of the design (the persistent memory bank, the option to stay silent) drove the gains, and compared results directly against Mem0, an existing production memory layer. No publication date, named authors, or independent replication are given in the source.

Risks and caveats

The system's central design problem, that too many reminders add latency, consume tokens and distract the agent, is only partially solved: even the full system leaves most remaining errors tied to calibration rather than memory, such as treating a speculative inference as more certain than it is. Gains were uneven across domains for reasons the researchers say they do not yet fully control, and a smaller open model needed extra training to use the memory agent role without a performance regression. Meta AI itself lists open questions, including how to train the two agents jointly and how to let the system decide on its own when to check memory rather than following a fixed interval, indicating the approach is not yet a finished, drop-in solution.