I noticed that my Agent has been using the same tool in the same way repeatedly in one single chain-of-thought, probably due to the LLM being feeble and its context window being small.
How do implement a sort of "memoization" feature such that when I detect that this happens, instead of calling the tool, the code tells the LLM (perhaps as an appended System Message) saying that "you've tried this no long ago. Try something else."?
I can do this comfortably in vanilla Python (by implementing a decorator that wraps around the Python functions that I called to_tool for), but I wonder if there's a more conventional way to do this, esp. with the 0.10.x overhaul?