Learning

Concept
The memory module provides an advanced, task-centric long-term memory system.
Its core objective is to enable agents to learn from experience, avoid repeating mistakes, and continuously improve their task completion abilities.
Core Functions
-
Automated learning through self-correction (train_on_task):
- This is one of the most powerful features of this module. Users can provide a task and the expected correct answer.
- The module drives the agent to repeatedly attempt to complete the task and uses an LLM-based Grader tool to automatically judge whether the result is correct.
- If the task fails, the module initiates a learning process (prompter.learn_from_failure), providing the task description, incorrect answer, correct answer, and the agent's work history to the LLM. This guides the LLM to analyze the cause of failure, identify core misunderstandings, and ultimately generate an insight that can prevent similar errors in the future.
- This newly generated insight is temporarily used for subsequent attempts. If it helps the agent successfully complete the task, it will be permanently stored in the memory bank.
-
Regarding train_on_task: This feature is the most costly "heavy weapon." It should not be used for regular, one-time user interactions, but rather as an offline training method for building core skills. For example, before a new product feature is launched, we can use it to "batch inject" memories about the operating procedures of the new feature into the agent.
Workflow
This process shows the internal steps of the module when an external caller needs to learn and store a new plan.
