Ollama Explains Why Coding Agent Sessions Get Expensive
Ollama and Together AI have published a joint engineering post on why long coding agent sessions get slow and expensive, and on the one rule that decides it: the prefix cache.
Transcript
Coding agents resend the whole conversation on every step. One character change near the top makes it expensive again.
The input grows every turn while the answer stays a short tool call. Without prefix caching, repeated work rises with the square of session length.
The cache matches from the start until the first token differs. Adding to the end is free. Changing the top rebuilds the rest.
A changing timestamp in the system prompt breaks the cache. Pick one reasoning effort and keep it.
Ollama sells harness integrations, Together AI sells inference. The post has no benchmarks, calls its arithmetic idealized, and the fifty thousand dollars a year for one GPU is its own.
Inboxsmith builds AI phone and email agents for small business. Please like and subscribe for more news.
Sources
Every claim in this video comes from the top ranking coverage of this topic. The claims and where each one came from:
- Narration backed: 'The input grows every turn while the answer stays a short tool call. Without prefix caching, repeated work rises with the square of session length.' Supporting verbatim substrings from article.txt (reproduced with plain ASCII apostrophes because the source file mixes typographic apostrophes with HTML entities such as ’ and “): 'Coding agents have an odd traffic pattern.'; 'Every time the agent takes a step, the harness sends the model the entire conversation so far: the system prompt, every tool definition, your request, every file the agent has read, and every command it has run.'; 'What comes back is usually a tool call a few dozen tokens long.'; 'Each turn the input gets longer, and the output stays roughly the same size'; 'an agent turn is mostly prefill, because the input is the whole session and the output is usually a short tool call'; 'is what saves most of that work'; 'But the pattern holds: without caching, the work you redo grows with the square of the session length.' Substitutions and omissions. DASH RULE: the source sentence 'Each turn the input gets longer, and the output stays roughly the same size' continues into an em dash followed by 'a few tool calls'; the quoted substring stops at 'size' deliberately, because no em dash or en dash character may appear anywhere in this file, so the tail of that sentence is not reproduced here and the same fact is carried instead by the clean sentence 'the output is usually a short tool call'. TTS REWRITE ONE, the banned word 'agentic': the post's own title is 'Making open models work for long-horizon agentic workloads' and the phrase 'most agentic workloads' appears in the body. This voice garbles 'agentic' every time and a re-roll does not fix it, so the word appears nowhere in the script; the narration says 'agents' in the hook and describes the workload as turns of a session instead. The same rule removed the title's hyphenated compound 'long-horizon', which would also have triggered the compound modifier stutter. TTS REWRITE TWO, the banned acronym rule: the source states the pattern as 'This large input sequence length (ISL) and small output sequence length (OSL) is characteristic of most agentic workloads.' Neither 'ISL' nor 'OSL' has spoken precedent on this channel, so both are dropped and the narration states the same thing in plain words, 'The input grows every turn while the answer stays a short tool call'. 'answer' was chosen over 'output' because the sentence already uses 'input' and the pair reads more clearly aloud. TTS REWRITE THREE, the repetition rule: the source says the redone work 'grows with the square of the session length' and the narration says 'rises with the square of session length'. 'grows' was replaced by 'rises' only because the first half of the same narration line already says 'The input grows every turn', and the article 'the' before 'session length' was dropped purely for the character budget; the quantity being described is unchanged. NUMBERS QUARANTINE: the source's worked example, '1 + 2 + ... + 10 = 55 units of prompt', 'With caching, they process 10', and 'At a hundred turns ... it's 5,050 versus 100', is deliberately narrated nowhere in this script. Two numeric figures sitting close together drive the transcriber into a repetition loop, and that passage holds five of them in three sentences. The source's own plain summary sentence, 'without caching, the work you redo grows with the square of the session length', carries the identical point with zero figures, so that is what the scene speaks. The only figure spoken in the entire script is the GPU rental cost, and it is quarantined in scene 4. Also omitted for the character budget: the prefill and decode explanation ('the engine reads the whole prompt in one big parallel pass and produces the first token', 'Decode is limited by memory bandwidth more than by compute'), the reasoning tokens aside, and the entire reading-a-page comparison in the 'Cache is king' section, which is an analogy and is barred from narration by the owner rule on figures of speech. The section heading 'Cache is king' is itself a figure of speech and is carried nowhere in the script. The word 'read' is avoided throughout the narration because this voice mispronounces the homograph; where the source writes 'every file the agent has read' and 'a full re-read', the narration says nothing of the kind.(Scene 1 rests entirely on the first-party Ollama blog post 'Making open models work for long-horizon agentic workloads', datelined November 16, 2026, two days before this video was authored. The post carries the byline 'By Parth Sareen and Zain Hasan (Together AI)', so it is co-authored by Ollama and by Together AI, and both of those companies sell the products the post is about: Ollama sells the harness integration layer that decides what goes into each request, and Together AI sells the inference engine that serves the request. The post is therefore a vendor document written by two vendors with a direct commercial interest in the conclusion. The alert-time snapshot captured by the news watcher at scripts/data/article-cache/0accc1483e1e4144.txt (captured 2026-11-18T19:16:41Z, 16437 bytes) was copied verbatim to scripts/data/production/ollama-agent-prefix-cache/article.txt, the two files were diffed and are byte identical, and that saved production file is the only text this scene was written from. The live URL was re-fetched and confirmed to match the snapshot, so the quoted substrings below are known to reflect what the page currently serves. The YouTube transcript sweep for this story returned zero usable transcripts out of five candidates because the yt-dlp build on this host is out of date; transcripts.json in the production directory holds zero videos, sources.json is empty, and timeline-probes.json contains only unrelated generic cache explainer videos with no coverage of this post. Nothing in scene 1 is independently corroborated. Specifically unverified for this scene: the post publishes no benchmark, no latency measurement, no token counts from a real session, no model names attached to the traffic pattern claim, and no methodology for how the authors established that input dominates in a long session. The quadratic growth statement is presented as arithmetic rather than as data, and the post itself labels the worked example as idealized, so the scene speaks the pattern and not any number drawn from it. No third party has measured either company's cache behaviour anywhere in this document.)
- Narration backed: 'The cache matches from the start until the first token differs. Adding to the end is free. Changing the top rebuilds the rest.' Supporting verbatim substrings from article.txt (ASCII apostrophes substituted for the source's typographic ones and for the HTML entity ’): 'The catch is that a prefix cache matches from the beginning of the prompt up to the first token that's different, and stops there.'; 'Everything after that first difference has to be processed again.'; 'Adding to the end of the prompt costs nothing extra.'; 'Changing anything earlier, even a single character, means re-processing everything after it.'; 'If the change is near the top, you've effectively thrown away the whole session and now must rebuild the cache.'; 'Almost everything else in this post follows from that one rule.' Substitutions and omissions. COMPRESSION ONE: 'matches from the beginning of the prompt up to the first token that's different, and stops there' became 'matches from the start until the first token differs'. 'beginning of the prompt' was shortened to 'the start' and 'up to the first token that's different, and stops there' was shortened to 'until the first token differs', because 'until' already encodes the stop; this saved forty one characters against a joined ceiling of seven hundred and ninety, which is the gate that actually bound this script. COMPRESSION TWO: 'Adding to the end of the prompt costs nothing extra' became 'Adding to the end is free'. 'of the prompt' is recoverable from the previous sentence and 'costs nothing extra' became 'is free', which is literal rather than figurative and saves nine characters. COMPRESSION THREE: 'Changing anything earlier, even a single character, means re-processing everything after it' plus 'If the change is near the top, you've effectively thrown away the whole session and now must rebuild the cache' were merged into 'Changing the top rebuilds the rest'. The source's own verb for the consequence is 'rebuild the cache', so 'rebuilds' is the article's word, and 'the rest' stands for 'everything after it'. The vivid clause 'you've effectively thrown away the whole session' was dropped on purpose: 'thrown away' is a figure of speech and the owner rule bars figures of speech from narration. The 'even a single character' detail is not dropped from the script, it is moved to the hook, which says 'One character change near the top makes it expensive again'. TTS REWRITE: the source writes 'er-processing' style hyphenated compounds throughout this passage, 're-processing' and 're-read' and 're-renders'; none of them is spoken, because a hyphenated compound makes this voice stutter and repeat the sentence tail. The narration uses the plain verbs 'differs' and 'rebuilds' instead. The banned-token rule also removed the word 'prefix' from this scene's first sentence, not for pronunciation but for the character budget, since scene 1 has already established the subject as prefix caching and the bare noun 'cache' is unambiguous by this point in the script. No figure appears in this scene, so there is no two-figures-in-proximity repetition risk. Omitted for the budget: the harness and engine division of labour sentence, 'The harness decides where that first change lands. The engine decides whether the cache is still there when the next request shows up.', and the concession 'A cached session isn't completely free either, since every new token still has to attend to the cached ones.'(Scene 2 states the single mechanical rule the rest of the post is built on, and it rests entirely on the same first-party Ollama post of November 16, 2026, co-authored by Ollama and Together AI, both of which sell the layer the rule governs. The alert-time snapshot at scripts/data/article-cache/0accc1483e1e4144.txt was copied verbatim into the production directory as scripts/data/production/ollama-agent-prefix-cache/article.txt, the copy was diffed against the snapshot and is byte identical, and that saved file is what this scene was written from. The live URL was re-fetched and confirmed to match the snapshot. The YouTube transcript sweep returned zero of five usable transcripts because this host's yt-dlp build is out of date, so there is no independent demonstration, no engineering writeup from a third party and no trade-press account against which to check the rule as stated. Nothing in scene 2 is independently corroborated. Specifically unverified for this scene: the post describes prefix cache matching as a general property but never names which engines or which model versions it measured this on, publishes no cache hit rate, no prefill time, no token figures and no reproduction steps. The claim that adding to the end of a prompt costs nothing extra is stated flatly with no measurement attached, and the post itself concedes elsewhere that a cached prefix is cheap to process rather than free, since every new token still attends to the cached ones. The scene narrates the matching rule only, not any cost number, which is the part of the post that is a definition rather than a result.)
- Narration backed: 'A changing timestamp in the system prompt breaks the cache. Pick one reasoning effort and keep it.' Supporting verbatim substrings from article.txt (ASCII apostrophes substituted for the source's typographic ones and HTML entities): 'The easiest way to wreck the cache is to put something in the system prompt that changes from turn to turn, like a current timestamp, the git status, or a working directory the agent keeps moving through.'; 'If the harness re-renders the system prompt with fresh values on every turn, every turn is a full re-read.'; 'reasoning effort isn't a separate setting the engine handles on the side. The chat template writes it into the very first system block, ahead of the tools and the conversation.'; 'You raise effort from low to high.'; 'the next request now differs from the last one almost at the first token. Which means the whole session gets processed again.'; 'Our advice is to pick an effort level at the start and leave it there.' Substitutions and omissions. SELECTION: the article offers three good breakers, a changing value at the top of the system prompt, raising reasoning effort partway through a task, and tool output truncated without telling the model it was truncated. The character budget allowed two, so the first two were taken because they share one mechanism, something near the top of the prompt changing, which is the rule scene 2 just established. The truncation failure, 'the tool returns the first 100 lines of a 640-line file without saying it stopped' and 'Cutting it without saying so gets you a model confidently editing code it never saw', is the most vivid item in the post and is deliberately not narrated: it carries two numeric figures in one sentence, which is the exact construction that sends the transcriber into a repetition loop, and rewriting it without the figures cost more characters than the scene had. TTS REWRITE ONE, the banned brand-plus-digits rule: the source names the model whose chat template writes reasoning effort into the first system block, and that name is a brand glued to a version number. This voice mangles a brand glued to digits every time, so the model is not named anywhere in the narration and the failure is stated as a property of the setting rather than of a named product. The same rule keeps every other model name in the post out of the script. TTS REWRITE TWO, the hyphenated compound rule: the source writes 're-renders' and 'a full re-read', and 'read' is additionally a homograph this voice mispronounces, so neither word is spoken; the narration says only 'breaks the cache', which is the source's own framing in 'The easiest way to wreck the cache'. 'wreck' was not used because it is closer to a figure of speech than 'breaks'. TTS REWRITE THREE: 'pick an effort level at the start and leave it there' became 'Pick one reasoning effort and keep it'. 'reasoning' was pulled forward from the section heading and body so the listener knows which setting is meant, 'at the start' was dropped because 'Pick one ... and keep it' already carries the sequence, and 'leave it there' became 'keep it' for the character budget. The advice is the post's own, stated in its own voice as 'Our advice is'. NUMBERS: this scene speaks no figure at all. 'hundreds of thousands of tokens', which appears twice in the source, is omitted both times, partly for the budget and partly because it is an unquantified vendor estimate. The compaction suggestion, 'You could also compact before changing the reasoning value to decrease the amount of prompt tokens', and the session-identity nuance about the user's name and the session start date, are omitted for the budget.(Scene 3 gives the two concrete cache breakers and the post's own remedy, and it rests entirely on the first-party Ollama post of November 16, 2026, co-authored by Ollama and Together AI, both of which sell the software in question. The alert-time snapshot at scripts/data/article-cache/0accc1483e1e4144.txt was copied verbatim to scripts/data/production/ollama-agent-prefix-cache/article.txt, the two files were diffed and are byte identical, and that saved production file is the sole text this scene was written from. The live URL was re-fetched and confirmed to match the snapshot. The YouTube transcript sweep returned zero of five usable transcripts because the yt-dlp build on this host is out of date, so no outside engineer, no benchmark and no competing harness vendor is on record here confirming either failure mode. Nothing in scene 3 is independently corroborated. Specifically unverified for this scene: the reasoning effort failure is reported by Ollama about one named open model's chat template, and the post gives no version string beyond that name, no date, no commit, no measured token cost and no before and after timing. Its estimate of the damage is the unquantified phrase 'hundreds of thousands of tokens'. The timestamp failure is asserted as a general design mistake with no example harness named and no measurement. The remedy, picking an effort level once and leaving it there, is the vendors' advice about their own stack rather than a tested result, and the post offers no evidence that starting a fresh session is in fact cheaper than continuing an old one, which is the stronger of the two things it recommends.)
- Narration backed: 'Ollama sells harness integrations, Together AI sells inference. The post has no benchmarks, calls its arithmetic idealized, and the fifty thousand dollars a year for one GPU is its own.' Supporting verbatim substrings from article.txt (ASCII apostrophes substituted for the source's typographic ones and HTML entities): 'By Parth Sareen and Zain Hasan (Together AI)'; 'We come at this problem from opposite ends.'; 'Ollama works on harness integrations which means deciding what goes into each request. Together AI works on the inference engine which means deciding what happens when that request arrives.'; 'On the Ollama side, we shipped the ability to connect your favorite harness through the'; 'At Together AI, we think of an inference engine as a machine for keeping GPUs busy.'; 'Real turns vary in size, so treat these as idealized numbers.'; and the cost sentence, quoted here in two pieces, 'A single GPU costs around' and 'to rent per year'. Point one, vendor provenance: 'Ollama sells harness integrations' is the article's own self-description, 'Ollama works on harness integrations', converted from 'works on' to 'sells' because the post is on Ollama's commercial domain and the same section advertises a shipped product command for connecting harnesses; 'Together AI sells inference' is likewise the article's own 'Together AI works on the inference engine', shortened to the bare noun 'inference' for the character budget. Both companies are named, and what each one sells is named, which is the requirement for this beat. Point two, no benchmarks: this is an absence I verified by searching the full saved text rather than a statement the post makes about itself, and the videoTitle field for this scene records the exact search strings used. Point three, idealized arithmetic: 'calls its arithmetic idealized' is a direct compression of the post's own concession, 'Real turns vary in size, so treat these as idealized numbers', and the attribution verb 'calls' makes clear this is the post admitting it rather than the channel alleging it. Point four, the cost figure: the source sentence is 'A single GPU costs around $50k to rent per year, so ideally it should never sit idle'. CURRENCY GLYPH RULE: the source writes the figure with a dollar glyph and the token '50k', and no currency glyph may appear anywhere in this file, so the quotation above is split into two pieces around the figure rather than reproduced with the glyph. The narration writes the amount out in full spoken words, 'fifty thousand dollar', with no digits and no glyph. ACCURACY: 'per year' is preserved as 'yearly' and 'to rent' is preserved in substance by keeping the amount a recurring cost rather than a purchase price; dropping 'yearly' would have turned an annual rental into a sticker price and was rejected for that reason even though it would have saved characters. ATTRIBUTION: 'is its own' marks the figure as the post's own number, which matters because it appears in the section written from Together AI's side and it is a statement about Together AI's own cost base, offered with no source, no cloud provider named, no GPU model named and no contract terms. This is the only figure spoken anywhere in the script, which is why no two-figures-in-proximity repetition risk exists in any scene. TTS REWRITE: 'GPU' is on the safe spoken list and is used; 'RDMA', 'API', 'CPU', 'PagedAttention' and 'prompt_cache_key' all appear in the source and none is spoken. No brand glued to digits is spoken anywhere. Brand mentions across the whole script are held to Ollama once and Together AI once, because the render audit splits compound brands and false-fails above three. Omitted for the budget: the entire engine-side section on routing, cache offload to CPU memory and split prefill and decode clusters, and the closing joint-session walkthrough. The word 'itself' never appears as two words anywhere in this file. MANAGER REVISION (applied after the authoring pass, before voiceover): the narration tail originally read "the yearly fifty thousand dollar GPU cost is its own". Four stacked words standing in front of the noun ("fifty thousand dollar GPU cost") is the unhyphenated form of the compound modifier shape that makes this voice stutter and repeat the sentence tail, and a re-roll does not fix that class of fault, so the stack was dissolved into a plain prepositional phrase: "the fifty thousand dollars a year for one GPU is its own". The quantity, the period it covers, the unit it describes and the attribution are all unchanged, "dollars" is now a plain plural noun rather than a modifier, and the figure is still written as spoken words with no digits and no currency glyph. The quoted narration above is the revised and final line.(Scene 4 is the channel's standing provenance and limitations beat, and it is the most important scene in this script because the story is a vendor document. The post is the first-party Ollama blog post of November 16, 2026, and its byline is 'By Parth Sareen and Zain Hasan (Together AI)', which makes it a joint publication by two companies that each sell one half of the thing it recommends: the post states in its own words that Ollama works on harness integrations and Together AI works on the inference engine. Every claim the post makes about how to protect a prefix cache is therefore a claim about the value of its authors' own products, made by its authors. The alert-time snapshot at scripts/data/article-cache/0accc1483e1e4144.txt was copied verbatim to scripts/data/production/ollama-agent-prefix-cache/article.txt, the two were diffed and are byte identical, and the full saved text, all two hundred and forty three lines including the site navigation chrome and the footer, is what was searched to establish the absences stated in this scene. The live URL was re-fetched and confirmed to match the snapshot. The YouTube transcript sweep returned zero of five usable transcripts because the yt-dlp build on this host is out of date, transcripts.json holds zero videos, sources.json is empty, and timeline-probes.json contains only unrelated generic cache explainer videos. There is therefore no outside source anywhere in this story. I searched the full saved text for any external check using the strings 'benchmark', 'measured', 'evaluation', 'independent', 'third party', 'audit' and 'latency', and found no benchmark table, no measured result, no methodology section and no named evaluator of any kind. The only quantities in the whole post are the idealized caching arithmetic, which the post itself labels idealized, and the GPU rental cost, which is Together AI's own figure about Together AI's own cost base. This scene states those limits plainly and attributes them rather than editorialising: a vendor engineering post is not obliged to carry benchmarks, but a viewer should be told that this one does not.)
