Skip to content

What happens to a long-running LangChain agent after hour 6 (measured on three stacks)

One simulated 12-hour shift with every model call logged: when LangChain's, Letta's and Argentic's prompts crossed 100K tokens, what each spent, where it stopped and what it scored. Argentic did not win on score. The results for LangChain Deep Agents and the Claude Agent SDK are withdrawn.

Neil Luo ·

A record from November 2026. We don't update this post, so its numbers are the ones from then. The newest results are in the 12-hour head-to-head.

Correction, 28 November 2026. Any result on this page for LangChain Deep Agents and Claude Agent SDK is superseded and is not a fair comparison. LangChain Deep Agents: it ran without the persistent memory option its documentation recommends for a long-running agent (the memory option with a store-backed /memories/ file), which we did not configure. Claude Agent SDK: it ran with context only: every built-in tool (so no file tools) and every settings file (so no CLAUDE.md memory) was switched off. Reruns with each stack's memory setup are on their own run posts: the Claude Agent SDK with memory ran once, at the smaller of the two windows, and has no run at the larger one; Deep Agents with its memory option was run twice on the five-day shift and has no score (the first attempt stopped on a provider error after its emergency summary, the second was killed by the container's memory limit before it was graded), so nothing compares Argentic with Deep Agents. Argentic's own scores, the Letta runs and the run of the Claude Agent SDK with memory are not affected.

We build Argentic, so weigh what we say about it. It is one of the three stacks reported in this post, and it did not win on score. Every Argentic number names the engine version it came from.

If you run a LangChain or LangGraph agent for hours, the first thing that changes around hour 6 is probably the size of its prompt. People call what follows context rot; we call it context degradation, and it is an agent getting less accurate as a long run grows. We wanted to see what that does to the bill and to the answers, so we ran one simulated 12-hour shift through five stacks and logged every model call. Two of the five, LangChain Deep Agents and the Claude Agent SDK, ran without the memory setup their own documentation recommends, so on 28 November 2026 we withdrew their results and this post does not report them. We have no comparison against either that stands, and a rerun with each stack's recommended setup is pending. The three stacks below are LangChain, Letta and Argentic. Argentic is an engine that keeps AI agents right for hours while prompt size is bounded.

What did we run?

One shift at a bakery's operations desk: orders, price changes, stock counts, owner messages, standing instructions that get amended or revoked, and updates that contradict earlier ones. A fixed program with no model in the loop grades its questions, and 403 of them fall in hours 1 to 8, the hours Letta and Argentic ran in full. Every stack got the same seed, the same questions, the same grader and the same model, and each had a spend cap. Nothing was tuned. This was the 12-hour head-to-head shift (Claude Haiku 5.5, seed 20261217, Argentic four runs, the others one each, 25 November 2026, Argentic on engine 0.104.1).

The stacks reported here were a plain LangChain agent loop at its defaults, Letta with its memory tools on, and Argentic. We ran the JavaScript packages, so the Python versions are not measured here.

Three stacks on one 12-hour shift: spend, where each stopped, score and prompt size
QuestionArgentic 0.104.1usLetta 0.34.67LangChain 1.6.7
Spend$2.24 ($0.75 model spend plus $1.49 in step fees at the $1 per 1,000 agent steps rate listed on 25 November 2026) $8.02, a floor: its cap stopped it $5.09, a floor: its cap stopped it
Where it stoppedFinished all 12 hours. Its $8.00 spend cap, in hour 10. Its $5.00 spend cap, in hour 6.
Score, hours 1 to 80.87 0.89 None: stopped before hour 8.
Calls over 100K tokens0 of 1,487 809 of 1,232 47 of 580
Largest prompt55K tokens 269K tokens 109K tokens

Spend is token usage at list prices, not an invoice. A stack stopped by its cap has a spend that is a floor, not what finishing would have cost.

What does hour 6 look like?

Letta and LangChain each sent a prompt over 100K tokens between hour 5 and hour 6 of the shift (Claude Haiku 5.5, 25 November 2026). Argentic's largest prompt was 55K tokens, and none of its calls went over 100K (engine 0.104.1).

Letta sent 809 of its 1,232 calls over 100K tokens, and its largest prompt was 269K. The plain LangChain loop sent 47 of its 580 calls over 100K before its spend cap stopped it in hour 6, and its largest prompt was 109K (Claude Haiku 5.5, 25 November 2026).

Over hours 1 to 8, the stretch Letta and Argentic both ran in full, Letta scored 0.89 and Argentic 0.87 on its first run, with 0.86 to 0.89 across its four runs. Letta scored higher than Argentic's first run and matched the top of its range. Argentic spent less: $0.75 in model spend, or $2.24 with its step fee counted, against Letta's $8.02, which is a floor because its $8.00 cap stopped it in hour 10. Which matters more depends on your agent and your budget.

Letta is ahead of Argentic on 5 of 8 kinds, by the most on commitments (0.65 against 0.35). Argentic is ahead of Letta on 2 of 8, by the most on recall at distance (0.81 against 0.74) and contradictions caught (0.05 against 0.01).

How do I check whether my own loop crosses the line?

You need the prompt size of every call. LangChain puts it on the response message as usage_metadata. This callback writes it to a file, one line per call:

import json
from langchain_core.callbacks import BaseCallbackHandler

class UsageLog(BaseCallbackHandler):
    def __init__(self, path="usage.jsonl"):
        self.path = path

    def on_llm_end(self, response, **kwargs):
        for generations in response.generations:
            for g in generations:
                u = getattr(getattr(g, "message", None), "usage_metadata", None)
                if u:
                    with open(self.path, "a") as f:
                        f.write(json.dumps({"input_tokens": u["input_tokens"]}) + "\n")

Pass it with config={"callbacks": [UsageLog()]} on your agent's invoke call. Check one call by hand to confirm that input_tokens includes cached tokens for your provider. Then summarise the file with jq:

jq -s '
  [.[] | .input_tokens] as $p
  | { calls: ($p | length),
      over_100k: ($p | map(select(. > 100000)) | length),
      first_over: ((($p | map(. > 100000) | index(true)) // -1) + 1),
      largest: ($p | max) }
' usage.jsonl

first_over is the call number where you first crossed 100K, and 0 means you never did. Other models price long prompts differently, so check your model's price page for a step like this before you trust any estimate.

How do I keep the prompt down?

There are three common ways. You can cap how much history you send, which is simple but forgets whatever you cut. You can add a summarizing step, which keeps the gist but rewrites history, so details can degrade each time it runs. We did not measure that loss here. Or you can move long-lived facts out of the transcript and look them up when the agent needs them. Context degradation covers what each costs.

Argentic takes the third route. It builds each prompt from a record of the run, under a size cap, so the prompt stays small without throwing the record away.

What does this not show?

On one 12-hour Longshift shift (seed 20261217, Claude Haiku 5.5, Argentic four runs, the others one each), Argentic on engine 0.104.1 finished for $0.75 in model spend ($2.24 with its step fee counted), while Letta ($8.02) was stopped by its $8.00 spend cap in hour 10 and LangChain ($5.09) by its $5.00 cap in hour 6, both at their stock settings. Over hours 1 to 8, which Letta ran in full, Argentic scored 0.87 on its first run and 0.86 to 0.89 across its four runs on this seed and engine (mean 0.87), and Letta scored 0.89 (at the top of that range); the later hours were not asked of the stopped ones, so nothing is compared there. The seed was new: no earlier Argentic run had used it.

It is one seed, and the benchmark's own guide asks for at least three. Runs per stack: Argentic four runs, the others one each, so a rival's score carries noise we have not measured. Letta and LangChain were stopped by spend caps before the shift ended. The rivals ran on the Anthropic API and Argentic on a local copy of the hosted engine. The raw files for every run, with a SHA-256 for each, are on the head-to-head page, and the benchmark and its rerun commands are in open-haul-bench. Argentic's own prompts and internal logs are not published. We have no comparison against LangChain Deep Agents or the Claude Agent SDK that stands, and the rerun with their recommended memory setup is pending.

Short answers

What happens to a long-running LangChain agent after hour 6?
On our 12-hour shift Letta and the plain LangChain loop sent prompts over 100K tokens in hour 5 or 6, and every call after that carried that size. The plain LangChain loop reached its spend cap in hour 6.
Is this context rot?
It is the symptom people call context rot, which we call context degradation: an agent getting less accurate as its prompt grows over a long run. We measured prompt size, spend and score on one shift. We did not isolate the cause of any one wrong answer.
How do I check whether my own agent crosses the line?
Log input_tokens on every model call with a callback, then count the calls over 100K tokens and find the first one. The post has the callback and a jq command.
Did Argentic win?
No. It spent the least of the stacks reported, and Letta scored higher over hours 1 to 8 (0.89 against 0.87 for Argentic's first run, at the top of the range of its four runs). The post says what the run does not show.
Why does this post leave out LangChain Deep Agents and the Claude Agent SDK?
Both ran this shift without the memory setup their documentation recommends, so we withdrew their results on 28 November 2026. We have no comparison against either that stands, and the reruns with each stack's recommended setup give no comparison: Deep Agents with its memory option has no score, and the Claude Agent SDK with memory ran once, at the smaller window.

Sources and method: Head-to-head on a 12-hour shift.

More posts.

  1. Updated

    How to run a LangChain agent for hours without it forgetting older facts

    Keep your LangChain or LangGraph tools and let Argentic run the loop: a ready-made engine, no memory layer of your own to build, and a record you can read. The code is checked against the npm client, with what carries over, what does not, what Python gets and where Argentic is the wrong pick.

  2. Updated

    Agent memory without compaction: Memvid, Empecta, Letta, Deep Agents and Argentic compared

    Which tools keep an agent's memory without summarizing it: Memvid and Empecta Agent Memory as stores your code calls, Letta, LangChain Deep Agents and Argentic as engines that run the loop, what each does when a fact changes, read from each project's own docs, with where Argentic is the worse pick.

  3. Updated

    Compaction or full history for a long-running agent? A benchmark over 12 hours and 5 days, with accuracy and cost

    What a long-running agent scores and costs when it has to cut its history by compaction or summarization and when each prompt is built from a record under a size cap: Argentic beside Letta over 12 hours, Argentic's own run over 5 working days, and the rows where Argentic lost. The results for LangChain Deep Agents and the Claude Agent SDK are withdrawn, so there is no standing number for keeping the whole history.

  4. Updated

    My agent forgets details after compaction or summarization: what each stack does, and what to do

    What the Claude Agent SDK, Deep Agents, LangChain's summarization middleware and the OpenAI Agents SDK do when the context window fills, why a detail goes missing, five fixes that work inside any of them, where our own results stand, and when to change who builds the prompt.

  5. Updated

    Claude Agent SDK compaction loses context: what survives, what to move out, and when it is not enough

    What the Claude Agent SDK's docs say automatic compaction keeps and drops, five fixes in order (CLAUDE.md, summary instructions, a PreCompact archive, logging the boundary, subagents), how to tell compaction is the cause, and where our own results stand.

  6. Updated

    LangChain Deep Agents summarization forgets details: what it keeps and where the rest goes

    How Deep Agents handles a full window in layers (offloading large tool results, truncating older calls, then a model-written summary with the originals saved to a file), why a detail can still go missing, three fixes inside Deep Agents, and where our own results stand.

  7. Updated

    Why does my long-running agent cost more every turn? Token cost, and five fixes

    Why a long-running agent's bill grows faster than its run, five ways to bring it down (prompt caching, offloading large tool results, subagents, a spend cap, a bounded prompt) with where each one stops helping, and what a long run cost when we measured it.

  8. Updated

    My LangChain agent is losing the plot on long tasks: forgets its goal, loops, contradicts itself

    Seven ways a LangChain agent loses the plot on a long task, each with its usual cause, the cheapest fix and when the answer is a tracing, evaluation or memory tool instead, then what a long run cost when we measured it.

  9. Updated

    LangChain alternatives for long-running agents: Pydantic AI, LangGraph, Letta, Mem0 and more, by the problem you have

    What it costs to keep a LangChain agent right over a long run, then what to switch to when it gets worse over hours: Pydantic AI, the OpenAI Agents SDK, LangGraph, Mastra and LlamaIndex as loops, Mem0, Zep, Cognee, Supermemory, Hindsight and Letta as memory, and Argentic, each read from its own docs.

  10. Updated

    How to fix context rot in a LangChain agent

    Confirm it is the prompt, find what the agent forgot with a five-fact test, fix what you can inside LangChain, and change who builds the prompt when that is not enough.

  11. Updated

    Best tools for long-running AI agents in 2026, sorted by the job each does

    Argentic, Letta, LangGraph, Hindsight, Mem0, Zep and the agent SDKs sorted by whether they run the loop, build the graph, add memory or trim history, with each read from its own docs and Argentic measured beside Letta on a 12-hour shift.

  12. Updated

    Hindsight alternatives for long-running agents, by why you are leaving

    Mem0, Zep and Graphiti, Letta, LangGraph and Argentic next to Hindsight, matched to the four reasons teams look elsewhere, read from each tool's own docs and pricing page, with where Hindsight stays the better pick.

  13. Updated

    Argentic vs Hindsight: which should a team with a long-running agent use?

    Hindsight is an open-source memory system your code calls, and it helps recall. Argentic is an engine that runs the loop and keeps the agent right at a bounded prompt. What each does, where Hindsight is the better pick, whether to use both, and a one-week test.

  14. Updated

    Should you combine memory tools for a long-running agent?

    Four jobs keep an agent right over hours: the record, the state, search and building each prompt. Why a stack of four tools usually costs more than it gives, what one engine covers, and when combining is the right call.

  15. Updated

    What to buy when your agent gets less accurate after hours: a memory tool or an engine?

    A memory tool helps recall, but an agent that runs for hours still drifts and its prompt keeps growing. Which kind of product fixes which problem, what each costs, and when Argentic is the wrong call.

  16. Updated

    My LangGraph agent gets worse after hours: what should I use?

    Why a LangGraph agent loses accuracy as a run grows, four things to change (three keep LangGraph), how to tell which problem you have, and when moving off LangGraph is the wrong call.

  17. Updated

    Alternatives to Letta for agents that run for hours

    Hindsight, Mem0, Zep and Graphiti, LangGraph and Argentic next to Letta, sorted by the job each does, read from their own docs and pricing pages, with where Letta is the better pick.

  18. Updated

    How to stop an agent's context degrading over a 12-hour run

    Keep a record of the run outside the model and build each prompt from it under a size cap. The seven parts to build, a test that plants facts at hour one and asks at hour eleven, and when to buy instead.

  19. Updated

    Context degradation (context rot) in AI agents: what it is, what causes it and how to stop it

    Context degradation, often called context rot, is an agent getting less accurate as a run gets long. The six causes, what each fix gives up, a test you can run on your own agent, and what we have and have not measured.

  20. Context degradation: what rewriting an agent's history costs over hours

    Summarizing, compacting and truncating an agent's history all lose facts it once had. What that looks like, what our 12-hour benchmark did and did not show about it, and a test you can run on your own agent.

  21. Updated

    My agent gets worse as the run gets long: what Lossless Claw, Hindsight, Mem0, Letta and Argentic each do about it

    What Lossless Claw is, and how it, Hindsight, Mem0, Letta, Zep, LangGraph, the OpenAI Agents SDK's compaction and Argentic each handle a long-horizon agent whose window fills up. Read from their docs, with where each is ahead of us.

  22. LangChain Deep Agents or Argentic: what each does when a run outgrows the window

    Deep Agents offloads big tool results to files and summarizes old history. Argentic rebuilds each prompt from a record of the run. How they differ, where Deep Agents is ahead of us, and what we have and haven't measured.

  23. Does a growing transcript hurt a long agent run? Our early test, and the part we retracted

    An early September test of rebuilding the prompt at each task boundary against a growing transcript. The study reports it found more in all three cells, by less than we first claimed, and the claim that a growing context makes an agent worse did not survive our own re-test.

  24. Why an agent juggling many tasks loses track of what's done, pending and blocked

    Six reasons one agent working through many tasks reopens finished ones, forgets blocked ones and reports done too early, what fixes each, and the one underneath. We have no orchestration benchmark yet, and the post says so.

  25. Why an agent's own memory skips things

    Six reasons notes an agent writes for itself leave out the one detail that mattered, what to do about each, and the one underneath. On our shop shift, stock answers were exact on 22 of 28 with the engine keeping the counts and 4 of 28 with the model writing them (Claude Haiku 5.5, engine 0.51.0, 2 November, one run each).

  26. Why your agent forgets things after compaction

    Six reasons an agent loses details when its context is summarized and restarted, what you can do about each, and the one underneath. Includes our one-run shop-shift numbers and what they don't show.

  27. Why long-running agents lose track of counts

    Six reasons an agent's running totals drift, what to do about each, and the one underneath. On our own 900-event shop shift, stock questions were exact on 22 of 28 with the engine keeping the counts and 4 of 28 with the model writing them (Claude Haiku 5.5, engine 0.51.0, 2 November, one run each). Six answers were still wrong.

  28. Why your agent repeats an action it already took

    Six causes of a repeated refund or email, from a missing stop condition to a record the agent lost, what fixes each, and the one underneath most of them. Our November rerun had no refund applied twice, with a key on the tool in both runs.

  29. Where Argentic fits next to the agent SDKs and the tools around them

    A table-by-table read of the Claude, OpenAI and Amazon agent SDKs, then Mem0, Zep, LangGraph and Letta, from their own docs, with where each is ahead of us.

  30. A plain transcript loop or an engine like ours: when each is the right call

    What the plain loop does well, where it runs out, and what the engine costs you.

  31. Why your agent forgets things from a long history

    On Gemma 4 31B, with histories of about 1.2 million tokens, a loop that keeps only about the newest 100,000 tokens got 5 of 60 right and the engine got 38. What we ran and what it doesn't show. The engine version is not recorded in the public rows.

  32. Does summarizing old context lose details? We measured it

    On Gemma 4 31B, with histories of about 1.2 million tokens, our own note-rewriting loop got 17 of 60 and the engine got 38 of 60. Most of the loop's misses were answers saying the detail wasn't in its notes (29 of 43). The engine version is not recorded in the public rows.

  33. Resuming an agent after a crash without repeating a finished action

    We killed a real server mid-run with SIGKILL and finished the work from another process. What was not repeated, and what a retry can still do.

  34. Checking what your agent was shown on each turn

    Replay re-checks every prompt against what was recorded: 1,754 of 1,754 turns matched. It checks the prompt side only. The engine version is not recorded in the public rows.

  35. Run your first long-running agent with an API key

    Sign in to the Argentic dashboard, make an API key and run an agent that remembers. What you get, what we've measured and what isn't there yet.

  36. Undoing what a bad source caused, from the record alone

    When a source was flagged after the run, the engine undid what it could have caused, using undo functions the host supplies, and finished without it, in 156 of 156 runs: 120 scripted, and 36 live Haiku 5.5 runs, 24 of them with the compromise forced. The live runs were rerun after an engine fix; the first 12 had 2 worlds missing benign effects. The engine version is not recorded in the public rows.

  37. Why we rebuild an agent's context instead of appending to it

    What rebuilding context from a record changes, in plain terms, and the limits of what we have measured so far.