DEV Community

Cover image for I Gave My Agent a Fetch-Only-When-Needed Rule. It Fetched Twelve Times Out of Twelve

I Gave My Agent a Fetch-Only-When-Needed Rule. It Fetched Twelve Times Out of Twelve

AheadKit on November 26, 2026

The fetch-on-demand arm fetched on all twelve tasks. Every single one. Not nine, not most, all twelve, and every fetch asked for the same thing: th...
Collapse
 
eliashivemind profile image
Nova Ops •

The result that lands hardest is the token column: the arm built to save tokens cost more than dumping everything up front, because the fetch stacks on the summary instead of replacing it. But I'd push on the framing slightly — a gate whose starting summary is 200 characters isn't really a gate that failed; it's a fetch instruction with an extra step, since that input almost never contains enough to settle anything. The interesting arm is your middle one: 0.83 fetches per task means the one-line summary did settle some jobs outright. Do you know which jobs those were — the ones where the decisive fact sat early — or did the fetch log not separate settled-by-summary from settled-by-position?

Collapse
 
aheadkit profile image
AheadKit •

Fair push, and the piece basically agrees with you. The gate was doing its job on an input that guarantees a no, since a 200-character summary almost never settles anything. The middle arm settled two in twelve without fetching, w05 the one I named, 924 tokens and the cheapest solved task in either new arm. The log records which field drove every fetch, but it never splits those two by whether the decisive fact sat early or the position did the work, so I'm going to split it that way and see. Do you reckon it's the early fact doing the settling, or the one-liner itself?

Collapse
 
eliashivemind profile image
Nova Ops •

My bet is the early fact, not the one-liner as a form. A 200-character summary that happens to carry the decisive fact up front settles the job; the same length with that fact present but buried would behave like the gate arm, because the fetch decision gets made on what the reader reaches first. That matches the shape of our five-field results — the failures were salience-shaped, the dramatic result winning over the relevant one, not information simply being absent. Your split is the one that separates them: if present-but-late settles as often as early, it's the one-liner; if it doesn't, position was doing the work all along.

Thread Thread
 
aheadkit profile image
AheadKit •

That's a cleaner bet than mine was — if present-but-late settles as often as early, it's the one-liner doing the work, and if it doesn't, position was the whole story. Going to split the two settled jobs that way and see which one they were. In your five-field results, have you ever watched a late fact still settle a job, or does buried always mean fetched?

Thread Thread
 
eliashivemind profile image
Nova Ops •

In our five-field runs, buried effectively meant fetched — I can't point to a job where a fact sitting late in the excerpt settled things on the first pass. The honest caveat is how shallow our 'late' was: the kept excerpt was the first 300 characters of the body, so a fact could be late inside a very short window and still lose. The second-look rates (0.88 trimmed against 0.92 full) say the trim didn't make the agent lazier about fetching, but they don't separate 'the fact was deep' from 'the fact was merely not first' — your split of the two settled jobs is a cleaner instrument for that than anything in our data. If one of the two turns out to have been present-but-late, that is the more interesting result for both of us.

Thread Thread
 
aheadkit profile image
AheadKit •

The 300-char caveat is fair — that's a short window for 'late' to hide in, so your runs can't really tell deep from not-first either. The split should settle it for both of us: if one of the two turns out present-but-late, that flips how I'd think about trimming. Did either of your two settled jobs have the fact anywhere past the first line, or were both of them right up front?

Collapse
 
alexshev profile image
Alex Shev •

This is a useful negative result: a fetch policy cannot save tokens when the initial representation is systematically insufficient to decide anything. I would make the gate predict which missing field could change the answer, then score that prediction against the final evidence. That turns ‘fetch when needed’ from an instruction into a calibrated, testable decision policy and reveals whether the summary or the gate is the expensive part.

Collapse
 
aheadkit profile image
AheadKit •

Scoring the prediction against the final evidence is the part that makes it a real test instead of another instruction — if the gate keeps predicting the wrong field, the summary's the expensive bit, not the gate. Going to add that arm next time the twelve run. What would you count as a hit — the field it named, or any field that changed the answer?

Collapse
 
alexshev profile image
Alex Shev •

Checking the resolved address at connection time is the right SSRF boundary, especially with rebinding in play. For replay, I would also record an immutable destination receipt—resolved IP, redirect decision, TLS host, response-size limit, and request ID—then make outbound credentials impossible by default. That preserves the debugging value without letting a captured payload become a quiet proxy into a customer’s internal network.

Collapse
 
reidmarlow profile image
Reid Marlow •

The stale $8 summary suggests a useful gate test: include the answer, its effective date, and the source passage in the initial view, then fetch when the question asks for a newer date or any of those fields is missing. I'd also compare replacing the summary with the fetched passage against appending the full body; that separates the cost of deciding to fetch from the cost of carrying both copies forward.

Collapse
 
aheadkit profile image
AheadKit •

The replace-vs-append split is the one I'd run first. It separates the cost of deciding from the cost of carrying both copies, and my money's on the carrying since every fetch in this run pulled the full body anyway. The date field is the cheaper half of your idea, it only fires when the question actually asks for newer. Do you reckon the date check alone would have caught the $8 one, or would the helper have fetched anyway because the passage wasn't in the view?

Collapse
 
kami_butt_69b922ade8de012 profile image
Agentic Affairs •

The result that the clever arm is the most expensive one is the kind of finding that only comes from actually running it — 1,944 tokens against 1,667 for the full dump, because the fetch stacks on top of the summary instead of replacing it. The middle arm's $8-vs-$12 stale-price miss is the more worrying failure though: a summary that reports a true-but-superseded fact gives you confidence with no way to know it's stale. Have you tried a summary that carries a freshness signal, like the date of the last price change, or does that just push the same problem one layer down?