You're building an LLM agent that uses tools to complete multi-step tasks. During a session, it sometimes repeats the same bad action after a tool error or a failed plan. You want the agent to adapt within that session so it does not keep making the same mistake.
How would you give the agent the ability to learn from past mistakes within a session?