Learning from Self-Experience
When UFO successfully completes a task, users can save the successful experience to enhance the AppAgent's future performance. The AppAgent learns from its own successful experiences to improve task execution.
Mechanism
Workflow Steps
-
Complete a Session: UFO finishes executing a task successfully
-
Prompt User to Save: The system asks whether to save the experience

-
Summarize Experience: If the user chooses to save, the
ExperienceSummarizerprocesses the session: - Extracts key information from the execution trajectory
- Summarizes the experience into a structured demonstration example
- Saves it to the experience database at the configured path
-
The demonstration example includes fields similar to those in the AppAgent's prompt examples
-
Retrieve and Utilize: When encountering similar tasks in the future:
- The AppAgent queries the experience database
- Retrieves relevant past experiences
- Uses them to inform plan generation
Configuration
Configure the following parameters in config.yaml to enable self-experience learning:
| Configuration Option | Description | Type | Default |
|---|---|---|---|
RAG_EXPERIENCE |
Enable experience-based learning | Boolean | False |
RAG_EXPERIENCE_RETRIEVED_TOPK |
Number of top experiences to retrieve | Integer | 5 |
EXPERIENCE_SAVED_PATH |
Database path for storing experiences | String | "vectordb/experience/" |
For more details on RAG configuration, see the RAG Configuration Guide.
API Reference
Experience Summarizer
The ExperienceSummarizer class in ufo/experience/summarizer.py handles experience summarization:
The ExperienceSummarizer class is the summarizer for the experience learning.
Initialize the ApplicationAgentPrompter.
| Parameters: |
|
|---|
Source code in experience/summarizer.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
build_prompt(log_partition)
Build the prompt.
| Parameters: |
|
|---|
Source code in experience/summarizer.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
create_or_update_vector_db(summaries, db_path)
staticmethod
Create or update the vector database.
| Parameters: |
|
|---|
Source code in experience/summarizer.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |
create_or_update_yaml(summaries, yaml_path)
staticmethod
Create or update the YAML file.
| Parameters: |
|
|---|
Source code in experience/summarizer.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
get_summary(prompt_message)
Get the summary.
| Parameters: |
|
|---|
Source code in experience/summarizer.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
get_summary_list(logs)
Get the summary list.
| Parameters: |
|
|---|
Source code in experience/summarizer.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
read_logs(log_path)
staticmethod
Read the log.
| Parameters: |
|
|---|
Source code in experience/summarizer.py
119 120 121 122 123 124 125 126 | |
Experience Retriever
The ExperienceRetriever class in ufo/rag/retriever.py handles experience retrieval:
Bases: Retriever
Class to create experience retrievers.
Create a new ExperienceRetriever.
| Parameters: |
|
|---|
Source code in rag/retriever.py
136 137 138 139 140 141 | |
get_indexer(db_path)
Create an experience indexer.
| Parameters: |
|
|---|
Source code in rag/retriever.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |