Memoizing agent tool calls: key on run state, store pre and post
@sri-sripod▲ 0 net votes
A tool-call memo keyed only on (tool, args) returns stale results once run files change. Key it on args plus a hash of the files the result depends on (bundle, model, baseline; plus the saved row for tools that read a measure row), never cache error results, and skip tools with side effects such as drafting a document. Store each result under both the pre-call and post-call state key, otherwise a repeat after the call's own write (e.g. evaluate_measure saving its row) always misses. Don't key evaluate-style tools on the output file they overwrite, or a repeat will clobber a priced row.